freddyaboulton HF Staff commited on
Commit
1db022a
·
1 Parent(s): a28cfcb

Upload folder using huggingface_hub

Browse files
Dockerfile ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ FROM python:3.9
3
+
4
+ WORKDIR /code
5
+
6
+ COPY --link --chown=1000 . .
7
+
8
+ RUN mkdir -p /tmp/cache/
9
+ RUN chmod a+rwx -R /tmp/cache/
10
+ ENV TRANSFORMERS_CACHE=/tmp/cache/
11
+
12
+ RUN pip install --no-cache-dir -r requirements.txt
13
+
14
+ ENV PYTHONUNBUFFERED=1 GRADIO_ALLOW_FLAGGING=never GRADIO_NUM_PORTS=1 GRADIO_SERVER_NAME=0.0.0.0 GRADIO_SERVER_PORT=7860 SYSTEM=spaces
15
+
16
+ CMD ["python", "app.py"]
README.md CHANGED
@@ -1,10 +1,15 @@
 
1
  ---
2
- title: Gradio Test3
3
- emoji: 📉
4
- colorFrom: blue
5
- colorTo: pink
6
  sdk: docker
7
  pinned: false
 
8
  ---
9
 
10
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
 
 
 
1
+
2
  ---
3
+ tags: [gradio-custom-component,gradio-template-Dropdown,test,cool,dropdown]
4
+ title: gradio_test3 V0.0.1
5
+ colorFrom: pink
6
+ colorTo: yellow
7
  sdk: docker
8
  pinned: false
9
+ license: apache-2.0
10
  ---
11
 
12
+
13
+ # gradio_test3
14
+
15
+ This is a test component
__init__.py ADDED
File without changes
app.py ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ import gradio as gr
3
+ from gradio_test3 import Test3
4
+
5
+
6
+ example = Test3().example_inputs()
7
+
8
+ demo = gr.Interface(
9
+ lambda x:x,
10
+ Test3(), # interactive version of your component
11
+ Test3(), # static version of your component
12
+ # examples=[[example]], # uncomment this line to view the "example version" of your component
13
+ )
14
+
15
+
16
+ demo.launch()
requirements.txt ADDED
@@ -0,0 +1 @@
 
 
1
+ gradio_test3-0.0.1-py3-none-any.whl
src/.gitignore ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ .eggs/
2
+ dist/
3
+ *.pyc
4
+ __pycache__/
5
+ *.py[cod]
6
+ *$py.class
7
+ __tmp/*
8
+ *.pyi
9
+ node_modules
src/README.md ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ # gradio_test3
3
+ A Custom Gradio component.
4
+
5
+ ## Example usage
6
+
7
+ ```python
8
+ import gradio as gr
9
+ from gradio_test3 import Test3
10
+ ```
src/backend/gradio_test3/__init__.py ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+
2
+ from .test3 import Test3
3
+
4
+ __all__ = ['Test3']
src/backend/gradio_test3/test3.py ADDED
@@ -0,0 +1,186 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """gr.Dropdown() component."""
2
+
3
+ from __future__ import annotations
4
+
5
+ import warnings
6
+ from typing import Any, Callable, Literal
7
+
8
+ from gradio_client.documentation import document, set_documentation_group
9
+
10
+ from gradio.components.base import FormComponent
11
+ from gradio.events import Events
12
+
13
+ set_documentation_group("component")
14
+
15
+
16
+ @document()
17
+ class Test3(FormComponent):
18
+ """
19
+ Creates a dropdown of choices from which entries can be selected.
20
+ Preprocessing: passes the value of the selected dropdown entry as a {str} or its index as an {int} into the function, depending on `type`.
21
+ Postprocessing: expects a {str} corresponding to the value of the dropdown entry to be selected.
22
+ Examples-format: a {str} representing the drop down value to select.
23
+ Demos: sentence_builder, titanic_survival
24
+ """
25
+
26
+ EVENTS = [Events.change, Events.input, Events.select, Events.focus, Events.blur]
27
+
28
+ def __init__(
29
+ self,
30
+ choices: list[str | int | float | tuple[str, str | int | float]] | None = None,
31
+ *,
32
+ value: str | int | float | list[str | int | float] | Callable | None = None,
33
+ type: Literal["value", "index"] = "value",
34
+ multiselect: bool | None = None,
35
+ allow_custom_value: bool = False,
36
+ max_choices: int | None = None,
37
+ filterable: bool = True,
38
+ label: str | None = None,
39
+ info: str | None = None,
40
+ every: float | None = None,
41
+ show_label: bool | None = None,
42
+ container: bool = True,
43
+ scale: int | None = None,
44
+ min_width: int = 160,
45
+ interactive: bool | None = None,
46
+ visible: bool = True,
47
+ elem_id: str | None = None,
48
+ elem_classes: list[str] | str | None = None,
49
+ render: bool = True,
50
+ ):
51
+ """
52
+ Parameters:
53
+ choices: A list of string options to choose from. An option can also be a tuple of the form (name, value), where name is the displayed name of the dropdown choice and value is the value to be passed to the function, or returned by the function.
54
+ value: default value(s) selected in dropdown. If None, no value is selected by default. If callable, the function will be called whenever the app loads to set the initial value of the component.
55
+ type: Type of value to be returned by component. "value" returns the string of the choice selected, "index" returns the index of the choice selected.
56
+ multiselect: if True, multiple choices can be selected.
57
+ allow_custom_value: If True, allows user to enter a custom value that is not in the list of choices.
58
+ max_choices: maximum number of choices that can be selected. If None, no limit is enforced.
59
+ filterable: If True, user will be able to type into the dropdown and filter the choices by typing. Can only be set to False if `allow_custom_value` is False.
60
+ label: The label for this component. Appears above the component and is also used as the header if there are a table of examples for this component. If None and used in a `gr.Interface`, the label will be the name of the parameter this component is assigned to.
61
+ info: additional component description.
62
+ every: If `value` is a callable, run the function 'every' number of seconds while the client connection is open. Has no effect otherwise. Queue must be enabled. The event can be accessed (e.g. to cancel it) via this component's .load_event attribute.
63
+ show_label: if True, will display label.
64
+ container: If True, will place the component in a container - providing some extra padding around the border.
65
+ scale: relative width compared to adjacent Components in a Row. For example, if Component A has scale=2, and Component B has scale=1, A will be twice as wide as B. Should be an integer.
66
+ min_width: minimum pixel width, will wrap if not sufficient screen space to satisfy this value. If a certain scale value results in this Component being narrower than min_width, the min_width parameter will be respected first.
67
+ interactive: if True, choices in this dropdown will be selectable; if False, selection will be disabled. If not provided, this is inferred based on whether the component is used as an input or output.
68
+ visible: If False, component will be hidden.
69
+ elem_id: An optional string that is assigned as the id of this component in the HTML DOM. Can be used for targeting CSS styles.
70
+ elem_classes: An optional list of strings that are assigned as the classes of this component in the HTML DOM. Can be used for targeting CSS styles.
71
+ render: If False, component will not render be rendered in the Blocks context. Should be used if the intention is to assign event listeners now but render the component later.
72
+ """
73
+ self.choices = (
74
+ # Although we expect choices to be a list of tuples, it can be a list of tuples if the Gradio app
75
+ # is loaded with gr.load() since Python tuples are converted to lists in JSON.
76
+ [tuple(c) if isinstance(c, (tuple, list)) else (str(c), c) for c in choices]
77
+ if choices
78
+ else []
79
+ )
80
+ valid_types = ["value", "index"]
81
+ if type not in valid_types:
82
+ raise ValueError(
83
+ f"Invalid value for parameter `type`: {type}. Please choose from one of: {valid_types}"
84
+ )
85
+ self.type = type
86
+ self.multiselect = multiselect
87
+ if multiselect and isinstance(value, str):
88
+ value = [value]
89
+ if not multiselect and max_choices is not None:
90
+ warnings.warn(
91
+ "The `max_choices` parameter is ignored when `multiselect` is False."
92
+ )
93
+ if not filterable and allow_custom_value:
94
+ filterable = True
95
+ warnings.warn(
96
+ "The `filterable` parameter cannot be set to False when `allow_custom_value` is True. Setting `filterable` to True."
97
+ )
98
+ self.max_choices = max_choices
99
+ self.allow_custom_value = allow_custom_value
100
+ self.filterable = filterable
101
+ super().__init__(
102
+ label=label,
103
+ info=info,
104
+ every=every,
105
+ show_label=show_label,
106
+ container=container,
107
+ scale=scale,
108
+ min_width=min_width,
109
+ interactive=interactive,
110
+ visible=visible,
111
+ elem_id=elem_id,
112
+ elem_classes=elem_classes,
113
+ render=render,
114
+ value=value,
115
+ )
116
+
117
+ def api_info(self) -> dict[str, Any]:
118
+ if self.multiselect:
119
+ json_type = {
120
+ "type": "array",
121
+ "items": {"type": "string", "enum": [c[1] for c in self.choices]},
122
+ }
123
+ else:
124
+ json_type = {
125
+ "type": "string",
126
+ "enum": [c[1] for c in self.choices],
127
+ }
128
+ return json_type
129
+
130
+ def example_inputs(self) -> Any:
131
+ if self.multiselect:
132
+ return [self.choices[0][1]] if self.choices else []
133
+ else:
134
+ return self.choices[0][1] if self.choices else None
135
+
136
+ def preprocess(
137
+ self, payload: str | int | float | list[str | int | float] | None
138
+ ) -> str | int | float | list[str | int | float] | list[int | None] | None:
139
+ if self.type == "value":
140
+ return payload
141
+ elif self.type == "index":
142
+ choice_values = [value for _, value in self.choices]
143
+ if payload is None:
144
+ return None
145
+ elif self.multiselect:
146
+ assert isinstance(payload, list)
147
+ return [
148
+ choice_values.index(choice) if choice in choice_values else None
149
+ for choice in payload
150
+ ]
151
+ else:
152
+ return (
153
+ choice_values.index(payload) if payload in choice_values else None
154
+ )
155
+ else:
156
+ raise ValueError(
157
+ f"Unknown type: {self.type}. Please choose from: 'value', 'index'."
158
+ )
159
+
160
+ def _warn_if_invalid_choice(self, value):
161
+ if self.allow_custom_value or value in [value for _, value in self.choices]:
162
+ return
163
+ warnings.warn(
164
+ f"The value passed into gr.Dropdown() is not in the list of choices. Please update the list of choices to include: {value} or set allow_custom_value=True."
165
+ )
166
+
167
+ def postprocess(
168
+ self, value: str | int | float | list[str | int | float] | None
169
+ ) -> str | int | float | list[str | int | float] | None:
170
+ if value is None:
171
+ return None
172
+ if self.multiselect:
173
+ if not isinstance(value, list):
174
+ value = [value]
175
+ [self._warn_if_invalid_choice(_y) for _y in value]
176
+ else:
177
+ self._warn_if_invalid_choice(value)
178
+ return value
179
+
180
+ def as_example(self, input_data):
181
+ if self.multiselect:
182
+ return [
183
+ next((c[0] for c in self.choices if c[1] == data), None)
184
+ for data in input_data
185
+ ]
186
+ return next((c[0] for c in self.choices if c[1] == input_data), None)
src/backend/gradio_test3/test3.pyi ADDED
@@ -0,0 +1,373 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """gr.Dropdown() component."""
2
+
3
+ from __future__ import annotations
4
+
5
+ import warnings
6
+ from typing import Any, Callable, Literal
7
+
8
+ from gradio_client.documentation import document, set_documentation_group
9
+
10
+ from gradio.components.base import FormComponent
11
+ from gradio.events import Events
12
+
13
+ set_documentation_group("component")
14
+
15
+ from gradio.events import Dependency
16
+
17
+ @document()
18
+ class Test3(FormComponent):
19
+ """
20
+ Creates a dropdown of choices from which entries can be selected.
21
+ Preprocessing: passes the value of the selected dropdown entry as a {str} or its index as an {int} into the function, depending on `type`.
22
+ Postprocessing: expects a {str} corresponding to the value of the dropdown entry to be selected.
23
+ Examples-format: a {str} representing the drop down value to select.
24
+ Demos: sentence_builder, titanic_survival
25
+ """
26
+
27
+ EVENTS = [Events.change, Events.input, Events.select, Events.focus, Events.blur]
28
+
29
+ def __init__(
30
+ self,
31
+ choices: list[str | int | float | tuple[str, str | int | float]] | None = None,
32
+ *,
33
+ value: str | int | float | list[str | int | float] | Callable | None = None,
34
+ type: Literal["value", "index"] = "value",
35
+ multiselect: bool | None = None,
36
+ allow_custom_value: bool = False,
37
+ max_choices: int | None = None,
38
+ filterable: bool = True,
39
+ label: str | None = None,
40
+ info: str | None = None,
41
+ every: float | None = None,
42
+ show_label: bool | None = None,
43
+ container: bool = True,
44
+ scale: int | None = None,
45
+ min_width: int = 160,
46
+ interactive: bool | None = None,
47
+ visible: bool = True,
48
+ elem_id: str | None = None,
49
+ elem_classes: list[str] | str | None = None,
50
+ render: bool = True,
51
+ ):
52
+ """
53
+ Parameters:
54
+ choices: A list of string options to choose from. An option can also be a tuple of the form (name, value), where name is the displayed name of the dropdown choice and value is the value to be passed to the function, or returned by the function.
55
+ value: default value(s) selected in dropdown. If None, no value is selected by default. If callable, the function will be called whenever the app loads to set the initial value of the component.
56
+ type: Type of value to be returned by component. "value" returns the string of the choice selected, "index" returns the index of the choice selected.
57
+ multiselect: if True, multiple choices can be selected.
58
+ allow_custom_value: If True, allows user to enter a custom value that is not in the list of choices.
59
+ max_choices: maximum number of choices that can be selected. If None, no limit is enforced.
60
+ filterable: If True, user will be able to type into the dropdown and filter the choices by typing. Can only be set to False if `allow_custom_value` is False.
61
+ label: The label for this component. Appears above the component and is also used as the header if there are a table of examples for this component. If None and used in a `gr.Interface`, the label will be the name of the parameter this component is assigned to.
62
+ info: additional component description.
63
+ every: If `value` is a callable, run the function 'every' number of seconds while the client connection is open. Has no effect otherwise. Queue must be enabled. The event can be accessed (e.g. to cancel it) via this component's .load_event attribute.
64
+ show_label: if True, will display label.
65
+ container: If True, will place the component in a container - providing some extra padding around the border.
66
+ scale: relative width compared to adjacent Components in a Row. For example, if Component A has scale=2, and Component B has scale=1, A will be twice as wide as B. Should be an integer.
67
+ min_width: minimum pixel width, will wrap if not sufficient screen space to satisfy this value. If a certain scale value results in this Component being narrower than min_width, the min_width parameter will be respected first.
68
+ interactive: if True, choices in this dropdown will be selectable; if False, selection will be disabled. If not provided, this is inferred based on whether the component is used as an input or output.
69
+ visible: If False, component will be hidden.
70
+ elem_id: An optional string that is assigned as the id of this component in the HTML DOM. Can be used for targeting CSS styles.
71
+ elem_classes: An optional list of strings that are assigned as the classes of this component in the HTML DOM. Can be used for targeting CSS styles.
72
+ render: If False, component will not render be rendered in the Blocks context. Should be used if the intention is to assign event listeners now but render the component later.
73
+ """
74
+ self.choices = (
75
+ # Although we expect choices to be a list of tuples, it can be a list of tuples if the Gradio app
76
+ # is loaded with gr.load() since Python tuples are converted to lists in JSON.
77
+ [tuple(c) if isinstance(c, (tuple, list)) else (str(c), c) for c in choices]
78
+ if choices
79
+ else []
80
+ )
81
+ valid_types = ["value", "index"]
82
+ if type not in valid_types:
83
+ raise ValueError(
84
+ f"Invalid value for parameter `type`: {type}. Please choose from one of: {valid_types}"
85
+ )
86
+ self.type = type
87
+ self.multiselect = multiselect
88
+ if multiselect and isinstance(value, str):
89
+ value = [value]
90
+ if not multiselect and max_choices is not None:
91
+ warnings.warn(
92
+ "The `max_choices` parameter is ignored when `multiselect` is False."
93
+ )
94
+ if not filterable and allow_custom_value:
95
+ filterable = True
96
+ warnings.warn(
97
+ "The `filterable` parameter cannot be set to False when `allow_custom_value` is True. Setting `filterable` to True."
98
+ )
99
+ self.max_choices = max_choices
100
+ self.allow_custom_value = allow_custom_value
101
+ self.filterable = filterable
102
+ super().__init__(
103
+ label=label,
104
+ info=info,
105
+ every=every,
106
+ show_label=show_label,
107
+ container=container,
108
+ scale=scale,
109
+ min_width=min_width,
110
+ interactive=interactive,
111
+ visible=visible,
112
+ elem_id=elem_id,
113
+ elem_classes=elem_classes,
114
+ render=render,
115
+ value=value,
116
+ )
117
+
118
+ def api_info(self) -> dict[str, Any]:
119
+ if self.multiselect:
120
+ json_type = {
121
+ "type": "array",
122
+ "items": {"type": "string", "enum": [c[1] for c in self.choices]},
123
+ }
124
+ else:
125
+ json_type = {
126
+ "type": "string",
127
+ "enum": [c[1] for c in self.choices],
128
+ }
129
+ return json_type
130
+
131
+ def example_inputs(self) -> Any:
132
+ if self.multiselect:
133
+ return [self.choices[0][1]] if self.choices else []
134
+ else:
135
+ return self.choices[0][1] if self.choices else None
136
+
137
+ def preprocess(
138
+ self, payload: str | int | float | list[str | int | float] | None
139
+ ) -> str | int | float | list[str | int | float] | list[int | None] | None:
140
+ if self.type == "value":
141
+ return payload
142
+ elif self.type == "index":
143
+ choice_values = [value for _, value in self.choices]
144
+ if payload is None:
145
+ return None
146
+ elif self.multiselect:
147
+ assert isinstance(payload, list)
148
+ return [
149
+ choice_values.index(choice) if choice in choice_values else None
150
+ for choice in payload
151
+ ]
152
+ else:
153
+ return (
154
+ choice_values.index(payload) if payload in choice_values else None
155
+ )
156
+ else:
157
+ raise ValueError(
158
+ f"Unknown type: {self.type}. Please choose from: 'value', 'index'."
159
+ )
160
+
161
+ def _warn_if_invalid_choice(self, value):
162
+ if self.allow_custom_value or value in [value for _, value in self.choices]:
163
+ return
164
+ warnings.warn(
165
+ f"The value passed into gr.Dropdown() is not in the list of choices. Please update the list of choices to include: {value} or set allow_custom_value=True."
166
+ )
167
+
168
+ def postprocess(
169
+ self, value: str | int | float | list[str | int | float] | None
170
+ ) -> str | int | float | list[str | int | float] | None:
171
+ if value is None:
172
+ return None
173
+ if self.multiselect:
174
+ if not isinstance(value, list):
175
+ value = [value]
176
+ [self._warn_if_invalid_choice(_y) for _y in value]
177
+ else:
178
+ self._warn_if_invalid_choice(value)
179
+ return value
180
+
181
+ def as_example(self, input_data):
182
+ if self.multiselect:
183
+ return [
184
+ next((c[0] for c in self.choices if c[1] == data), None)
185
+ for data in input_data
186
+ ]
187
+ return next((c[0] for c in self.choices if c[1] == input_data), None)
188
+
189
+
190
+ def change(self,
191
+ fn: Callable | None,
192
+ inputs: Component | Sequence[Component] | set[Component] | None = None,
193
+ outputs: Component | Sequence[Component] | None = None,
194
+ api_name: str | None | Literal[False] = None,
195
+ status_tracker: None = None,
196
+ scroll_to_output: bool = False,
197
+ show_progress: Literal["full", "minimal", "hidden"] = "full",
198
+ queue: bool | None = None,
199
+ batch: bool = False,
200
+ max_batch_size: int = 4,
201
+ preprocess: bool = True,
202
+ postprocess: bool = True,
203
+ cancels: dict[str, Any] | list[dict[str, Any]] | None = None,
204
+ every: float | None = None,
205
+ trigger_mode: Literal["once", "multiple", "always_last"] | None = None,
206
+ js: str | None = None,) -> Dependency:
207
+ """
208
+ Parameters:
209
+ fn: the function to call when this event is triggered. Often a machine learning model's prediction function. Each parameter of the function corresponds to one input component, and the function should return a single value or a tuple of values, with each element in the tuple corresponding to one output component.
210
+ inputs: List of gradio.components to use as inputs. If the function takes no inputs, this should be an empty list.
211
+ outputs: List of gradio.components to use as outputs. If the function returns no outputs, this should be an empty list.
212
+ api_name: Defines how the endpoint appears in the API docs. Can be a string, None, or False. If False, the endpoint will not be exposed in the api docs. If set to None, the endpoint will be exposed in the api docs as an unnamed endpoint, although this behavior will be changed in Gradio 4.0. If set to a string, the endpoint will be exposed in the api docs with the given name.
213
+ scroll_to_output: If True, will scroll to output component on completion
214
+ show_progress: If True, will show progress animation while pending
215
+ queue: If True, will place the request on the queue, if the queue has been enabled. If False, will not put this event on the queue, even if the queue has been enabled. If None, will use the queue setting of the gradio app.
216
+ batch: If True, then the function should process a batch of inputs, meaning that it should accept a list of input values for each parameter. The lists should be of equal length (and be up to length `max_batch_size`). The function is then *required* to return a tuple of lists (even if there is only 1 output component), with each list in the tuple corresponding to one output component.
217
+ max_batch_size: Maximum number of inputs to batch together if this is called from the queue (only relevant if batch=True)
218
+ preprocess: If False, will not run preprocessing of component data before running 'fn' (e.g. leaving it as a base64 string if this method is called with the `Image` component).
219
+ postprocess: If False, will not run postprocessing of component data before returning 'fn' output to the browser.
220
+ cancels: A list of other events to cancel when this listener is triggered. For example, setting cancels=[click_event] will cancel the click_event, where click_event is the return value of another components .click method. Functions that have not yet run (or generators that are iterating) will be cancelled, but functions that are currently running will be allowed to finish.
221
+ every: Run this event 'every' number of seconds while the client connection is open. Interpreted in seconds. Queue must be enabled.
222
+ trigger_mode: If "once" (default for all events except `.change()`) would not allow any submissions while an event is pending. If set to "multiple", unlimited submissions are allowed while pending, and "always_last" (default for `.change()` event) would allow a second submission after the pending event is complete.
223
+ js: Optional frontend js method to run before running 'fn'. Input arguments for js method are values of 'inputs' and 'outputs', return should be a list of values for output components.
224
+ """
225
+ ...
226
+
227
+ def input(self,
228
+ fn: Callable | None,
229
+ inputs: Component | Sequence[Component] | set[Component] | None = None,
230
+ outputs: Component | Sequence[Component] | None = None,
231
+ api_name: str | None | Literal[False] = None,
232
+ status_tracker: None = None,
233
+ scroll_to_output: bool = False,
234
+ show_progress: Literal["full", "minimal", "hidden"] = "full",
235
+ queue: bool | None = None,
236
+ batch: bool = False,
237
+ max_batch_size: int = 4,
238
+ preprocess: bool = True,
239
+ postprocess: bool = True,
240
+ cancels: dict[str, Any] | list[dict[str, Any]] | None = None,
241
+ every: float | None = None,
242
+ trigger_mode: Literal["once", "multiple", "always_last"] | None = None,
243
+ js: str | None = None,) -> Dependency:
244
+ """
245
+ Parameters:
246
+ fn: the function to call when this event is triggered. Often a machine learning model's prediction function. Each parameter of the function corresponds to one input component, and the function should return a single value or a tuple of values, with each element in the tuple corresponding to one output component.
247
+ inputs: List of gradio.components to use as inputs. If the function takes no inputs, this should be an empty list.
248
+ outputs: List of gradio.components to use as outputs. If the function returns no outputs, this should be an empty list.
249
+ api_name: Defines how the endpoint appears in the API docs. Can be a string, None, or False. If False, the endpoint will not be exposed in the api docs. If set to None, the endpoint will be exposed in the api docs as an unnamed endpoint, although this behavior will be changed in Gradio 4.0. If set to a string, the endpoint will be exposed in the api docs with the given name.
250
+ scroll_to_output: If True, will scroll to output component on completion
251
+ show_progress: If True, will show progress animation while pending
252
+ queue: If True, will place the request on the queue, if the queue has been enabled. If False, will not put this event on the queue, even if the queue has been enabled. If None, will use the queue setting of the gradio app.
253
+ batch: If True, then the function should process a batch of inputs, meaning that it should accept a list of input values for each parameter. The lists should be of equal length (and be up to length `max_batch_size`). The function is then *required* to return a tuple of lists (even if there is only 1 output component), with each list in the tuple corresponding to one output component.
254
+ max_batch_size: Maximum number of inputs to batch together if this is called from the queue (only relevant if batch=True)
255
+ preprocess: If False, will not run preprocessing of component data before running 'fn' (e.g. leaving it as a base64 string if this method is called with the `Image` component).
256
+ postprocess: If False, will not run postprocessing of component data before returning 'fn' output to the browser.
257
+ cancels: A list of other events to cancel when this listener is triggered. For example, setting cancels=[click_event] will cancel the click_event, where click_event is the return value of another components .click method. Functions that have not yet run (or generators that are iterating) will be cancelled, but functions that are currently running will be allowed to finish.
258
+ every: Run this event 'every' number of seconds while the client connection is open. Interpreted in seconds. Queue must be enabled.
259
+ trigger_mode: If "once" (default for all events except `.change()`) would not allow any submissions while an event is pending. If set to "multiple", unlimited submissions are allowed while pending, and "always_last" (default for `.change()` event) would allow a second submission after the pending event is complete.
260
+ js: Optional frontend js method to run before running 'fn'. Input arguments for js method are values of 'inputs' and 'outputs', return should be a list of values for output components.
261
+ """
262
+ ...
263
+
264
+ def select(self,
265
+ fn: Callable | None,
266
+ inputs: Component | Sequence[Component] | set[Component] | None = None,
267
+ outputs: Component | Sequence[Component] | None = None,
268
+ api_name: str | None | Literal[False] = None,
269
+ status_tracker: None = None,
270
+ scroll_to_output: bool = False,
271
+ show_progress: Literal["full", "minimal", "hidden"] = "full",
272
+ queue: bool | None = None,
273
+ batch: bool = False,
274
+ max_batch_size: int = 4,
275
+ preprocess: bool = True,
276
+ postprocess: bool = True,
277
+ cancels: dict[str, Any] | list[dict[str, Any]] | None = None,
278
+ every: float | None = None,
279
+ trigger_mode: Literal["once", "multiple", "always_last"] | None = None,
280
+ js: str | None = None,) -> Dependency:
281
+ """
282
+ Parameters:
283
+ fn: the function to call when this event is triggered. Often a machine learning model's prediction function. Each parameter of the function corresponds to one input component, and the function should return a single value or a tuple of values, with each element in the tuple corresponding to one output component.
284
+ inputs: List of gradio.components to use as inputs. If the function takes no inputs, this should be an empty list.
285
+ outputs: List of gradio.components to use as outputs. If the function returns no outputs, this should be an empty list.
286
+ api_name: Defines how the endpoint appears in the API docs. Can be a string, None, or False. If False, the endpoint will not be exposed in the api docs. If set to None, the endpoint will be exposed in the api docs as an unnamed endpoint, although this behavior will be changed in Gradio 4.0. If set to a string, the endpoint will be exposed in the api docs with the given name.
287
+ scroll_to_output: If True, will scroll to output component on completion
288
+ show_progress: If True, will show progress animation while pending
289
+ queue: If True, will place the request on the queue, if the queue has been enabled. If False, will not put this event on the queue, even if the queue has been enabled. If None, will use the queue setting of the gradio app.
290
+ batch: If True, then the function should process a batch of inputs, meaning that it should accept a list of input values for each parameter. The lists should be of equal length (and be up to length `max_batch_size`). The function is then *required* to return a tuple of lists (even if there is only 1 output component), with each list in the tuple corresponding to one output component.
291
+ max_batch_size: Maximum number of inputs to batch together if this is called from the queue (only relevant if batch=True)
292
+ preprocess: If False, will not run preprocessing of component data before running 'fn' (e.g. leaving it as a base64 string if this method is called with the `Image` component).
293
+ postprocess: If False, will not run postprocessing of component data before returning 'fn' output to the browser.
294
+ cancels: A list of other events to cancel when this listener is triggered. For example, setting cancels=[click_event] will cancel the click_event, where click_event is the return value of another components .click method. Functions that have not yet run (or generators that are iterating) will be cancelled, but functions that are currently running will be allowed to finish.
295
+ every: Run this event 'every' number of seconds while the client connection is open. Interpreted in seconds. Queue must be enabled.
296
+ trigger_mode: If "once" (default for all events except `.change()`) would not allow any submissions while an event is pending. If set to "multiple", unlimited submissions are allowed while pending, and "always_last" (default for `.change()` event) would allow a second submission after the pending event is complete.
297
+ js: Optional frontend js method to run before running 'fn'. Input arguments for js method are values of 'inputs' and 'outputs', return should be a list of values for output components.
298
+ """
299
+ ...
300
+
301
+ def focus(self,
302
+ fn: Callable | None,
303
+ inputs: Component | Sequence[Component] | set[Component] | None = None,
304
+ outputs: Component | Sequence[Component] | None = None,
305
+ api_name: str | None | Literal[False] = None,
306
+ status_tracker: None = None,
307
+ scroll_to_output: bool = False,
308
+ show_progress: Literal["full", "minimal", "hidden"] = "full",
309
+ queue: bool | None = None,
310
+ batch: bool = False,
311
+ max_batch_size: int = 4,
312
+ preprocess: bool = True,
313
+ postprocess: bool = True,
314
+ cancels: dict[str, Any] | list[dict[str, Any]] | None = None,
315
+ every: float | None = None,
316
+ trigger_mode: Literal["once", "multiple", "always_last"] | None = None,
317
+ js: str | None = None,) -> Dependency:
318
+ """
319
+ Parameters:
320
+ fn: the function to call when this event is triggered. Often a machine learning model's prediction function. Each parameter of the function corresponds to one input component, and the function should return a single value or a tuple of values, with each element in the tuple corresponding to one output component.
321
+ inputs: List of gradio.components to use as inputs. If the function takes no inputs, this should be an empty list.
322
+ outputs: List of gradio.components to use as outputs. If the function returns no outputs, this should be an empty list.
323
+ api_name: Defines how the endpoint appears in the API docs. Can be a string, None, or False. If False, the endpoint will not be exposed in the api docs. If set to None, the endpoint will be exposed in the api docs as an unnamed endpoint, although this behavior will be changed in Gradio 4.0. If set to a string, the endpoint will be exposed in the api docs with the given name.
324
+ scroll_to_output: If True, will scroll to output component on completion
325
+ show_progress: If True, will show progress animation while pending
326
+ queue: If True, will place the request on the queue, if the queue has been enabled. If False, will not put this event on the queue, even if the queue has been enabled. If None, will use the queue setting of the gradio app.
327
+ batch: If True, then the function should process a batch of inputs, meaning that it should accept a list of input values for each parameter. The lists should be of equal length (and be up to length `max_batch_size`). The function is then *required* to return a tuple of lists (even if there is only 1 output component), with each list in the tuple corresponding to one output component.
328
+ max_batch_size: Maximum number of inputs to batch together if this is called from the queue (only relevant if batch=True)
329
+ preprocess: If False, will not run preprocessing of component data before running 'fn' (e.g. leaving it as a base64 string if this method is called with the `Image` component).
330
+ postprocess: If False, will not run postprocessing of component data before returning 'fn' output to the browser.
331
+ cancels: A list of other events to cancel when this listener is triggered. For example, setting cancels=[click_event] will cancel the click_event, where click_event is the return value of another components .click method. Functions that have not yet run (or generators that are iterating) will be cancelled, but functions that are currently running will be allowed to finish.
332
+ every: Run this event 'every' number of seconds while the client connection is open. Interpreted in seconds. Queue must be enabled.
333
+ trigger_mode: If "once" (default for all events except `.change()`) would not allow any submissions while an event is pending. If set to "multiple", unlimited submissions are allowed while pending, and "always_last" (default for `.change()` event) would allow a second submission after the pending event is complete.
334
+ js: Optional frontend js method to run before running 'fn'. Input arguments for js method are values of 'inputs' and 'outputs', return should be a list of values for output components.
335
+ """
336
+ ...
337
+
338
+ def blur(self,
339
+ fn: Callable | None,
340
+ inputs: Component | Sequence[Component] | set[Component] | None = None,
341
+ outputs: Component | Sequence[Component] | None = None,
342
+ api_name: str | None | Literal[False] = None,
343
+ status_tracker: None = None,
344
+ scroll_to_output: bool = False,
345
+ show_progress: Literal["full", "minimal", "hidden"] = "full",
346
+ queue: bool | None = None,
347
+ batch: bool = False,
348
+ max_batch_size: int = 4,
349
+ preprocess: bool = True,
350
+ postprocess: bool = True,
351
+ cancels: dict[str, Any] | list[dict[str, Any]] | None = None,
352
+ every: float | None = None,
353
+ trigger_mode: Literal["once", "multiple", "always_last"] | None = None,
354
+ js: str | None = None,) -> Dependency:
355
+ """
356
+ Parameters:
357
+ fn: the function to call when this event is triggered. Often a machine learning model's prediction function. Each parameter of the function corresponds to one input component, and the function should return a single value or a tuple of values, with each element in the tuple corresponding to one output component.
358
+ inputs: List of gradio.components to use as inputs. If the function takes no inputs, this should be an empty list.
359
+ outputs: List of gradio.components to use as outputs. If the function returns no outputs, this should be an empty list.
360
+ api_name: Defines how the endpoint appears in the API docs. Can be a string, None, or False. If False, the endpoint will not be exposed in the api docs. If set to None, the endpoint will be exposed in the api docs as an unnamed endpoint, although this behavior will be changed in Gradio 4.0. If set to a string, the endpoint will be exposed in the api docs with the given name.
361
+ scroll_to_output: If True, will scroll to output component on completion
362
+ show_progress: If True, will show progress animation while pending
363
+ queue: If True, will place the request on the queue, if the queue has been enabled. If False, will not put this event on the queue, even if the queue has been enabled. If None, will use the queue setting of the gradio app.
364
+ batch: If True, then the function should process a batch of inputs, meaning that it should accept a list of input values for each parameter. The lists should be of equal length (and be up to length `max_batch_size`). The function is then *required* to return a tuple of lists (even if there is only 1 output component), with each list in the tuple corresponding to one output component.
365
+ max_batch_size: Maximum number of inputs to batch together if this is called from the queue (only relevant if batch=True)
366
+ preprocess: If False, will not run preprocessing of component data before running 'fn' (e.g. leaving it as a base64 string if this method is called with the `Image` component).
367
+ postprocess: If False, will not run postprocessing of component data before returning 'fn' output to the browser.
368
+ cancels: A list of other events to cancel when this listener is triggered. For example, setting cancels=[click_event] will cancel the click_event, where click_event is the return value of another components .click method. Functions that have not yet run (or generators that are iterating) will be cancelled, but functions that are currently running will be allowed to finish.
369
+ every: Run this event 'every' number of seconds while the client connection is open. Interpreted in seconds. Queue must be enabled.
370
+ trigger_mode: If "once" (default for all events except `.change()`) would not allow any submissions while an event is pending. If set to "multiple", unlimited submissions are allowed while pending, and "always_last" (default for `.change()` event) would allow a second submission after the pending event is complete.
371
+ js: Optional frontend js method to run before running 'fn'. Input arguments for js method are values of 'inputs' and 'outputs', return should be a list of values for output components.
372
+ """
373
+ ...
src/demo/__init__.py ADDED
File without changes
src/demo/app.py ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ import gradio as gr
3
+ from gradio_test3 import Test3
4
+
5
+
6
+ example = Test3().example_inputs()
7
+
8
+ demo = gr.Interface(
9
+ lambda x:x,
10
+ Test3(), # interactive version of your component
11
+ Test3(), # static version of your component
12
+ # examples=[[example]], # uncomment this line to view the "example version" of your component
13
+ )
14
+
15
+
16
+ demo.launch()
src/frontend/Example.svelte ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <script lang="ts">
2
+ export let value: string;
3
+ export let type: "gallery" | "table";
4
+ export let selected = false;
5
+ </script>
6
+
7
+ <div
8
+ class:table={type === "table"}
9
+ class:gallery={type === "gallery"}
10
+ class:selected
11
+ >
12
+ {value}
13
+ </div>
14
+
15
+ <style>
16
+ .gallery {
17
+ padding: var(--size-1) var(--size-2);
18
+ }
19
+ </style>
src/frontend/Index.svelte ADDED
@@ -0,0 +1,96 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <script context="module" lang="ts">
2
+ export { default as BaseDropdown } from "./shared/Dropdown.svelte";
3
+ export { default as BaseMultiselect } from "./shared/Multiselect.svelte";
4
+ export { default as BaseExample } from "./Example.svelte";
5
+ </script>
6
+
7
+ <script lang="ts">
8
+ import type { Gradio, SelectData } from "@gradio/utils";
9
+ import Multiselect from "./shared/Multiselect.svelte";
10
+ import Dropdown from "./shared/Dropdown.svelte";
11
+ import { Block } from "@gradio/atoms";
12
+ import { StatusTracker } from "@gradio/statustracker";
13
+ import type { LoadingStatus } from "@gradio/statustracker";
14
+
15
+ export let label = "Dropdown";
16
+ export let info: string | undefined = undefined;
17
+ export let elem_id = "";
18
+ export let elem_classes: string[] = [];
19
+ export let visible = true;
20
+ export let value: string | string[];
21
+ export let value_is_output = false;
22
+ export let multiselect = false;
23
+ export let max_choices: number | null = null;
24
+ export let choices: [string, string | number][];
25
+ export let show_label: boolean;
26
+ export let filterable: boolean;
27
+ export let container = true;
28
+ export let scale: number | null = null;
29
+ export let min_width: number | undefined = undefined;
30
+ export let loading_status: LoadingStatus;
31
+ export let allow_custom_value = false;
32
+ export let gradio: Gradio<{
33
+ change: never;
34
+ input: never;
35
+ select: SelectData;
36
+ blur: never;
37
+ focus: never;
38
+ }>;
39
+ export let interactive: boolean;
40
+ </script>
41
+
42
+ <Block
43
+ {visible}
44
+ {elem_id}
45
+ {elem_classes}
46
+ padding={container}
47
+ allow_overflow={false}
48
+ {scale}
49
+ {min_width}
50
+ >
51
+ <StatusTracker
52
+ autoscroll={gradio.autoscroll}
53
+ i18n={gradio.i18n}
54
+ {...loading_status}
55
+ />
56
+
57
+ {#if multiselect}
58
+ <Multiselect
59
+ bind:value
60
+ bind:value_is_output
61
+ {choices}
62
+ {max_choices}
63
+ {label}
64
+ {info}
65
+ {show_label}
66
+ {allow_custom_value}
67
+ {filterable}
68
+ {container}
69
+ i18n={gradio.i18n}
70
+ on:change={() => gradio.dispatch("change")}
71
+ on:input={() => gradio.dispatch("input")}
72
+ on:select={(e) => gradio.dispatch("select", e.detail)}
73
+ on:blur={() => gradio.dispatch("blur")}
74
+ on:focus={() => gradio.dispatch("focus")}
75
+ disabled={!interactive}
76
+ />
77
+ {:else}
78
+ <Dropdown
79
+ bind:value
80
+ bind:value_is_output
81
+ {choices}
82
+ {label}
83
+ {info}
84
+ {show_label}
85
+ {filterable}
86
+ {allow_custom_value}
87
+ {container}
88
+ on:change={() => gradio.dispatch("change")}
89
+ on:input={() => gradio.dispatch("input")}
90
+ on:select={(e) => gradio.dispatch("select", e.detail)}
91
+ on:blur={() => gradio.dispatch("blur")}
92
+ on:focus={() => gradio.dispatch("focus")}
93
+ disabled={!interactive}
94
+ />
95
+ {/if}
96
+ </Block>
src/frontend/package-lock.json ADDED
@@ -0,0 +1,918 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "gradio_test3",
3
+ "version": "0.3.1",
4
+ "lockfileVersion": 3,
5
+ "requires": true,
6
+ "packages": {
7
+ "": {
8
+ "name": "gradio_test3",
9
+ "version": "0.3.1",
10
+ "license": "ISC",
11
+ "dependencies": {
12
+ "@gradio/atoms": "0.2.1",
13
+ "@gradio/icons": "0.2.0",
14
+ "@gradio/statustracker": "0.3.1",
15
+ "@gradio/utils": "0.2.0"
16
+ }
17
+ },
18
+ "node_modules/@ampproject/remapping": {
19
+ "version": "2.2.1",
20
+ "resolved": "https://registry.npmjs.org/@ampproject/remapping/-/remapping-2.2.1.tgz",
21
+ "integrity": "sha512-lFMjJTrFL3j7L9yBxwYfCq2k6qqwHyzuUl/XBnif78PWTJYyL/dfowQHWE3sp6U6ZzqWiiIZnpTMO96zhkjwtg==",
22
+ "peer": true,
23
+ "dependencies": {
24
+ "@jridgewell/gen-mapping": "^0.3.0",
25
+ "@jridgewell/trace-mapping": "^0.3.9"
26
+ },
27
+ "engines": {
28
+ "node": ">=6.0.0"
29
+ }
30
+ },
31
+ "node_modules/@esbuild/android-arm": {
32
+ "version": "0.19.5",
33
+ "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.19.5.tgz",
34
+ "integrity": "sha512-bhvbzWFF3CwMs5tbjf3ObfGqbl/17ict2/uwOSfr3wmxDE6VdS2GqY/FuzIPe0q0bdhj65zQsvqfArI9MY6+AA==",
35
+ "cpu": [
36
+ "arm"
37
+ ],
38
+ "optional": true,
39
+ "os": [
40
+ "android"
41
+ ],
42
+ "engines": {
43
+ "node": ">=12"
44
+ }
45
+ },
46
+ "node_modules/@esbuild/android-arm64": {
47
+ "version": "0.19.5",
48
+ "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.19.5.tgz",
49
+ "integrity": "sha512-5d1OkoJxnYQfmC+Zd8NBFjkhyCNYwM4n9ODrycTFY6Jk1IGiZ+tjVJDDSwDt77nK+tfpGP4T50iMtVi4dEGzhQ==",
50
+ "cpu": [
51
+ "arm64"
52
+ ],
53
+ "optional": true,
54
+ "os": [
55
+ "android"
56
+ ],
57
+ "engines": {
58
+ "node": ">=12"
59
+ }
60
+ },
61
+ "node_modules/@esbuild/android-x64": {
62
+ "version": "0.19.5",
63
+ "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.19.5.tgz",
64
+ "integrity": "sha512-9t+28jHGL7uBdkBjL90QFxe7DVA+KGqWlHCF8ChTKyaKO//VLuoBricQCgwhOjA1/qOczsw843Fy4cbs4H3DVA==",
65
+ "cpu": [
66
+ "x64"
67
+ ],
68
+ "optional": true,
69
+ "os": [
70
+ "android"
71
+ ],
72
+ "engines": {
73
+ "node": ">=12"
74
+ }
75
+ },
76
+ "node_modules/@esbuild/darwin-arm64": {
77
+ "version": "0.19.5",
78
+ "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.19.5.tgz",
79
+ "integrity": "sha512-mvXGcKqqIqyKoxq26qEDPHJuBYUA5KizJncKOAf9eJQez+L9O+KfvNFu6nl7SCZ/gFb2QPaRqqmG0doSWlgkqw==",
80
+ "cpu": [
81
+ "arm64"
82
+ ],
83
+ "optional": true,
84
+ "os": [
85
+ "darwin"
86
+ ],
87
+ "engines": {
88
+ "node": ">=12"
89
+ }
90
+ },
91
+ "node_modules/@esbuild/darwin-x64": {
92
+ "version": "0.19.5",
93
+ "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.19.5.tgz",
94
+ "integrity": "sha512-Ly8cn6fGLNet19s0X4unjcniX24I0RqjPv+kurpXabZYSXGM4Pwpmf85WHJN3lAgB8GSth7s5A0r856S+4DyiA==",
95
+ "cpu": [
96
+ "x64"
97
+ ],
98
+ "optional": true,
99
+ "os": [
100
+ "darwin"
101
+ ],
102
+ "engines": {
103
+ "node": ">=12"
104
+ }
105
+ },
106
+ "node_modules/@esbuild/freebsd-arm64": {
107
+ "version": "0.19.5",
108
+ "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.19.5.tgz",
109
+ "integrity": "sha512-GGDNnPWTmWE+DMchq1W8Sd0mUkL+APvJg3b11klSGUDvRXh70JqLAO56tubmq1s2cgpVCSKYywEiKBfju8JztQ==",
110
+ "cpu": [
111
+ "arm64"
112
+ ],
113
+ "optional": true,
114
+ "os": [
115
+ "freebsd"
116
+ ],
117
+ "engines": {
118
+ "node": ">=12"
119
+ }
120
+ },
121
+ "node_modules/@esbuild/freebsd-x64": {
122
+ "version": "0.19.5",
123
+ "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.19.5.tgz",
124
+ "integrity": "sha512-1CCwDHnSSoA0HNwdfoNY0jLfJpd7ygaLAp5EHFos3VWJCRX9DMwWODf96s9TSse39Br7oOTLryRVmBoFwXbuuQ==",
125
+ "cpu": [
126
+ "x64"
127
+ ],
128
+ "optional": true,
129
+ "os": [
130
+ "freebsd"
131
+ ],
132
+ "engines": {
133
+ "node": ">=12"
134
+ }
135
+ },
136
+ "node_modules/@esbuild/linux-arm": {
137
+ "version": "0.19.5",
138
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.19.5.tgz",
139
+ "integrity": "sha512-lrWXLY/vJBzCPC51QN0HM71uWgIEpGSjSZZADQhq7DKhPcI6NH1IdzjfHkDQws2oNpJKpR13kv7/pFHBbDQDwQ==",
140
+ "cpu": [
141
+ "arm"
142
+ ],
143
+ "optional": true,
144
+ "os": [
145
+ "linux"
146
+ ],
147
+ "engines": {
148
+ "node": ">=12"
149
+ }
150
+ },
151
+ "node_modules/@esbuild/linux-arm64": {
152
+ "version": "0.19.5",
153
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.19.5.tgz",
154
+ "integrity": "sha512-o3vYippBmSrjjQUCEEiTZ2l+4yC0pVJD/Dl57WfPwwlvFkrxoSO7rmBZFii6kQB3Wrn/6GwJUPLU5t52eq2meA==",
155
+ "cpu": [
156
+ "arm64"
157
+ ],
158
+ "optional": true,
159
+ "os": [
160
+ "linux"
161
+ ],
162
+ "engines": {
163
+ "node": ">=12"
164
+ }
165
+ },
166
+ "node_modules/@esbuild/linux-ia32": {
167
+ "version": "0.19.5",
168
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.19.5.tgz",
169
+ "integrity": "sha512-MkjHXS03AXAkNp1KKkhSKPOCYztRtK+KXDNkBa6P78F8Bw0ynknCSClO/ztGszILZtyO/lVKpa7MolbBZ6oJtQ==",
170
+ "cpu": [
171
+ "ia32"
172
+ ],
173
+ "optional": true,
174
+ "os": [
175
+ "linux"
176
+ ],
177
+ "engines": {
178
+ "node": ">=12"
179
+ }
180
+ },
181
+ "node_modules/@esbuild/linux-loong64": {
182
+ "version": "0.19.5",
183
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.19.5.tgz",
184
+ "integrity": "sha512-42GwZMm5oYOD/JHqHska3Jg0r+XFb/fdZRX+WjADm3nLWLcIsN27YKtqxzQmGNJgu0AyXg4HtcSK9HuOk3v1Dw==",
185
+ "cpu": [
186
+ "loong64"
187
+ ],
188
+ "optional": true,
189
+ "os": [
190
+ "linux"
191
+ ],
192
+ "engines": {
193
+ "node": ">=12"
194
+ }
195
+ },
196
+ "node_modules/@esbuild/linux-mips64el": {
197
+ "version": "0.19.5",
198
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.19.5.tgz",
199
+ "integrity": "sha512-kcjndCSMitUuPJobWCnwQ9lLjiLZUR3QLQmlgaBfMX23UEa7ZOrtufnRds+6WZtIS9HdTXqND4yH8NLoVVIkcg==",
200
+ "cpu": [
201
+ "mips64el"
202
+ ],
203
+ "optional": true,
204
+ "os": [
205
+ "linux"
206
+ ],
207
+ "engines": {
208
+ "node": ">=12"
209
+ }
210
+ },
211
+ "node_modules/@esbuild/linux-ppc64": {
212
+ "version": "0.19.5",
213
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.19.5.tgz",
214
+ "integrity": "sha512-yJAxJfHVm0ZbsiljbtFFP1BQKLc8kUF6+17tjQ78QjqjAQDnhULWiTA6u0FCDmYT1oOKS9PzZ2z0aBI+Mcyj7Q==",
215
+ "cpu": [
216
+ "ppc64"
217
+ ],
218
+ "optional": true,
219
+ "os": [
220
+ "linux"
221
+ ],
222
+ "engines": {
223
+ "node": ">=12"
224
+ }
225
+ },
226
+ "node_modules/@esbuild/linux-riscv64": {
227
+ "version": "0.19.5",
228
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.19.5.tgz",
229
+ "integrity": "sha512-5u8cIR/t3gaD6ad3wNt1MNRstAZO+aNyBxu2We8X31bA8XUNyamTVQwLDA1SLoPCUehNCymhBhK3Qim1433Zag==",
230
+ "cpu": [
231
+ "riscv64"
232
+ ],
233
+ "optional": true,
234
+ "os": [
235
+ "linux"
236
+ ],
237
+ "engines": {
238
+ "node": ">=12"
239
+ }
240
+ },
241
+ "node_modules/@esbuild/linux-s390x": {
242
+ "version": "0.19.5",
243
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.19.5.tgz",
244
+ "integrity": "sha512-Z6JrMyEw/EmZBD/OFEFpb+gao9xJ59ATsoTNlj39jVBbXqoZm4Xntu6wVmGPB/OATi1uk/DB+yeDPv2E8PqZGw==",
245
+ "cpu": [
246
+ "s390x"
247
+ ],
248
+ "optional": true,
249
+ "os": [
250
+ "linux"
251
+ ],
252
+ "engines": {
253
+ "node": ">=12"
254
+ }
255
+ },
256
+ "node_modules/@esbuild/linux-x64": {
257
+ "version": "0.19.5",
258
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.19.5.tgz",
259
+ "integrity": "sha512-psagl+2RlK1z8zWZOmVdImisMtrUxvwereIdyJTmtmHahJTKb64pAcqoPlx6CewPdvGvUKe2Jw+0Z/0qhSbG1A==",
260
+ "cpu": [
261
+ "x64"
262
+ ],
263
+ "optional": true,
264
+ "os": [
265
+ "linux"
266
+ ],
267
+ "engines": {
268
+ "node": ">=12"
269
+ }
270
+ },
271
+ "node_modules/@esbuild/netbsd-x64": {
272
+ "version": "0.19.5",
273
+ "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.19.5.tgz",
274
+ "integrity": "sha512-kL2l+xScnAy/E/3119OggX8SrWyBEcqAh8aOY1gr4gPvw76la2GlD4Ymf832UCVbmuWeTf2adkZDK+h0Z/fB4g==",
275
+ "cpu": [
276
+ "x64"
277
+ ],
278
+ "optional": true,
279
+ "os": [
280
+ "netbsd"
281
+ ],
282
+ "engines": {
283
+ "node": ">=12"
284
+ }
285
+ },
286
+ "node_modules/@esbuild/openbsd-x64": {
287
+ "version": "0.19.5",
288
+ "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.19.5.tgz",
289
+ "integrity": "sha512-sPOfhtzFufQfTBgRnE1DIJjzsXukKSvZxloZbkJDG383q0awVAq600pc1nfqBcl0ice/WN9p4qLc39WhBShRTA==",
290
+ "cpu": [
291
+ "x64"
292
+ ],
293
+ "optional": true,
294
+ "os": [
295
+ "openbsd"
296
+ ],
297
+ "engines": {
298
+ "node": ">=12"
299
+ }
300
+ },
301
+ "node_modules/@esbuild/sunos-x64": {
302
+ "version": "0.19.5",
303
+ "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.19.5.tgz",
304
+ "integrity": "sha512-dGZkBXaafuKLpDSjKcB0ax0FL36YXCvJNnztjKV+6CO82tTYVDSH2lifitJ29jxRMoUhgkg9a+VA/B03WK5lcg==",
305
+ "cpu": [
306
+ "x64"
307
+ ],
308
+ "optional": true,
309
+ "os": [
310
+ "sunos"
311
+ ],
312
+ "engines": {
313
+ "node": ">=12"
314
+ }
315
+ },
316
+ "node_modules/@esbuild/win32-arm64": {
317
+ "version": "0.19.5",
318
+ "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.19.5.tgz",
319
+ "integrity": "sha512-dWVjD9y03ilhdRQ6Xig1NWNgfLtf2o/STKTS+eZuF90fI2BhbwD6WlaiCGKptlqXlURVB5AUOxUj09LuwKGDTg==",
320
+ "cpu": [
321
+ "arm64"
322
+ ],
323
+ "optional": true,
324
+ "os": [
325
+ "win32"
326
+ ],
327
+ "engines": {
328
+ "node": ">=12"
329
+ }
330
+ },
331
+ "node_modules/@esbuild/win32-ia32": {
332
+ "version": "0.19.5",
333
+ "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.19.5.tgz",
334
+ "integrity": "sha512-4liggWIA4oDgUxqpZwrDhmEfAH4d0iljanDOK7AnVU89T6CzHon/ony8C5LeOdfgx60x5cnQJFZwEydVlYx4iw==",
335
+ "cpu": [
336
+ "ia32"
337
+ ],
338
+ "optional": true,
339
+ "os": [
340
+ "win32"
341
+ ],
342
+ "engines": {
343
+ "node": ">=12"
344
+ }
345
+ },
346
+ "node_modules/@esbuild/win32-x64": {
347
+ "version": "0.19.5",
348
+ "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.19.5.tgz",
349
+ "integrity": "sha512-czTrygUsB/jlM8qEW5MD8bgYU2Xg14lo6kBDXW6HdxKjh8M5PzETGiSHaz9MtbXBYDloHNUAUW2tMiKW4KM9Mw==",
350
+ "cpu": [
351
+ "x64"
352
+ ],
353
+ "optional": true,
354
+ "os": [
355
+ "win32"
356
+ ],
357
+ "engines": {
358
+ "node": ">=12"
359
+ }
360
+ },
361
+ "node_modules/@formatjs/ecma402-abstract": {
362
+ "version": "1.11.4",
363
+ "resolved": "https://registry.npmjs.org/@formatjs/ecma402-abstract/-/ecma402-abstract-1.11.4.tgz",
364
+ "integrity": "sha512-EBikYFp2JCdIfGEb5G9dyCkTGDmC57KSHhRQOC3aYxoPWVZvfWCDjZwkGYHN7Lis/fmuWl906bnNTJifDQ3sXw==",
365
+ "dependencies": {
366
+ "@formatjs/intl-localematcher": "0.2.25",
367
+ "tslib": "^2.1.0"
368
+ }
369
+ },
370
+ "node_modules/@formatjs/fast-memoize": {
371
+ "version": "1.2.1",
372
+ "resolved": "https://registry.npmjs.org/@formatjs/fast-memoize/-/fast-memoize-1.2.1.tgz",
373
+ "integrity": "sha512-Rg0e76nomkz3vF9IPlKeV+Qynok0r7YZjL6syLz4/urSg0IbjPZCB/iYUMNsYA643gh4mgrX3T7KEIFIxJBQeg==",
374
+ "dependencies": {
375
+ "tslib": "^2.1.0"
376
+ }
377
+ },
378
+ "node_modules/@formatjs/icu-messageformat-parser": {
379
+ "version": "2.1.0",
380
+ "resolved": "https://registry.npmjs.org/@formatjs/icu-messageformat-parser/-/icu-messageformat-parser-2.1.0.tgz",
381
+ "integrity": "sha512-Qxv/lmCN6hKpBSss2uQ8IROVnta2r9jd3ymUEIjm2UyIkUCHVcbUVRGL/KS/wv7876edvsPe+hjHVJ4z8YuVaw==",
382
+ "dependencies": {
383
+ "@formatjs/ecma402-abstract": "1.11.4",
384
+ "@formatjs/icu-skeleton-parser": "1.3.6",
385
+ "tslib": "^2.1.0"
386
+ }
387
+ },
388
+ "node_modules/@formatjs/icu-skeleton-parser": {
389
+ "version": "1.3.6",
390
+ "resolved": "https://registry.npmjs.org/@formatjs/icu-skeleton-parser/-/icu-skeleton-parser-1.3.6.tgz",
391
+ "integrity": "sha512-I96mOxvml/YLrwU2Txnd4klA7V8fRhb6JG/4hm3VMNmeJo1F03IpV2L3wWt7EweqNLES59SZ4d6hVOPCSf80Bg==",
392
+ "dependencies": {
393
+ "@formatjs/ecma402-abstract": "1.11.4",
394
+ "tslib": "^2.1.0"
395
+ }
396
+ },
397
+ "node_modules/@formatjs/intl-localematcher": {
398
+ "version": "0.2.25",
399
+ "resolved": "https://registry.npmjs.org/@formatjs/intl-localematcher/-/intl-localematcher-0.2.25.tgz",
400
+ "integrity": "sha512-YmLcX70BxoSopLFdLr1Ds99NdlTI2oWoLbaUW2M406lxOIPzE1KQhRz2fPUkq34xVZQaihCoU29h0KK7An3bhA==",
401
+ "dependencies": {
402
+ "tslib": "^2.1.0"
403
+ }
404
+ },
405
+ "node_modules/@gradio/atoms": {
406
+ "version": "0.2.1",
407
+ "resolved": "https://registry.npmjs.org/@gradio/atoms/-/atoms-0.2.1.tgz",
408
+ "integrity": "sha512-di3kKSbjxKGngvTAaqUaA6whOVs5BFlQULlWDPq1m37VRgUD7Oq2MkIE+T+YiNAhByN93pqA0hGrWwAUUuxy5Q==",
409
+ "dependencies": {
410
+ "@gradio/icons": "^0.2.0",
411
+ "@gradio/utils": "^0.2.0"
412
+ }
413
+ },
414
+ "node_modules/@gradio/column": {
415
+ "version": "0.1.0",
416
+ "resolved": "https://registry.npmjs.org/@gradio/column/-/column-0.1.0.tgz",
417
+ "integrity": "sha512-P24nqqVnMXBaDA1f/zSN5HZRho4PxP8Dq+7VltPHlmxIEiZYik2AJ4J0LeuIha34FDO0guu/16evdrpvGIUAfw=="
418
+ },
419
+ "node_modules/@gradio/icons": {
420
+ "version": "0.2.0",
421
+ "resolved": "https://registry.npmjs.org/@gradio/icons/-/icons-0.2.0.tgz",
422
+ "integrity": "sha512-rfCSmOF+ALqBOjTWL1ICasyA8JuO0MPwFrtlVMyAWp7R14AN8YChC/gbz5fZ0kNBiGGEYOOfqpKxyvC95jGGlg=="
423
+ },
424
+ "node_modules/@gradio/statustracker": {
425
+ "version": "0.3.1",
426
+ "resolved": "https://registry.npmjs.org/@gradio/statustracker/-/statustracker-0.3.1.tgz",
427
+ "integrity": "sha512-ZpmXZSnbgoFU2J54SrNntwfo2OEuEoRV310Q0zGVTH1VL7loziR7GuYhfIbgS8qFlrWM0MhMoLGDX+k7LAig5w==",
428
+ "dependencies": {
429
+ "@gradio/atoms": "^0.2.1",
430
+ "@gradio/column": "^0.1.0",
431
+ "@gradio/icons": "^0.2.0",
432
+ "@gradio/utils": "^0.2.0"
433
+ }
434
+ },
435
+ "node_modules/@gradio/theme": {
436
+ "version": "0.2.0",
437
+ "resolved": "https://registry.npmjs.org/@gradio/theme/-/theme-0.2.0.tgz",
438
+ "integrity": "sha512-33c68Nk7oRXLn08OxPfjcPm7S4tXGOUV1I1bVgzdM2YV5o1QBOS1GEnXPZPu/CEYPePLMB6bsDwffrLEyLGWVQ=="
439
+ },
440
+ "node_modules/@gradio/utils": {
441
+ "version": "0.2.0",
442
+ "resolved": "https://registry.npmjs.org/@gradio/utils/-/utils-0.2.0.tgz",
443
+ "integrity": "sha512-YkwzXufi6IxQrlMW+1sFo8Yn6F9NLL69ZoBsbo7QEhms0v5L7pmOTw+dfd7M3dwbRP2lgjrb52i1kAIN3n6aqQ==",
444
+ "dependencies": {
445
+ "@gradio/theme": "^0.2.0",
446
+ "svelte-i18n": "^3.6.0"
447
+ }
448
+ },
449
+ "node_modules/@jridgewell/gen-mapping": {
450
+ "version": "0.3.3",
451
+ "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.3.tgz",
452
+ "integrity": "sha512-HLhSWOLRi875zjjMG/r+Nv0oCW8umGb0BgEhyX3dDX3egwZtB8PqLnjz3yedt8R5StBrzcg4aBpnh8UA9D1BoQ==",
453
+ "peer": true,
454
+ "dependencies": {
455
+ "@jridgewell/set-array": "^1.0.1",
456
+ "@jridgewell/sourcemap-codec": "^1.4.10",
457
+ "@jridgewell/trace-mapping": "^0.3.9"
458
+ },
459
+ "engines": {
460
+ "node": ">=6.0.0"
461
+ }
462
+ },
463
+ "node_modules/@jridgewell/resolve-uri": {
464
+ "version": "3.1.1",
465
+ "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.1.tgz",
466
+ "integrity": "sha512-dSYZh7HhCDtCKm4QakX0xFpsRDqjjtZf/kjI/v3T3Nwt5r8/qz/M19F9ySyOqU94SXBmeG9ttTul+YnR4LOxFA==",
467
+ "peer": true,
468
+ "engines": {
469
+ "node": ">=6.0.0"
470
+ }
471
+ },
472
+ "node_modules/@jridgewell/set-array": {
473
+ "version": "1.1.2",
474
+ "resolved": "https://registry.npmjs.org/@jridgewell/set-array/-/set-array-1.1.2.tgz",
475
+ "integrity": "sha512-xnkseuNADM0gt2bs+BvhO0p78Mk762YnZdsuzFV018NoG1Sj1SCQvpSqa7XUaTam5vAGasABV9qXASMKnFMwMw==",
476
+ "peer": true,
477
+ "engines": {
478
+ "node": ">=6.0.0"
479
+ }
480
+ },
481
+ "node_modules/@jridgewell/sourcemap-codec": {
482
+ "version": "1.4.15",
483
+ "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.15.tgz",
484
+ "integrity": "sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg==",
485
+ "peer": true
486
+ },
487
+ "node_modules/@jridgewell/trace-mapping": {
488
+ "version": "0.3.20",
489
+ "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.20.tgz",
490
+ "integrity": "sha512-R8LcPeWZol2zR8mmH3JeKQ6QRCFb7XgUhV9ZlGhHLGyg4wpPiPZNQOOWhFZhxKw8u//yTbNGI42Bx/3paXEQ+Q==",
491
+ "peer": true,
492
+ "dependencies": {
493
+ "@jridgewell/resolve-uri": "^3.1.0",
494
+ "@jridgewell/sourcemap-codec": "^1.4.14"
495
+ }
496
+ },
497
+ "node_modules/@types/estree": {
498
+ "version": "1.0.5",
499
+ "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.5.tgz",
500
+ "integrity": "sha512-/kYRxGDLWzHOB7q+wtSUQlFrtcdUccpfy+X+9iMBpHK8QLLhx2wIPYuS5DYtR9Wa/YlZAbIovy7qVdB1Aq6Lyw==",
501
+ "peer": true
502
+ },
503
+ "node_modules/acorn": {
504
+ "version": "8.11.2",
505
+ "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.11.2.tgz",
506
+ "integrity": "sha512-nc0Axzp/0FILLEVsm4fNwLCwMttvhEI263QtVPQcbpfZZ3ts0hLsZGOpE6czNlid7CJ9MlyH8reXkpsf3YUY4w==",
507
+ "peer": true,
508
+ "bin": {
509
+ "acorn": "bin/acorn"
510
+ },
511
+ "engines": {
512
+ "node": ">=0.4.0"
513
+ }
514
+ },
515
+ "node_modules/aria-query": {
516
+ "version": "5.3.0",
517
+ "resolved": "https://registry.npmjs.org/aria-query/-/aria-query-5.3.0.tgz",
518
+ "integrity": "sha512-b0P0sZPKtyu8HkeRAfCq0IfURZK+SuwMjY1UXGBU27wpAiTwQAIlq56IbIO+ytk/JjS1fMR14ee5WBBfKi5J6A==",
519
+ "peer": true,
520
+ "dependencies": {
521
+ "dequal": "^2.0.3"
522
+ }
523
+ },
524
+ "node_modules/axobject-query": {
525
+ "version": "3.2.1",
526
+ "resolved": "https://registry.npmjs.org/axobject-query/-/axobject-query-3.2.1.tgz",
527
+ "integrity": "sha512-jsyHu61e6N4Vbz/v18DHwWYKK0bSWLqn47eeDSKPB7m8tqMHF9YJ+mhIk2lVteyZrY8tnSj/jHOv4YiTCuCJgg==",
528
+ "peer": true,
529
+ "dependencies": {
530
+ "dequal": "^2.0.3"
531
+ }
532
+ },
533
+ "node_modules/cli-color": {
534
+ "version": "2.0.3",
535
+ "resolved": "https://registry.npmjs.org/cli-color/-/cli-color-2.0.3.tgz",
536
+ "integrity": "sha512-OkoZnxyC4ERN3zLzZaY9Emb7f/MhBOIpePv0Ycok0fJYT+Ouo00UBEIwsVsr0yoow++n5YWlSUgST9GKhNHiRQ==",
537
+ "dependencies": {
538
+ "d": "^1.0.1",
539
+ "es5-ext": "^0.10.61",
540
+ "es6-iterator": "^2.0.3",
541
+ "memoizee": "^0.4.15",
542
+ "timers-ext": "^0.1.7"
543
+ },
544
+ "engines": {
545
+ "node": ">=0.10"
546
+ }
547
+ },
548
+ "node_modules/code-red": {
549
+ "version": "1.0.4",
550
+ "resolved": "https://registry.npmjs.org/code-red/-/code-red-1.0.4.tgz",
551
+ "integrity": "sha512-7qJWqItLA8/VPVlKJlFXU+NBlo/qyfs39aJcuMT/2ere32ZqvF5OSxgdM5xOfJJ7O429gg2HM47y8v9P+9wrNw==",
552
+ "peer": true,
553
+ "dependencies": {
554
+ "@jridgewell/sourcemap-codec": "^1.4.15",
555
+ "@types/estree": "^1.0.1",
556
+ "acorn": "^8.10.0",
557
+ "estree-walker": "^3.0.3",
558
+ "periscopic": "^3.1.0"
559
+ }
560
+ },
561
+ "node_modules/css-tree": {
562
+ "version": "2.3.1",
563
+ "resolved": "https://registry.npmjs.org/css-tree/-/css-tree-2.3.1.tgz",
564
+ "integrity": "sha512-6Fv1DV/TYw//QF5IzQdqsNDjx/wc8TrMBZsqjL9eW01tWb7R7k/mq+/VXfJCl7SoD5emsJop9cOByJZfs8hYIw==",
565
+ "peer": true,
566
+ "dependencies": {
567
+ "mdn-data": "2.0.30",
568
+ "source-map-js": "^1.0.1"
569
+ },
570
+ "engines": {
571
+ "node": "^10 || ^12.20.0 || ^14.13.0 || >=15.0.0"
572
+ }
573
+ },
574
+ "node_modules/d": {
575
+ "version": "1.0.1",
576
+ "resolved": "https://registry.npmjs.org/d/-/d-1.0.1.tgz",
577
+ "integrity": "sha512-m62ShEObQ39CfralilEQRjH6oAMtNCV1xJyEx5LpRYUVN+EviphDgUc/F3hnYbADmkiNs67Y+3ylmlG7Lnu+FA==",
578
+ "dependencies": {
579
+ "es5-ext": "^0.10.50",
580
+ "type": "^1.0.1"
581
+ }
582
+ },
583
+ "node_modules/deepmerge": {
584
+ "version": "4.3.1",
585
+ "resolved": "https://registry.npmjs.org/deepmerge/-/deepmerge-4.3.1.tgz",
586
+ "integrity": "sha512-3sUqbMEc77XqpdNO7FRyRog+eW3ph+GYCbj+rK+uYyRMuwsVy0rMiVtPn+QJlKFvWP/1PYpapqYn0Me2knFn+A==",
587
+ "engines": {
588
+ "node": ">=0.10.0"
589
+ }
590
+ },
591
+ "node_modules/dequal": {
592
+ "version": "2.0.3",
593
+ "resolved": "https://registry.npmjs.org/dequal/-/dequal-2.0.3.tgz",
594
+ "integrity": "sha512-0je+qPKHEMohvfRTCEo3CrPG6cAzAYgmzKyxRiYSSDkS6eGJdyVJm7WaYA5ECaAD9wLB2T4EEeymA5aFVcYXCA==",
595
+ "peer": true,
596
+ "engines": {
597
+ "node": ">=6"
598
+ }
599
+ },
600
+ "node_modules/es5-ext": {
601
+ "version": "0.10.62",
602
+ "resolved": "https://registry.npmjs.org/es5-ext/-/es5-ext-0.10.62.tgz",
603
+ "integrity": "sha512-BHLqn0klhEpnOKSrzn/Xsz2UIW8j+cGmo9JLzr8BiUapV8hPL9+FliFqjwr9ngW7jWdnxv6eO+/LqyhJVqgrjA==",
604
+ "hasInstallScript": true,
605
+ "dependencies": {
606
+ "es6-iterator": "^2.0.3",
607
+ "es6-symbol": "^3.1.3",
608
+ "next-tick": "^1.1.0"
609
+ },
610
+ "engines": {
611
+ "node": ">=0.10"
612
+ }
613
+ },
614
+ "node_modules/es6-iterator": {
615
+ "version": "2.0.3",
616
+ "resolved": "https://registry.npmjs.org/es6-iterator/-/es6-iterator-2.0.3.tgz",
617
+ "integrity": "sha512-zw4SRzoUkd+cl+ZoE15A9o1oQd920Bb0iOJMQkQhl3jNc03YqVjAhG7scf9C5KWRU/R13Orf588uCC6525o02g==",
618
+ "dependencies": {
619
+ "d": "1",
620
+ "es5-ext": "^0.10.35",
621
+ "es6-symbol": "^3.1.1"
622
+ }
623
+ },
624
+ "node_modules/es6-symbol": {
625
+ "version": "3.1.3",
626
+ "resolved": "https://registry.npmjs.org/es6-symbol/-/es6-symbol-3.1.3.tgz",
627
+ "integrity": "sha512-NJ6Yn3FuDinBaBRWl/q5X/s4koRHBrgKAu+yGI6JCBeiu3qrcbJhwT2GeR/EXVfylRk8dpQVJoLEFhK+Mu31NA==",
628
+ "dependencies": {
629
+ "d": "^1.0.1",
630
+ "ext": "^1.1.2"
631
+ }
632
+ },
633
+ "node_modules/es6-weak-map": {
634
+ "version": "2.0.3",
635
+ "resolved": "https://registry.npmjs.org/es6-weak-map/-/es6-weak-map-2.0.3.tgz",
636
+ "integrity": "sha512-p5um32HOTO1kP+w7PRnB+5lQ43Z6muuMuIMffvDN8ZB4GcnjLBV6zGStpbASIMk4DCAvEaamhe2zhyCb/QXXsA==",
637
+ "dependencies": {
638
+ "d": "1",
639
+ "es5-ext": "^0.10.46",
640
+ "es6-iterator": "^2.0.3",
641
+ "es6-symbol": "^3.1.1"
642
+ }
643
+ },
644
+ "node_modules/esbuild": {
645
+ "version": "0.19.5",
646
+ "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.19.5.tgz",
647
+ "integrity": "sha512-bUxalY7b1g8vNhQKdB24QDmHeY4V4tw/s6Ak5z+jJX9laP5MoQseTOMemAr0gxssjNcH0MCViG8ONI2kksvfFQ==",
648
+ "hasInstallScript": true,
649
+ "bin": {
650
+ "esbuild": "bin/esbuild"
651
+ },
652
+ "engines": {
653
+ "node": ">=12"
654
+ },
655
+ "optionalDependencies": {
656
+ "@esbuild/android-arm": "0.19.5",
657
+ "@esbuild/android-arm64": "0.19.5",
658
+ "@esbuild/android-x64": "0.19.5",
659
+ "@esbuild/darwin-arm64": "0.19.5",
660
+ "@esbuild/darwin-x64": "0.19.5",
661
+ "@esbuild/freebsd-arm64": "0.19.5",
662
+ "@esbuild/freebsd-x64": "0.19.5",
663
+ "@esbuild/linux-arm": "0.19.5",
664
+ "@esbuild/linux-arm64": "0.19.5",
665
+ "@esbuild/linux-ia32": "0.19.5",
666
+ "@esbuild/linux-loong64": "0.19.5",
667
+ "@esbuild/linux-mips64el": "0.19.5",
668
+ "@esbuild/linux-ppc64": "0.19.5",
669
+ "@esbuild/linux-riscv64": "0.19.5",
670
+ "@esbuild/linux-s390x": "0.19.5",
671
+ "@esbuild/linux-x64": "0.19.5",
672
+ "@esbuild/netbsd-x64": "0.19.5",
673
+ "@esbuild/openbsd-x64": "0.19.5",
674
+ "@esbuild/sunos-x64": "0.19.5",
675
+ "@esbuild/win32-arm64": "0.19.5",
676
+ "@esbuild/win32-ia32": "0.19.5",
677
+ "@esbuild/win32-x64": "0.19.5"
678
+ }
679
+ },
680
+ "node_modules/estree-walker": {
681
+ "version": "3.0.3",
682
+ "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-3.0.3.tgz",
683
+ "integrity": "sha512-7RUKfXgSMMkzt6ZuXmqapOurLGPPfgj6l9uRZ7lRGolvk0y2yocc35LdcxKC5PQZdn2DMqioAQ2NoWcrTKmm6g==",
684
+ "peer": true,
685
+ "dependencies": {
686
+ "@types/estree": "^1.0.0"
687
+ }
688
+ },
689
+ "node_modules/event-emitter": {
690
+ "version": "0.3.5",
691
+ "resolved": "https://registry.npmjs.org/event-emitter/-/event-emitter-0.3.5.tgz",
692
+ "integrity": "sha512-D9rRn9y7kLPnJ+hMq7S/nhvoKwwvVJahBi2BPmx3bvbsEdK3W9ii8cBSGjP+72/LnM4n6fo3+dkCX5FeTQruXA==",
693
+ "dependencies": {
694
+ "d": "1",
695
+ "es5-ext": "~0.10.14"
696
+ }
697
+ },
698
+ "node_modules/ext": {
699
+ "version": "1.7.0",
700
+ "resolved": "https://registry.npmjs.org/ext/-/ext-1.7.0.tgz",
701
+ "integrity": "sha512-6hxeJYaL110a9b5TEJSj0gojyHQAmA2ch5Os+ySCiA1QGdS697XWY1pzsrSjqA9LDEEgdB/KypIlR59RcLuHYw==",
702
+ "dependencies": {
703
+ "type": "^2.7.2"
704
+ }
705
+ },
706
+ "node_modules/ext/node_modules/type": {
707
+ "version": "2.7.2",
708
+ "resolved": "https://registry.npmjs.org/type/-/type-2.7.2.tgz",
709
+ "integrity": "sha512-dzlvlNlt6AXU7EBSfpAscydQ7gXB+pPGsPnfJnZpiNJBDj7IaJzQlBZYGdEi4R9HmPdBv2XmWJ6YUtoTa7lmCw=="
710
+ },
711
+ "node_modules/globalyzer": {
712
+ "version": "0.1.0",
713
+ "resolved": "https://registry.npmjs.org/globalyzer/-/globalyzer-0.1.0.tgz",
714
+ "integrity": "sha512-40oNTM9UfG6aBmuKxk/giHn5nQ8RVz/SS4Ir6zgzOv9/qC3kKZ9v4etGTcJbEl/NyVQH7FGU7d+X1egr57Md2Q=="
715
+ },
716
+ "node_modules/globrex": {
717
+ "version": "0.1.2",
718
+ "resolved": "https://registry.npmjs.org/globrex/-/globrex-0.1.2.tgz",
719
+ "integrity": "sha512-uHJgbwAMwNFf5mLst7IWLNg14x1CkeqglJb/K3doi4dw6q2IvAAmM/Y81kevy83wP+Sst+nutFTYOGg3d1lsxg=="
720
+ },
721
+ "node_modules/intl-messageformat": {
722
+ "version": "9.13.0",
723
+ "resolved": "https://registry.npmjs.org/intl-messageformat/-/intl-messageformat-9.13.0.tgz",
724
+ "integrity": "sha512-7sGC7QnSQGa5LZP7bXLDhVDtQOeKGeBFGHF2Y8LVBwYZoQZCgWeKoPGTa5GMG8g/TzDgeXuYJQis7Ggiw2xTOw==",
725
+ "dependencies": {
726
+ "@formatjs/ecma402-abstract": "1.11.4",
727
+ "@formatjs/fast-memoize": "1.2.1",
728
+ "@formatjs/icu-messageformat-parser": "2.1.0",
729
+ "tslib": "^2.1.0"
730
+ }
731
+ },
732
+ "node_modules/is-promise": {
733
+ "version": "2.2.2",
734
+ "resolved": "https://registry.npmjs.org/is-promise/-/is-promise-2.2.2.tgz",
735
+ "integrity": "sha512-+lP4/6lKUBfQjZ2pdxThZvLUAafmZb8OAxFb8XXtiQmS35INgr85hdOGoEs124ez1FCnZJt6jau/T+alh58QFQ=="
736
+ },
737
+ "node_modules/is-reference": {
738
+ "version": "3.0.2",
739
+ "resolved": "https://registry.npmjs.org/is-reference/-/is-reference-3.0.2.tgz",
740
+ "integrity": "sha512-v3rht/LgVcsdZa3O2Nqs+NMowLOxeOm7Ay9+/ARQ2F+qEoANRcqrjAZKGN0v8ymUetZGgkp26LTnGT7H0Qo9Pg==",
741
+ "peer": true,
742
+ "dependencies": {
743
+ "@types/estree": "*"
744
+ }
745
+ },
746
+ "node_modules/locate-character": {
747
+ "version": "3.0.0",
748
+ "resolved": "https://registry.npmjs.org/locate-character/-/locate-character-3.0.0.tgz",
749
+ "integrity": "sha512-SW13ws7BjaeJ6p7Q6CO2nchbYEc3X3J6WrmTTDto7yMPqVSZTUyY5Tjbid+Ab8gLnATtygYtiDIJGQRRn2ZOiA==",
750
+ "peer": true
751
+ },
752
+ "node_modules/lru-queue": {
753
+ "version": "0.1.0",
754
+ "resolved": "https://registry.npmjs.org/lru-queue/-/lru-queue-0.1.0.tgz",
755
+ "integrity": "sha512-BpdYkt9EvGl8OfWHDQPISVpcl5xZthb+XPsbELj5AQXxIC8IriDZIQYjBJPEm5rS420sjZ0TLEzRcq5KdBhYrQ==",
756
+ "dependencies": {
757
+ "es5-ext": "~0.10.2"
758
+ }
759
+ },
760
+ "node_modules/magic-string": {
761
+ "version": "0.30.5",
762
+ "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.30.5.tgz",
763
+ "integrity": "sha512-7xlpfBaQaP/T6Vh8MO/EqXSW5En6INHEvEXQiuff7Gku0PWjU3uf6w/j9o7O+SpB5fOAkrI5HeoNgwjEO0pFsA==",
764
+ "peer": true,
765
+ "dependencies": {
766
+ "@jridgewell/sourcemap-codec": "^1.4.15"
767
+ },
768
+ "engines": {
769
+ "node": ">=12"
770
+ }
771
+ },
772
+ "node_modules/mdn-data": {
773
+ "version": "2.0.30",
774
+ "resolved": "https://registry.npmjs.org/mdn-data/-/mdn-data-2.0.30.tgz",
775
+ "integrity": "sha512-GaqWWShW4kv/G9IEucWScBx9G1/vsFZZJUO+tD26M8J8z3Kw5RDQjaoZe03YAClgeS/SWPOcb4nkFBTEi5DUEA==",
776
+ "peer": true
777
+ },
778
+ "node_modules/memoizee": {
779
+ "version": "0.4.15",
780
+ "resolved": "https://registry.npmjs.org/memoizee/-/memoizee-0.4.15.tgz",
781
+ "integrity": "sha512-UBWmJpLZd5STPm7PMUlOw/TSy972M+z8gcyQ5veOnSDRREz/0bmpyTfKt3/51DhEBqCZQn1udM/5flcSPYhkdQ==",
782
+ "dependencies": {
783
+ "d": "^1.0.1",
784
+ "es5-ext": "^0.10.53",
785
+ "es6-weak-map": "^2.0.3",
786
+ "event-emitter": "^0.3.5",
787
+ "is-promise": "^2.2.2",
788
+ "lru-queue": "^0.1.0",
789
+ "next-tick": "^1.1.0",
790
+ "timers-ext": "^0.1.7"
791
+ }
792
+ },
793
+ "node_modules/mri": {
794
+ "version": "1.2.0",
795
+ "resolved": "https://registry.npmjs.org/mri/-/mri-1.2.0.tgz",
796
+ "integrity": "sha512-tzzskb3bG8LvYGFF/mDTpq3jpI6Q9wc3LEmBaghu+DdCssd1FakN7Bc0hVNmEyGq1bq3RgfkCb3cmQLpNPOroA==",
797
+ "engines": {
798
+ "node": ">=4"
799
+ }
800
+ },
801
+ "node_modules/next-tick": {
802
+ "version": "1.1.0",
803
+ "resolved": "https://registry.npmjs.org/next-tick/-/next-tick-1.1.0.tgz",
804
+ "integrity": "sha512-CXdUiJembsNjuToQvxayPZF9Vqht7hewsvy2sOWafLvi2awflj9mOC6bHIg50orX8IJvWKY9wYQ/zB2kogPslQ=="
805
+ },
806
+ "node_modules/periscopic": {
807
+ "version": "3.1.0",
808
+ "resolved": "https://registry.npmjs.org/periscopic/-/periscopic-3.1.0.tgz",
809
+ "integrity": "sha512-vKiQ8RRtkl9P+r/+oefh25C3fhybptkHKCZSPlcXiJux2tJF55GnEj3BVn4A5gKfq9NWWXXrxkHBwVPUfH0opw==",
810
+ "peer": true,
811
+ "dependencies": {
812
+ "@types/estree": "^1.0.0",
813
+ "estree-walker": "^3.0.0",
814
+ "is-reference": "^3.0.0"
815
+ }
816
+ },
817
+ "node_modules/sade": {
818
+ "version": "1.8.1",
819
+ "resolved": "https://registry.npmjs.org/sade/-/sade-1.8.1.tgz",
820
+ "integrity": "sha512-xal3CZX1Xlo/k4ApwCFrHVACi9fBqJ7V+mwhBsuf/1IOKbBy098Fex+Wa/5QMubw09pSZ/u8EY8PWgevJsXp1A==",
821
+ "dependencies": {
822
+ "mri": "^1.1.0"
823
+ },
824
+ "engines": {
825
+ "node": ">=6"
826
+ }
827
+ },
828
+ "node_modules/source-map-js": {
829
+ "version": "1.0.2",
830
+ "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.0.2.tgz",
831
+ "integrity": "sha512-R0XvVJ9WusLiqTCEiGCmICCMplcCkIwwR11mOSD9CR5u+IXYdiseeEuXCVAjS54zqwkLcPNnmU4OeJ6tUrWhDw==",
832
+ "peer": true,
833
+ "engines": {
834
+ "node": ">=0.10.0"
835
+ }
836
+ },
837
+ "node_modules/svelte": {
838
+ "version": "4.2.3",
839
+ "resolved": "https://registry.npmjs.org/svelte/-/svelte-4.2.3.tgz",
840
+ "integrity": "sha512-sqmG9KC6uUc7fb3ZuWoxXvqk6MI9Uu4ABA1M0fYDgTlFYu1k02xp96u6U9+yJZiVm84m9zge7rrA/BNZdFpOKw==",
841
+ "peer": true,
842
+ "dependencies": {
843
+ "@ampproject/remapping": "^2.2.1",
844
+ "@jridgewell/sourcemap-codec": "^1.4.15",
845
+ "@jridgewell/trace-mapping": "^0.3.18",
846
+ "acorn": "^8.9.0",
847
+ "aria-query": "^5.3.0",
848
+ "axobject-query": "^3.2.1",
849
+ "code-red": "^1.0.3",
850
+ "css-tree": "^2.3.1",
851
+ "estree-walker": "^3.0.3",
852
+ "is-reference": "^3.0.1",
853
+ "locate-character": "^3.0.0",
854
+ "magic-string": "^0.30.4",
855
+ "periscopic": "^3.1.0"
856
+ },
857
+ "engines": {
858
+ "node": ">=16"
859
+ }
860
+ },
861
+ "node_modules/svelte-i18n": {
862
+ "version": "3.7.4",
863
+ "resolved": "https://registry.npmjs.org/svelte-i18n/-/svelte-i18n-3.7.4.tgz",
864
+ "integrity": "sha512-yGRCNo+eBT4cPuU7IVsYTYjxB7I2V8qgUZPlHnNctJj5IgbJgV78flsRzpjZ/8iUYZrS49oCt7uxlU3AZv/N5Q==",
865
+ "dependencies": {
866
+ "cli-color": "^2.0.3",
867
+ "deepmerge": "^4.2.2",
868
+ "esbuild": "^0.19.2",
869
+ "estree-walker": "^2",
870
+ "intl-messageformat": "^9.13.0",
871
+ "sade": "^1.8.1",
872
+ "tiny-glob": "^0.2.9"
873
+ },
874
+ "bin": {
875
+ "svelte-i18n": "dist/cli.js"
876
+ },
877
+ "engines": {
878
+ "node": ">= 16"
879
+ },
880
+ "peerDependencies": {
881
+ "svelte": "^3 || ^4"
882
+ }
883
+ },
884
+ "node_modules/svelte-i18n/node_modules/estree-walker": {
885
+ "version": "2.0.2",
886
+ "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-2.0.2.tgz",
887
+ "integrity": "sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w=="
888
+ },
889
+ "node_modules/timers-ext": {
890
+ "version": "0.1.7",
891
+ "resolved": "https://registry.npmjs.org/timers-ext/-/timers-ext-0.1.7.tgz",
892
+ "integrity": "sha512-b85NUNzTSdodShTIbky6ZF02e8STtVVfD+fu4aXXShEELpozH+bCpJLYMPZbsABN2wDH7fJpqIoXxJpzbf0NqQ==",
893
+ "dependencies": {
894
+ "es5-ext": "~0.10.46",
895
+ "next-tick": "1"
896
+ }
897
+ },
898
+ "node_modules/tiny-glob": {
899
+ "version": "0.2.9",
900
+ "resolved": "https://registry.npmjs.org/tiny-glob/-/tiny-glob-0.2.9.tgz",
901
+ "integrity": "sha512-g/55ssRPUjShh+xkfx9UPDXqhckHEsHr4Vd9zX55oSdGZc/MD0m3sferOkwWtp98bv+kcVfEHtRJgBVJzelrzg==",
902
+ "dependencies": {
903
+ "globalyzer": "0.1.0",
904
+ "globrex": "^0.1.2"
905
+ }
906
+ },
907
+ "node_modules/tslib": {
908
+ "version": "2.6.2",
909
+ "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.2.tgz",
910
+ "integrity": "sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q=="
911
+ },
912
+ "node_modules/type": {
913
+ "version": "1.2.0",
914
+ "resolved": "https://registry.npmjs.org/type/-/type-1.2.0.tgz",
915
+ "integrity": "sha512-+5nt5AAniqsCnu2cEQQdpzCAh33kVx8n0VoFidKpB1dVVLAN/F+bgVOqOJqOnEnrhp222clB5p3vUlD+1QAnfg=="
916
+ }
917
+ }
918
+ }
src/frontend/package.json ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "gradio_test3",
3
+ "version": "0.3.1",
4
+ "description": "Gradio UI packages",
5
+ "type": "module",
6
+ "author": "",
7
+ "license": "ISC",
8
+ "private": false,
9
+ "main_changeset": true,
10
+ "exports": {
11
+ ".": "./Index.svelte",
12
+ "./example": "./Example.svelte",
13
+ "./package.json": "./package.json"
14
+ },
15
+ "dependencies": {
16
+ "@gradio/atoms": "0.2.1",
17
+ "@gradio/icons": "0.2.0",
18
+ "@gradio/statustracker": "0.3.1",
19
+ "@gradio/utils": "0.2.0"
20
+ }
21
+ }
src/frontend/shared/Dropdown.svelte ADDED
@@ -0,0 +1,285 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <script lang="ts">
2
+ import DropdownOptions from "./DropdownOptions.svelte";
3
+ import { createEventDispatcher, afterUpdate } from "svelte";
4
+ import { BlockTitle } from "@gradio/atoms";
5
+ import { DropdownArrow } from "@gradio/icons";
6
+ import type { SelectData } from "@gradio/utils";
7
+ import { handle_filter, handle_change, handle_shared_keys } from "./utils";
8
+
9
+ export let label: string;
10
+ export let info: string | undefined = undefined;
11
+ export let value: string | number | (string | number)[] | undefined = [];
12
+ let old_value: string | number | (string | number)[] | undefined = [];
13
+ export let value_is_output = false;
14
+ export let choices: [string, string | number][];
15
+ let old_choices: [string, string | number][];
16
+ export let disabled = false;
17
+ export let show_label: boolean;
18
+ export let container = true;
19
+ export let allow_custom_value = false;
20
+ export let filterable = true;
21
+
22
+ let filter_input: HTMLElement;
23
+
24
+ let show_options = false;
25
+ let choices_names: string[];
26
+ let choices_values: (string | number)[];
27
+ let input_text = "";
28
+ let old_input_text = "";
29
+ let initialized = false;
30
+
31
+ // All of these are indices with respect to the choices array
32
+ let filtered_indices: number[] = [];
33
+ let active_index: number | null = null;
34
+ // selected_index is null if allow_custom_value is true and the input_text is not in choices_names
35
+ let selected_index: number | null = null;
36
+ let old_selected_index: number | null;
37
+
38
+ const dispatch = createEventDispatcher<{
39
+ change: string | undefined;
40
+ input: undefined;
41
+ select: SelectData;
42
+ blur: undefined;
43
+ focus: undefined;
44
+ }>();
45
+
46
+ // Setting the initial value of the dropdown
47
+ if (value) {
48
+ old_selected_index = choices.map((c) => c[1]).indexOf(value as string);
49
+ selected_index = old_selected_index;
50
+ if (selected_index === -1) {
51
+ old_value = value;
52
+ selected_index = null;
53
+ } else {
54
+ [input_text, old_value] = choices[selected_index];
55
+ old_input_text = input_text;
56
+ }
57
+ } else if (choices.length > 0) {
58
+ old_selected_index = 0;
59
+ selected_index = 0;
60
+ [input_text, value] = choices[selected_index];
61
+ old_value = value;
62
+ old_input_text = input_text;
63
+ }
64
+
65
+ $: {
66
+ if (
67
+ selected_index !== old_selected_index &&
68
+ selected_index !== null &&
69
+ initialized
70
+ ) {
71
+ [input_text, value] = choices[selected_index];
72
+ old_selected_index = selected_index;
73
+ dispatch("select", {
74
+ index: selected_index,
75
+ value: choices_values[selected_index],
76
+ selected: true
77
+ });
78
+ }
79
+ }
80
+
81
+ $: {
82
+ if (value != old_value) {
83
+ set_input_text();
84
+ handle_change(dispatch, value, value_is_output);
85
+ old_value = value;
86
+ }
87
+ }
88
+
89
+ $: {
90
+ choices_names = choices.map((c) => c[0]);
91
+ choices_values = choices.map((c) => c[1]);
92
+ }
93
+
94
+ $: {
95
+ if (choices !== old_choices || input_text !== old_input_text) {
96
+ filtered_indices = handle_filter(choices, input_text);
97
+ old_choices = choices;
98
+ old_input_text = input_text;
99
+ if (!allow_custom_value && filtered_indices.length > 0) {
100
+ active_index = filtered_indices[0];
101
+ }
102
+ }
103
+ }
104
+
105
+ function set_input_text(): void {
106
+ if (value === undefined) {
107
+ input_text = "";
108
+ } else if (choices_values.includes(value as string)) {
109
+ input_text = choices_names[choices_values.indexOf(value as string)];
110
+ } else if (allow_custom_value) {
111
+ input_text = value as string;
112
+ } else {
113
+ input_text = "";
114
+ }
115
+ }
116
+
117
+ function handle_option_selected(e: any): void {
118
+ selected_index = parseInt(e.detail.target.dataset.index);
119
+ if (isNaN(selected_index)) {
120
+ // This is the case when the user clicks on the scrollbar
121
+ selected_index = null;
122
+ return;
123
+ }
124
+ show_options = false;
125
+ active_index = null;
126
+ filter_input.blur();
127
+ }
128
+
129
+ function handle_focus(e: FocusEvent): void {
130
+ filtered_indices = choices.map((_, i) => i);
131
+ show_options = true;
132
+ dispatch("focus");
133
+ }
134
+
135
+ function handle_blur(): void {
136
+ if (!allow_custom_value) {
137
+ input_text = choices_names[choices_values.indexOf(value as string)];
138
+ }
139
+ value = input_text;
140
+ show_options = false;
141
+ active_index = null;
142
+ dispatch("blur");
143
+ }
144
+
145
+ function handle_key_down(e: KeyboardEvent): void {
146
+ [show_options, active_index] = handle_shared_keys(
147
+ e,
148
+ active_index,
149
+ filtered_indices
150
+ );
151
+ if (e.key === "Enter") {
152
+ if (active_index !== null) {
153
+ selected_index = active_index;
154
+ show_options = false;
155
+ filter_input.blur();
156
+ active_index = null;
157
+ } else if (choices_names.includes(input_text)) {
158
+ selected_index = choices_names.indexOf(input_text);
159
+ show_options = false;
160
+ active_index = null;
161
+ filter_input.blur();
162
+ } else if (allow_custom_value) {
163
+ value = input_text;
164
+ selected_index = null;
165
+ show_options = false;
166
+ active_index = null;
167
+ filter_input.blur();
168
+ }
169
+ }
170
+ }
171
+
172
+ afterUpdate(() => {
173
+ value_is_output = false;
174
+ initialized = true;
175
+ });
176
+ </script>
177
+
178
+ <label class:container>
179
+ <BlockTitle {show_label} {info}>{label}</BlockTitle>
180
+
181
+ <div class="wrap">
182
+ <div class="wrap-inner" class:show_options>
183
+ <div class="secondary-wrap">
184
+ <input
185
+ class="border-none"
186
+ class:subdued={!choices_names.includes(input_text) &&
187
+ !allow_custom_value}
188
+ {disabled}
189
+ autocomplete="off"
190
+ bind:value={input_text}
191
+ bind:this={filter_input}
192
+ on:keydown={handle_key_down}
193
+ on:blur={handle_blur}
194
+ on:focus={handle_focus}
195
+ readonly={!filterable}
196
+ />
197
+ {#if !disabled}
198
+ <div class="icon-wrap">
199
+ <DropdownArrow />
200
+ </div>
201
+ {/if}
202
+ </div>
203
+ </div>
204
+ <DropdownOptions
205
+ {show_options}
206
+ {choices}
207
+ {filtered_indices}
208
+ {disabled}
209
+ selected_indices={selected_index === null ? [] : [selected_index]}
210
+ {active_index}
211
+ on:change={handle_option_selected}
212
+ />
213
+ </div>
214
+ </label>
215
+
216
+ <style>
217
+ .icon-wrap {
218
+ color: var(--body-text-color);
219
+ margin-right: var(--size-2);
220
+ width: var(--size-5);
221
+ }
222
+ label:not(.container),
223
+ label:not(.container) .wrap,
224
+ label:not(.container) .wrap-inner,
225
+ label:not(.container) .secondary-wrap,
226
+ label:not(.container) input {
227
+ height: 100%;
228
+ }
229
+ .container .wrap {
230
+ box-shadow: var(--input-shadow);
231
+ border: var(--input-border-width) solid var(--border-color-primary);
232
+ }
233
+
234
+ .wrap {
235
+ position: relative;
236
+ border-radius: var(--input-radius);
237
+ background: var(--input-background-fill);
238
+ }
239
+
240
+ .wrap:focus-within {
241
+ box-shadow: var(--input-shadow-focus);
242
+ border-color: var(--input-border-color-focus);
243
+ }
244
+
245
+ .wrap-inner {
246
+ display: flex;
247
+ position: relative;
248
+ flex-wrap: wrap;
249
+ align-items: center;
250
+ gap: var(--checkbox-label-gap);
251
+ padding: var(--checkbox-label-padding);
252
+ }
253
+ .secondary-wrap {
254
+ display: flex;
255
+ flex: 1 1 0%;
256
+ align-items: center;
257
+ border: none;
258
+ min-width: min-content;
259
+ }
260
+
261
+ input {
262
+ margin: var(--spacing-sm);
263
+ outline: none;
264
+ border: none;
265
+ background: inherit;
266
+ width: var(--size-full);
267
+ color: var(--body-text-color);
268
+ font-size: var(--input-text-size);
269
+ }
270
+
271
+ input:disabled {
272
+ -webkit-text-fill-color: var(--body-text-color);
273
+ -webkit-opacity: 1;
274
+ opacity: 1;
275
+ cursor: not-allowed;
276
+ }
277
+
278
+ .subdued {
279
+ color: var(--body-text-color-subdued);
280
+ }
281
+
282
+ input[readonly] {
283
+ cursor: pointer;
284
+ }
285
+ </style>
src/frontend/shared/DropdownOptions.svelte ADDED
@@ -0,0 +1,144 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <script lang="ts">
2
+ import { fly } from "svelte/transition";
3
+ import { createEventDispatcher } from "svelte";
4
+ export let choices: [string, string | number][];
5
+ export let filtered_indices: number[];
6
+ export let show_options = false;
7
+ export let disabled = false;
8
+ export let selected_indices: (string | number)[] = [];
9
+ export let active_index: number | null = null;
10
+
11
+ let distance_from_top: number;
12
+ let distance_from_bottom: number;
13
+ let input_height: number;
14
+ let input_width: number;
15
+ let refElement: HTMLDivElement;
16
+ let listElement: HTMLUListElement;
17
+ let top: string | null, bottom: string | null, max_height: number;
18
+ let innerHeight: number;
19
+
20
+ function calculate_window_distance(): void {
21
+ const { top: ref_top, bottom: ref_bottom } =
22
+ refElement.getBoundingClientRect();
23
+ distance_from_top = ref_top;
24
+ distance_from_bottom = innerHeight - ref_bottom;
25
+ }
26
+
27
+ let scroll_timeout: NodeJS.Timeout | null = null;
28
+ function scroll_listener(): void {
29
+ if (!show_options) return;
30
+ if (scroll_timeout !== null) {
31
+ clearTimeout(scroll_timeout);
32
+ }
33
+
34
+ scroll_timeout = setTimeout(() => {
35
+ calculate_window_distance();
36
+ scroll_timeout = null;
37
+ }, 10);
38
+ }
39
+
40
+ $: {
41
+ if (show_options && refElement) {
42
+ if (listElement && selected_indices.length > 0) {
43
+ let elements = listElement.querySelectorAll("li");
44
+ for (const element of Array.from(elements)) {
45
+ if (
46
+ element.getAttribute("data-index") ===
47
+ selected_indices[0].toString()
48
+ ) {
49
+ listElement?.scrollTo?.(0, (element as HTMLLIElement).offsetTop);
50
+ break;
51
+ }
52
+ }
53
+ }
54
+ calculate_window_distance();
55
+ const rect = refElement.parentElement?.getBoundingClientRect();
56
+ input_height = rect?.height || 0;
57
+ input_width = rect?.width || 0;
58
+ }
59
+ if (distance_from_bottom > distance_from_top) {
60
+ top = `${distance_from_top}px`;
61
+ max_height = distance_from_bottom;
62
+ bottom = null;
63
+ } else {
64
+ bottom = `${distance_from_bottom + input_height}px`;
65
+ max_height = distance_from_top - input_height;
66
+ top = null;
67
+ }
68
+ }
69
+
70
+ const dispatch = createEventDispatcher();
71
+ </script>
72
+
73
+ <svelte:window on:scroll={scroll_listener} bind:innerHeight />
74
+
75
+ <div class="reference" bind:this={refElement} />
76
+ {#if show_options && !disabled}
77
+ <ul
78
+ class="options"
79
+ transition:fly={{ duration: 200, y: 5 }}
80
+ on:mousedown|preventDefault={(e) => dispatch("change", e)}
81
+ style:top
82
+ style:bottom
83
+ style:max-height={`calc(${max_height}px - var(--window-padding))`}
84
+ style:width={input_width + "px"}
85
+ bind:this={listElement}
86
+ role="listbox"
87
+ >
88
+ {#each filtered_indices as index}
89
+ <li
90
+ class="item"
91
+ class:selected={selected_indices.includes(index)}
92
+ class:active={index === active_index}
93
+ class:bg-gray-100={index === active_index}
94
+ class:dark:bg-gray-600={index === active_index}
95
+ data-index={index}
96
+ aria-label={choices[index][0]}
97
+ data-testid="dropdown-option"
98
+ role="option"
99
+ aria-selected={selected_indices.includes(index)}
100
+ >
101
+ <span class:hide={!selected_indices.includes(index)} class="inner-item">
102
+
103
+ </span>
104
+ {choices[index][0]}
105
+ </li>
106
+ {/each}
107
+ </ul>
108
+ {/if}
109
+
110
+ <style>
111
+ .options {
112
+ --window-padding: var(--size-8);
113
+ position: fixed;
114
+ z-index: var(--layer-top);
115
+ margin-left: 0;
116
+ box-shadow: var(--shadow-drop-lg);
117
+ border-radius: var(--container-radius);
118
+ background: var(--background-fill-primary);
119
+ min-width: fit-content;
120
+ max-width: inherit;
121
+ overflow: auto;
122
+ color: var(--body-text-color);
123
+ list-style: none;
124
+ }
125
+
126
+ .item {
127
+ display: flex;
128
+ cursor: pointer;
129
+ padding: var(--size-2);
130
+ }
131
+
132
+ .item:hover,
133
+ .active {
134
+ background: var(--background-fill-secondary);
135
+ }
136
+
137
+ .inner-item {
138
+ padding-right: var(--size-1);
139
+ }
140
+
141
+ .hide {
142
+ visibility: hidden;
143
+ }
144
+ </style>
src/frontend/shared/Multiselect.svelte ADDED
@@ -0,0 +1,410 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <script lang="ts">
2
+ import { afterUpdate, createEventDispatcher } from "svelte";
3
+ import { _, number } from "svelte-i18n";
4
+ import { BlockTitle } from "@gradio/atoms";
5
+ import { Remove, DropdownArrow } from "@gradio/icons";
6
+ import type { SelectData, I18nFormatter } from "@gradio/utils";
7
+ import DropdownOptions from "./DropdownOptions.svelte";
8
+ import { handle_filter, handle_change, handle_shared_keys } from "./utils";
9
+
10
+ export let label: string;
11
+ export let info: string | undefined = undefined;
12
+ export let value: string | number | (string | number)[] | undefined = [];
13
+ let old_value: string | number | (string | number)[] | undefined = [];
14
+ export let value_is_output = false;
15
+ export let max_choices: number | null = null;
16
+ export let choices: [string, string | number][];
17
+ let old_choices: [string, string | number][];
18
+ export let disabled = false;
19
+ export let show_label: boolean;
20
+ export let container = true;
21
+ export let allow_custom_value = false;
22
+ export let filterable = true;
23
+ export let i18n: I18nFormatter;
24
+
25
+ let filter_input: HTMLElement;
26
+ let input_text = "";
27
+ let old_input_text = "";
28
+ let show_options = false;
29
+ let choices_names: string[];
30
+ let choices_values: (string | number)[];
31
+
32
+ // All of these are indices with respect to the choices array
33
+ let filtered_indices: number[] = [];
34
+ let active_index: number | null = null;
35
+ // selected_index consists of indices from choices or strings if allow_custom_value is true and user types in a custom value
36
+ let selected_indices: (number | string)[] = [];
37
+ let old_selected_index: (number | string)[] = [];
38
+
39
+ const dispatch = createEventDispatcher<{
40
+ change: string | string[] | undefined;
41
+ input: undefined;
42
+ select: SelectData;
43
+ blur: undefined;
44
+ focus: undefined;
45
+ }>();
46
+
47
+ // Setting the initial value of the multiselect dropdown
48
+ if (Array.isArray(value)) {
49
+ value.forEach((element) => {
50
+ const index = choices.map((c) => c[1]).indexOf(element);
51
+ if (index !== -1) {
52
+ selected_indices.push(index);
53
+ } else {
54
+ selected_indices.push(element);
55
+ }
56
+ });
57
+ }
58
+
59
+ $: {
60
+ choices_names = choices.map((c) => c[0]);
61
+ choices_values = choices.map((c) => c[1]);
62
+ }
63
+
64
+ $: {
65
+ if (choices !== old_choices || input_text !== old_input_text) {
66
+ filtered_indices = handle_filter(choices, input_text);
67
+ old_choices = choices;
68
+ old_input_text = input_text;
69
+ if (!allow_custom_value) {
70
+ active_index = filtered_indices[0];
71
+ }
72
+ }
73
+ }
74
+
75
+ $: {
76
+ if (JSON.stringify(value) != JSON.stringify(old_value)) {
77
+ handle_change(dispatch, value, value_is_output);
78
+ old_value = Array.isArray(value) ? value.slice() : value;
79
+ }
80
+ }
81
+
82
+ $: {
83
+ if (
84
+ JSON.stringify(selected_indices) != JSON.stringify(old_selected_index)
85
+ ) {
86
+ value = selected_indices.map((index) =>
87
+ typeof index === "number" ? choices_values[index] : index
88
+ );
89
+ old_selected_index = selected_indices.slice();
90
+ }
91
+ }
92
+
93
+ function handle_blur(): void {
94
+ if (!allow_custom_value) {
95
+ input_text = "";
96
+ }
97
+
98
+ if (allow_custom_value && input_text !== "") {
99
+ add_selected_choice(input_text);
100
+ input_text = "";
101
+ }
102
+
103
+ show_options = false;
104
+ active_index = null;
105
+ dispatch("blur");
106
+ }
107
+
108
+ function remove_selected_choice(option_index: number | string): void {
109
+ selected_indices = selected_indices.filter((v) => v !== option_index);
110
+ dispatch("select", {
111
+ index: typeof option_index === "number" ? option_index : -1,
112
+ value:
113
+ typeof option_index === "number"
114
+ ? choices_values[option_index]
115
+ : option_index,
116
+ selected: false
117
+ });
118
+ }
119
+
120
+ function add_selected_choice(option_index: number | string): void {
121
+ if (max_choices === null || selected_indices.length < max_choices) {
122
+ selected_indices = [...selected_indices, option_index];
123
+ dispatch("select", {
124
+ index: typeof option_index === "number" ? option_index : -1,
125
+ value:
126
+ typeof option_index === "number"
127
+ ? choices_values[option_index]
128
+ : option_index,
129
+ selected: true
130
+ });
131
+ }
132
+ if (selected_indices.length === max_choices) {
133
+ show_options = false;
134
+ active_index = null;
135
+ filter_input.blur();
136
+ }
137
+ }
138
+
139
+ function handle_option_selected(e: any): void {
140
+ const option_index = parseInt(e.detail.target.dataset.index);
141
+ add_or_remove_index(option_index);
142
+ }
143
+
144
+ function add_or_remove_index(option_index: number): void {
145
+ if (selected_indices.includes(option_index)) {
146
+ remove_selected_choice(option_index);
147
+ } else {
148
+ add_selected_choice(option_index);
149
+ }
150
+ input_text = "";
151
+ }
152
+
153
+ function remove_all(e: any): void {
154
+ selected_indices = [];
155
+ input_text = "";
156
+ e.preventDefault();
157
+ }
158
+
159
+ function handle_focus(e: FocusEvent): void {
160
+ filtered_indices = choices.map((_, i) => i);
161
+ if (max_choices === null || selected_indices.length < max_choices) {
162
+ show_options = true;
163
+ }
164
+ dispatch("focus");
165
+ }
166
+
167
+ function handle_key_down(e: KeyboardEvent): void {
168
+ [show_options, active_index] = handle_shared_keys(
169
+ e,
170
+ active_index,
171
+ filtered_indices
172
+ );
173
+ if (e.key === "Enter") {
174
+ if (active_index !== null) {
175
+ add_or_remove_index(active_index);
176
+ } else {
177
+ if (allow_custom_value) {
178
+ add_selected_choice(input_text);
179
+ input_text = "";
180
+ }
181
+ }
182
+ }
183
+ if (e.key === "Backspace" && input_text === "") {
184
+ selected_indices = [...selected_indices.slice(0, -1)];
185
+ }
186
+ if (selected_indices.length === max_choices) {
187
+ show_options = false;
188
+ active_index = null;
189
+ }
190
+ }
191
+
192
+ function set_selected_indices(): void {
193
+ if (value === undefined) {
194
+ selected_indices = [];
195
+ } else if (Array.isArray(value)) {
196
+ selected_indices = value
197
+ .map((v) => {
198
+ const index = choices_values.indexOf(v);
199
+ if (index !== -1) {
200
+ return index;
201
+ }
202
+ if (allow_custom_value) {
203
+ return v;
204
+ }
205
+ // Instead of returning null, skip this iteration
206
+ return undefined;
207
+ })
208
+ .filter((val): val is string | number => val !== undefined);
209
+ }
210
+ }
211
+
212
+ $: value, set_selected_indices();
213
+
214
+ afterUpdate(() => {
215
+ value_is_output = false;
216
+ });
217
+ </script>
218
+
219
+ <label class:container>
220
+ <BlockTitle {show_label} {info}>{label}</BlockTitle>
221
+
222
+ <div class="wrap">
223
+ <div class="wrap-inner" class:show_options>
224
+ {#each selected_indices as s}
225
+ <div class="token">
226
+ <span>
227
+ {#if typeof s === "number"}
228
+ {choices_names[s]}
229
+ {:else}
230
+ {s}
231
+ {/if}
232
+ </span>
233
+ {#if !disabled}
234
+ <div
235
+ class="token-remove"
236
+ on:click|preventDefault={() => remove_selected_choice(s)}
237
+ on:keydown|preventDefault={(event) => {
238
+ if (event.key === "Enter") {
239
+ remove_selected_choice(s);
240
+ }
241
+ }}
242
+ role="button"
243
+ tabindex="0"
244
+ title={i18n("common.remove") + " " + s}
245
+ >
246
+ <Remove />
247
+ </div>
248
+ {/if}
249
+ </div>
250
+ {/each}
251
+ <div class="secondary-wrap">
252
+ <input
253
+ class="border-none"
254
+ class:subdued={(!choices_names.includes(input_text) &&
255
+ !allow_custom_value) ||
256
+ selected_indices.length === max_choices}
257
+ {disabled}
258
+ autocomplete="off"
259
+ bind:value={input_text}
260
+ bind:this={filter_input}
261
+ on:keydown={handle_key_down}
262
+ on:blur={handle_blur}
263
+ on:focus={handle_focus}
264
+ readonly={!filterable}
265
+ />
266
+
267
+ {#if !disabled}
268
+ {#if selected_indices.length > 0}
269
+ <div
270
+ role="button"
271
+ tabindex="0"
272
+ class="token-remove remove-all"
273
+ title={i18n("common.clear")}
274
+ on:click={remove_all}
275
+ on:keydown={(event) => {
276
+ if (event.key === "Enter") {
277
+ remove_all(event);
278
+ }
279
+ }}
280
+ >
281
+ <Remove />
282
+ </div>
283
+ {/if}
284
+ <span class="icon-wrap"> <DropdownArrow /></span>
285
+ {/if}
286
+ </div>
287
+ </div>
288
+ <DropdownOptions
289
+ {show_options}
290
+ {choices}
291
+ {filtered_indices}
292
+ {disabled}
293
+ {selected_indices}
294
+ {active_index}
295
+ on:change={handle_option_selected}
296
+ />
297
+ </div>
298
+ </label>
299
+
300
+ <style>
301
+ .icon-wrap {
302
+ color: var(--body-text-color);
303
+ margin-right: var(--size-2);
304
+ width: var(--size-5);
305
+ }
306
+ label:not(.container),
307
+ label:not(.container) .wrap,
308
+ label:not(.container) .wrap-inner,
309
+ label:not(.container) .secondary-wrap,
310
+ label:not(.container) .token,
311
+ label:not(.container) input {
312
+ height: 100%;
313
+ }
314
+ .container .wrap {
315
+ box-shadow: var(--input-shadow);
316
+ border: var(--input-border-width) solid var(--border-color-primary);
317
+ }
318
+
319
+ .wrap {
320
+ position: relative;
321
+ border-radius: var(--input-radius);
322
+ background: var(--input-background-fill);
323
+ }
324
+
325
+ .wrap:focus-within {
326
+ box-shadow: var(--input-shadow-focus);
327
+ border-color: var(--input-border-color-focus);
328
+ }
329
+
330
+ .wrap-inner {
331
+ display: flex;
332
+ position: relative;
333
+ flex-wrap: wrap;
334
+ align-items: center;
335
+ gap: var(--checkbox-label-gap);
336
+ padding: var(--checkbox-label-padding);
337
+ }
338
+
339
+ .token {
340
+ display: flex;
341
+ align-items: center;
342
+ transition: var(--button-transition);
343
+ cursor: pointer;
344
+ box-shadow: var(--checkbox-label-shadow);
345
+ border: var(--checkbox-label-border-width) solid
346
+ var(--checkbox-label-border-color);
347
+ border-radius: var(--button-small-radius);
348
+ background: var(--checkbox-label-background-fill);
349
+ padding: var(--checkbox-label-padding);
350
+ color: var(--checkbox-label-text-color);
351
+ font-weight: var(--checkbox-label-text-weight);
352
+ font-size: var(--checkbox-label-text-size);
353
+ line-height: var(--line-md);
354
+ }
355
+
356
+ .token > * + * {
357
+ margin-left: var(--size-2);
358
+ }
359
+
360
+ .token-remove {
361
+ fill: var(--body-text-color);
362
+ display: flex;
363
+ justify-content: center;
364
+ align-items: center;
365
+ cursor: pointer;
366
+ border: var(--checkbox-border-width) solid var(--border-color-primary);
367
+ border-radius: var(--radius-full);
368
+ background: var(--background-fill-primary);
369
+ padding: var(--size-0-5);
370
+ width: 18px;
371
+ height: 18px;
372
+ }
373
+
374
+ .secondary-wrap {
375
+ display: flex;
376
+ flex: 1 1 0%;
377
+ align-items: center;
378
+ border: none;
379
+ min-width: min-content;
380
+ }
381
+
382
+ input {
383
+ margin: var(--spacing-sm);
384
+ outline: none;
385
+ border: none;
386
+ background: inherit;
387
+ width: var(--size-full);
388
+ color: var(--body-text-color);
389
+ font-size: var(--input-text-size);
390
+ }
391
+
392
+ input:disabled {
393
+ -webkit-text-fill-color: var(--body-text-color);
394
+ -webkit-opacity: 1;
395
+ opacity: 1;
396
+ cursor: not-allowed;
397
+ }
398
+
399
+ .remove-all {
400
+ margin-left: var(--size-1);
401
+ width: 20px;
402
+ height: 20px;
403
+ }
404
+ .subdued {
405
+ color: var(--body-text-color-subdued);
406
+ }
407
+ input[readonly] {
408
+ cursor: pointer;
409
+ }
410
+ </style>
src/frontend/shared/utils.ts ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ function positive_mod(n: number, m: number): number {
2
+ return ((n % m) + m) % m;
3
+ }
4
+
5
+ export function handle_filter(
6
+ choices: [string, string | number][],
7
+ input_text: string
8
+ ): number[] {
9
+ return choices.reduce((filtered_indices, o, index) => {
10
+ if (
11
+ input_text ? o[0].toLowerCase().includes(input_text.toLowerCase()) : true
12
+ ) {
13
+ filtered_indices.push(index);
14
+ }
15
+ return filtered_indices;
16
+ }, [] as number[]);
17
+ }
18
+
19
+ export function handle_change(
20
+ dispatch: any,
21
+ value: string | number | (string | number)[] | undefined,
22
+ value_is_output: boolean
23
+ ): void {
24
+ dispatch("change", value);
25
+ if (!value_is_output) {
26
+ dispatch("input");
27
+ }
28
+ }
29
+
30
+ export function handle_shared_keys(
31
+ e: KeyboardEvent,
32
+ active_index: number | null,
33
+ filtered_indices: number[]
34
+ ): [boolean, number | null] {
35
+ if (e.key === "Escape") {
36
+ return [false, active_index];
37
+ }
38
+ if (e.key === "ArrowDown" || e.key === "ArrowUp") {
39
+ if (filtered_indices.length >= 0) {
40
+ if (active_index === null) {
41
+ active_index =
42
+ e.key === "ArrowDown"
43
+ ? filtered_indices[0]
44
+ : filtered_indices[filtered_indices.length - 1];
45
+ } else {
46
+ const index_in_filtered = filtered_indices.indexOf(active_index);
47
+ const increment = e.key === "ArrowUp" ? -1 : 1;
48
+ active_index =
49
+ filtered_indices[
50
+ positive_mod(index_in_filtered + increment, filtered_indices.length)
51
+ ];
52
+ }
53
+ }
54
+ }
55
+ return [true, active_index];
56
+ }
src/pyproject.toml ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [build-system]
2
+ requires = [
3
+ "hatchling",
4
+ "hatch-requirements-txt",
5
+ "hatch-fancy-pypi-readme>=22.5.0",
6
+ ]
7
+ build-backend = "hatchling.build"
8
+
9
+ [project]
10
+ name = "gradio_test3"
11
+ version = "0.0.1"
12
+ description = "This is a test component"
13
+ readme = "README.md"
14
+ license = "MIT"
15
+ requires-python = ">=3.8"
16
+ authors = [{ name = "YOUR NAME", email = "[email protected]" }]
17
+ keywords = ["gradio-custom-component", "gradio-template-Dropdown", "test", "cool", "dropdown"]
18
+ # Add dependencies here
19
+ dependencies = ["gradio>=4.0,<5.0"]
20
+ classifiers = [
21
+ 'Development Status :: 3 - Alpha',
22
+ 'License :: OSI Approved :: Apache Software License',
23
+ 'Operating System :: OS Independent',
24
+ 'Programming Language :: Python :: 3',
25
+ 'Programming Language :: Python :: 3 :: Only',
26
+ 'Programming Language :: Python :: 3.8',
27
+ 'Programming Language :: Python :: 3.9',
28
+ 'Programming Language :: Python :: 3.10',
29
+ 'Programming Language :: Python :: 3.11',
30
+ 'Topic :: Scientific/Engineering',
31
+ 'Topic :: Scientific/Engineering :: Artificial Intelligence',
32
+ 'Topic :: Scientific/Engineering :: Visualization',
33
+ ]
34
+
35
+ [project.optional-dependencies]
36
+ dev = ["build", "twine"]
37
+
38
+ [tool.hatch.build]
39
+ artifacts = ["/backend/gradio_test3/templates", "*.pyi"]
40
+
41
+ [tool.hatch.build.targets.wheel]
42
+ packages = ["/backend/gradio_test3"]