streamlit-nightly 1.33.1.dev20240409__py2.py3-none-any.whl → 1.33.1.dev20240414__py2.py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- streamlit/__init__.py +4 -1
- streamlit/delta_generator.py +54 -36
- streamlit/elements/dialog_decorator.py +166 -0
- streamlit/elements/image.py +5 -3
- streamlit/elements/layouts.py +19 -0
- streamlit/elements/lib/dialog.py +148 -0
- streamlit/proto/Block_pb2.py +26 -22
- streamlit/proto/Block_pb2.pyi +43 -3
- streamlit/proto/Common_pb2.py +1 -1
- streamlit/runtime/scriptrunner/script_run_context.py +3 -0
- streamlit/runtime/scriptrunner/script_runner.py +16 -0
- streamlit/runtime/state/query_params.py +28 -11
- streamlit/runtime/state/query_params_proxy.py +51 -3
- streamlit/runtime/state/session_state.py +3 -0
- streamlit/static/asset-manifest.json +5 -5
- streamlit/static/index.html +1 -1
- streamlit/static/static/js/{1168.3029456a.chunk.js → 1168.1d6408e6.chunk.js} +1 -1
- streamlit/static/static/js/{4666.b694c5a9.chunk.js → 4666.492dcf72.chunk.js} +1 -1
- streamlit/static/static/js/8427.d30dffe1.chunk.js +1 -0
- streamlit/static/static/js/main.a41ffabd.js +2 -0
- {streamlit_nightly-1.33.1.dev20240409.dist-info → streamlit_nightly-1.33.1.dev20240414.dist-info}/METADATA +1 -1
- {streamlit_nightly-1.33.1.dev20240409.dist-info → streamlit_nightly-1.33.1.dev20240414.dist-info}/RECORD +27 -25
- streamlit/static/static/js/8427.b0ed496b.chunk.js +0 -1
- streamlit/static/static/js/main.37ad7d13.js +0 -2
- /streamlit/static/static/js/{main.37ad7d13.js.LICENSE.txt → main.a41ffabd.js.LICENSE.txt} +0 -0
- {streamlit_nightly-1.33.1.dev20240409.data → streamlit_nightly-1.33.1.dev20240414.data}/scripts/streamlit.cmd +0 -0
- {streamlit_nightly-1.33.1.dev20240409.dist-info → streamlit_nightly-1.33.1.dev20240414.dist-info}/WHEEL +0 -0
- {streamlit_nightly-1.33.1.dev20240409.dist-info → streamlit_nightly-1.33.1.dev20240414.dist-info}/entry_points.txt +0 -0
- {streamlit_nightly-1.33.1.dev20240409.dist-info → streamlit_nightly-1.33.1.dev20240414.dist-info}/top_level.txt +0 -0
streamlit/proto/Common_pb2.py
CHANGED
@@ -13,7 +13,7 @@ _sym_db = _symbol_database.Default()
|
|
13
13
|
|
14
14
|
|
15
15
|
|
16
|
-
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x1cstreamlit/proto/Common.proto\"\x1b\n\x0bStringArray\x12\x0c\n\x04\x64\x61ta\x18\x01 \x03(\t\"\x1b\n\x0b\x44oubleArray\x12\x0c\n\x04\x64\x61ta\x18\x01 \x03(\x01\"\x1a\n\nInt32Array\x12\x0c\n\x04\x64\x61ta\x18\x01 \x03(\x05\"\x1a\n\nInt64Array\x12\x0c\n\x04\x64\x61ta\x18\x01 \x03(\x03\"\x1b\n\x0bSInt64Array\x12\x0c\n\x04\x64\x61ta\x18\x01 \x03(\x12\"\x1b\n\x0bUInt32Array\x12\x0c\n\x04\x64\x61ta\x18\x01 \x03(\r\"0\n\x12StringTriggerValue\x12\x11\n\x04\x64\x61ta\x18\x01 \x01(\tH\x00\x88\x01\x01\x42\x07\n\x05_data\"M\n\x0f\x46ileURLsRequest\x12\x12\n\nrequest_id\x18\x01 \x01(\t\x12\x12\n\nfile_names\x18\x02 \x03(\t\x12\x12\n\nsession_id\x18\x03 \x01(\t\"C\n\x08\x46ileURLs\x12\x0f\n\x07\x66ile_id\x18\x01 \x01(\t\x12\x12\n\nupload_url\x18\x02 \x01(\t\x12\x12\n\ndelete_url\x18\x03 \x01(\t\"X\n\x10\x46ileURLsResponse\x12\x13\n\x0bresponse_id\x18\x01 \x01(\t\x12\x1c\n\tfile_urls\x18\x02 \x03(\x0b\x32\t.FileURLs\x12\x11\n\terror_msg\x18\x03 \x01(\t\"i\n\x10UploadedFileInfo\x12\n\n\x02id\x18\x01 \x01(\x12\x12\x0c\n\x04name\x18\x02 \x01(\t\x12\x0c\n\x04size\x18\x03 \x01(\
|
16
|
+
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x1cstreamlit/proto/Common.proto\"\x1b\n\x0bStringArray\x12\x0c\n\x04\x64\x61ta\x18\x01 \x03(\t\"\x1b\n\x0b\x44oubleArray\x12\x0c\n\x04\x64\x61ta\x18\x01 \x03(\x01\"\x1a\n\nInt32Array\x12\x0c\n\x04\x64\x61ta\x18\x01 \x03(\x05\"\x1a\n\nInt64Array\x12\x0c\n\x04\x64\x61ta\x18\x01 \x03(\x03\"\x1b\n\x0bSInt64Array\x12\x0c\n\x04\x64\x61ta\x18\x01 \x03(\x12\"\x1b\n\x0bUInt32Array\x12\x0c\n\x04\x64\x61ta\x18\x01 \x03(\r\"0\n\x12StringTriggerValue\x12\x11\n\x04\x64\x61ta\x18\x01 \x01(\tH\x00\x88\x01\x01\x42\x07\n\x05_data\"M\n\x0f\x46ileURLsRequest\x12\x12\n\nrequest_id\x18\x01 \x01(\t\x12\x12\n\nfile_names\x18\x02 \x03(\t\x12\x12\n\nsession_id\x18\x03 \x01(\t\"C\n\x08\x46ileURLs\x12\x0f\n\x07\x66ile_id\x18\x01 \x01(\t\x12\x12\n\nupload_url\x18\x02 \x01(\t\x12\x12\n\ndelete_url\x18\x03 \x01(\t\"X\n\x10\x46ileURLsResponse\x12\x13\n\x0bresponse_id\x18\x01 \x01(\t\x12\x1c\n\tfile_urls\x18\x02 \x03(\x0b\x32\t.FileURLs\x12\x11\n\terror_msg\x18\x03 \x01(\t\"i\n\x10UploadedFileInfo\x12\n\n\x02id\x18\x01 \x01(\x12\x12\x0c\n\x04name\x18\x02 \x01(\t\x12\x0c\n\x04size\x18\x03 \x01(\x04\x12\x0f\n\x07\x66ile_id\x18\x04 \x01(\t\x12\x1c\n\tfile_urls\x18\x05 \x01(\x0b\x32\t.FileURLs\"W\n\x11\x46ileUploaderState\x12\x13\n\x0bmax_file_id\x18\x01 \x01(\x12\x12-\n\x12uploaded_file_info\x18\x02 \x03(\x0b\x32\x11.UploadedFileInfoB+\n\x1c\x63om.snowflake.apps.streamlitB\x0b\x43ommonProtob\x06proto3')
|
17
17
|
|
18
18
|
_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, globals())
|
19
19
|
_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'streamlit.proto.Common_pb2', globals())
|
@@ -77,6 +77,8 @@ class ScriptRunContext:
|
|
77
77
|
script_requests: ScriptRequests | None = None
|
78
78
|
current_fragment_id: str | None = None
|
79
79
|
fragment_ids_this_run: set[str] | None = None
|
80
|
+
# we allow only one dialog to be open at the same time
|
81
|
+
has_dialog_opened: bool = False
|
80
82
|
|
81
83
|
# TODO(willhuang1997): Remove this variable when experimental query params are removed
|
82
84
|
_experimental_query_params_used = False
|
@@ -102,6 +104,7 @@ class ScriptRunContext:
|
|
102
104
|
self.tracked_commands_counter = collections.Counter()
|
103
105
|
self.current_fragment_id = None
|
104
106
|
self.fragment_ids_this_run = fragment_ids_this_run
|
107
|
+
self.has_dialog_opened = False
|
105
108
|
|
106
109
|
parsed_query_params = parse.parse_qs(query_string, keep_blank_values=True)
|
107
110
|
with self.session_state.query_params() as qp:
|
@@ -46,6 +46,7 @@ from streamlit.runtime.state import (
|
|
46
46
|
SafeSessionState,
|
47
47
|
SessionState,
|
48
48
|
)
|
49
|
+
from streamlit.runtime.state.session_state import SCRIPT_RUN_PAGE_SCRIPT_HASH_KEY
|
49
50
|
from streamlit.runtime.uploaded_file_manager import UploadedFileManager
|
50
51
|
from streamlit.vendor.ipython.modified_sys_path import modified_sys_path
|
51
52
|
|
@@ -463,6 +464,18 @@ class ScriptRunner:
|
|
463
464
|
|
464
465
|
fragment_ids_this_run = set(rerun_data.fragment_id_queue)
|
465
466
|
|
467
|
+
# Clear widget state on page change. This normally happens implicitly
|
468
|
+
# in the script run cleanup steps, but doing it explicitly ensures
|
469
|
+
# it happens even if a script run was interrupted.
|
470
|
+
try:
|
471
|
+
old_hash = self._session_state[SCRIPT_RUN_PAGE_SCRIPT_HASH_KEY]
|
472
|
+
except KeyError:
|
473
|
+
old_hash = None
|
474
|
+
|
475
|
+
if old_hash != page_script_hash:
|
476
|
+
# Page changed, reset widget state
|
477
|
+
self._session_state.on_script_finished(set())
|
478
|
+
|
466
479
|
ctx = self._get_script_run_ctx()
|
467
480
|
ctx.reset(
|
468
481
|
query_string=rerun_data.query_string,
|
@@ -563,6 +576,9 @@ class ScriptRunner:
|
|
563
576
|
rerun_data.widget_states
|
564
577
|
)
|
565
578
|
|
579
|
+
self._session_state[
|
580
|
+
SCRIPT_RUN_PAGE_SCRIPT_HASH_KEY
|
581
|
+
] = page_script_hash
|
566
582
|
ctx.on_script_start()
|
567
583
|
prep_time = timer() - start_time
|
568
584
|
|
@@ -65,6 +65,7 @@ class QueryParams(MutableMapping[str, str]):
|
|
65
65
|
raise KeyError(missing_key_error_message(key))
|
66
66
|
|
67
67
|
def __setitem__(self, key: str, value: str | Iterable[str]) -> None:
|
68
|
+
self._ensure_single_query_api_used()
|
68
69
|
self.__set_item_internal(key, value)
|
69
70
|
self._send_query_param_msg()
|
70
71
|
|
@@ -86,6 +87,7 @@ class QueryParams(MutableMapping[str, str]):
|
|
86
87
|
self._query_params[key] = str(value)
|
87
88
|
|
88
89
|
def __delitem__(self, key: str) -> None:
|
90
|
+
self._ensure_single_query_api_used()
|
89
91
|
try:
|
90
92
|
if key in EMBED_QUERY_PARAMS_KEYS:
|
91
93
|
raise KeyError(missing_key_error_message(key))
|
@@ -100,13 +102,14 @@ class QueryParams(MutableMapping[str, str]):
|
|
100
102
|
/,
|
101
103
|
**kwds: str,
|
102
104
|
):
|
103
|
-
#
|
104
|
-
#
|
105
|
+
# This overrides the `update` provided by MutableMapping
|
106
|
+
# to ensure only one one ForwardMsg is sent.
|
107
|
+
self._ensure_single_query_api_used()
|
105
108
|
if hasattr(other, "keys") and hasattr(other, "__getitem__"):
|
106
109
|
for key in other.keys():
|
107
110
|
self.__set_item_internal(key, other[key])
|
108
111
|
else:
|
109
|
-
for
|
112
|
+
for key, value in other:
|
110
113
|
self.__set_item_internal(key, value)
|
111
114
|
for key, value in kwds.items():
|
112
115
|
self.__set_item_internal(key, value)
|
@@ -146,12 +149,8 @@ class QueryParams(MutableMapping[str, str]):
|
|
146
149
|
ctx.enqueue(msg)
|
147
150
|
|
148
151
|
def clear(self) -> None:
|
149
|
-
|
150
|
-
|
151
|
-
if key in EMBED_QUERY_PARAMS_KEYS:
|
152
|
-
new_query_params[key] = value
|
153
|
-
self._query_params = new_query_params
|
154
|
-
|
152
|
+
self._ensure_single_query_api_used()
|
153
|
+
self.clear_with_no_forward_msg(preserve_embed=True)
|
155
154
|
self._send_query_param_msg()
|
156
155
|
|
157
156
|
def to_dict(self) -> dict[str, str]:
|
@@ -163,11 +162,29 @@ class QueryParams(MutableMapping[str, str]):
|
|
163
162
|
if key not in EMBED_QUERY_PARAMS_KEYS
|
164
163
|
}
|
165
164
|
|
165
|
+
def from_dict(
|
166
|
+
self,
|
167
|
+
_dict: Iterable[tuple[str, str]] | SupportsKeysAndGetItem[str, str],
|
168
|
+
):
|
169
|
+
self._ensure_single_query_api_used()
|
170
|
+
old_value = self._query_params.copy()
|
171
|
+
self.clear_with_no_forward_msg(preserve_embed=True)
|
172
|
+
try:
|
173
|
+
self.update(_dict)
|
174
|
+
except StreamlitAPIException:
|
175
|
+
# restore the original from before we made any changes.
|
176
|
+
self._query_params = old_value
|
177
|
+
raise
|
178
|
+
|
166
179
|
def set_with_no_forward_msg(self, key: str, val: list[str] | str) -> None:
|
167
180
|
self._query_params[key] = val
|
168
181
|
|
169
|
-
def clear_with_no_forward_msg(self) -> None:
|
170
|
-
self._query_params
|
182
|
+
def clear_with_no_forward_msg(self, preserve_embed: bool = False) -> None:
|
183
|
+
self._query_params = {
|
184
|
+
key: value
|
185
|
+
for key, value in self._query_params.items()
|
186
|
+
if key in EMBED_QUERY_PARAMS_KEYS and preserve_embed
|
187
|
+
}
|
171
188
|
|
172
189
|
def _ensure_single_query_api_used(self):
|
173
190
|
# Avoid circular imports
|
@@ -72,18 +72,33 @@ class QueryParamsProxy(MutableMapping[str, str]):
|
|
72
72
|
raise AttributeError(missing_key_error_message(key))
|
73
73
|
|
74
74
|
@overload
|
75
|
-
def update(self, mapping: SupportsKeysAndGetItem[str, str], /, **kwds: str):
|
75
|
+
def update(self, mapping: SupportsKeysAndGetItem[str, str], /, **kwds: str) -> None:
|
76
76
|
...
|
77
77
|
|
78
78
|
@overload
|
79
|
-
def update(
|
79
|
+
def update(
|
80
|
+
self, keys_and_values: Iterable[tuple[str, str]], /, **kwds: str
|
81
|
+
) -> None:
|
80
82
|
...
|
81
83
|
|
82
84
|
@overload
|
83
|
-
def update(self, **kwds: str):
|
85
|
+
def update(self, **kwds: str) -> None:
|
84
86
|
...
|
85
87
|
|
86
88
|
def update(self, other=(), /, **kwds):
|
89
|
+
"""
|
90
|
+
Update one or more values in query_params at once from a dictionary or
|
91
|
+
dictionary-like object.
|
92
|
+
|
93
|
+
See `Mapping.update()` from Python's `collections` library.
|
94
|
+
|
95
|
+
Parameters
|
96
|
+
----------
|
97
|
+
other: SupportsKeysAndGetItem[str, str] | Iterable[tuple[str, str]]
|
98
|
+
A dictionary or mapping of strings to strings.
|
99
|
+
**kwds: str
|
100
|
+
Additional key/value pairs to update passed as keyword arguments.
|
101
|
+
"""
|
87
102
|
with get_session_state().query_params() as qp:
|
88
103
|
qp.update(other, **kwds)
|
89
104
|
|
@@ -146,3 +161,36 @@ class QueryParamsProxy(MutableMapping[str, str]):
|
|
146
161
|
"""
|
147
162
|
with get_session_state().query_params() as qp:
|
148
163
|
return qp.to_dict()
|
164
|
+
|
165
|
+
@overload
|
166
|
+
def from_dict(self, keys_and_values: Iterable[tuple[str, str]]) -> None:
|
167
|
+
...
|
168
|
+
|
169
|
+
@overload
|
170
|
+
def from_dict(self, mapping: SupportsKeysAndGetItem[str, str]) -> None:
|
171
|
+
...
|
172
|
+
|
173
|
+
@gather_metrics("query_params.from_dict")
|
174
|
+
def from_dict(self, other):
|
175
|
+
"""
|
176
|
+
Set all of the query parameters from a dictionary or dictionary-like object.
|
177
|
+
|
178
|
+
This method primarily exists for advanced users who want to be able to control
|
179
|
+
multiple query string parameters in a single update. To set individual
|
180
|
+
query string parameters you should still use `st.query_params["parameter"] = "value"`
|
181
|
+
or `st.query_params.parameter = "value"`.
|
182
|
+
|
183
|
+
`embed` and `embed_options` may not be set via this method and may not be keys in the
|
184
|
+
`other` dictionary.
|
185
|
+
|
186
|
+
Note that this method is NOT a direct inverse of `st.query_params.to_dict()` when
|
187
|
+
the URL query string contains multiple values for a single key. A true inverse
|
188
|
+
operation for from_dict is `{key: st.query_params.get_all(key) for key st.query_params}`.
|
189
|
+
|
190
|
+
Parameters
|
191
|
+
-------
|
192
|
+
other: SupportsKeysAndGetItem[str, str] | Iterable[tuple[str, str]]
|
193
|
+
A dictionary used to replace the current query_params.
|
194
|
+
"""
|
195
|
+
with get_session_state().query_params() as qp:
|
196
|
+
return qp.from_dict(other)
|
@@ -56,6 +56,9 @@ STREAMLIT_INTERNAL_KEY_PREFIX: Final = "$$STREAMLIT_INTERNAL_KEY"
|
|
56
56
|
SCRIPT_RUN_WITHOUT_ERRORS_KEY: Final = (
|
57
57
|
f"{STREAMLIT_INTERNAL_KEY_PREFIX}_SCRIPT_RUN_WITHOUT_ERRORS"
|
58
58
|
)
|
59
|
+
SCRIPT_RUN_PAGE_SCRIPT_HASH_KEY: Final = (
|
60
|
+
f"{STREAMLIT_INTERNAL_KEY_PREFIX}_PAGE_SCRIPT_HASH"
|
61
|
+
)
|
59
62
|
|
60
63
|
|
61
64
|
@dataclass(frozen=True)
|
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"files": {
|
3
3
|
"main.css": "./static/css/main.bf304093.css",
|
4
|
-
"main.js": "./static/js/main.
|
4
|
+
"main.js": "./static/js/main.a41ffabd.js",
|
5
5
|
"static/js/9336.2d95d840.chunk.js": "./static/js/9336.2d95d840.chunk.js",
|
6
6
|
"static/js/9330.d29313d4.chunk.js": "./static/js/9330.d29313d4.chunk.js",
|
7
7
|
"static/js/7217.d970c074.chunk.js": "./static/js/7217.d970c074.chunk.js",
|
@@ -10,7 +10,7 @@
|
|
10
10
|
"static/js/3092.ad569cc8.chunk.js": "./static/js/3092.ad569cc8.chunk.js",
|
11
11
|
"static/css/43.e3b876c5.chunk.css": "./static/css/43.e3b876c5.chunk.css",
|
12
12
|
"static/js/43.9ae03282.chunk.js": "./static/js/43.9ae03282.chunk.js",
|
13
|
-
"static/js/8427.
|
13
|
+
"static/js/8427.d30dffe1.chunk.js": "./static/js/8427.d30dffe1.chunk.js",
|
14
14
|
"static/js/7323.2808d029.chunk.js": "./static/js/7323.2808d029.chunk.js",
|
15
15
|
"static/js/4185.78230b2a.chunk.js": "./static/js/4185.78230b2a.chunk.js",
|
16
16
|
"static/js/7805.51638fbc.chunk.js": "./static/js/7805.51638fbc.chunk.js",
|
@@ -18,7 +18,7 @@
|
|
18
18
|
"static/js/1307.8ea033f1.chunk.js": "./static/js/1307.8ea033f1.chunk.js",
|
19
19
|
"static/js/2469.3e9c3ce9.chunk.js": "./static/js/2469.3e9c3ce9.chunk.js",
|
20
20
|
"static/js/4113.1e7eff4d.chunk.js": "./static/js/4113.1e7eff4d.chunk.js",
|
21
|
-
"static/js/1168.
|
21
|
+
"static/js/1168.1d6408e6.chunk.js": "./static/js/1168.1d6408e6.chunk.js",
|
22
22
|
"static/js/178.b5384fd0.chunk.js": "./static/js/178.b5384fd0.chunk.js",
|
23
23
|
"static/js/1792.b8efa879.chunk.js": "./static/js/1792.b8efa879.chunk.js",
|
24
24
|
"static/js/3513.e3e7300a.chunk.js": "./static/js/3513.e3e7300a.chunk.js",
|
@@ -34,7 +34,7 @@
|
|
34
34
|
"static/js/4477.e10e4373.chunk.js": "./static/js/4477.e10e4373.chunk.js",
|
35
35
|
"static/js/4319.a6745434.chunk.js": "./static/js/4319.a6745434.chunk.js",
|
36
36
|
"static/js/5106.44f0ff51.chunk.js": "./static/js/5106.44f0ff51.chunk.js",
|
37
|
-
"static/js/4666.
|
37
|
+
"static/js/4666.492dcf72.chunk.js": "./static/js/4666.492dcf72.chunk.js",
|
38
38
|
"static/js/5379.6571574f.chunk.js": "./static/js/5379.6571574f.chunk.js",
|
39
39
|
"static/js/8691.9ccf7f89.chunk.js": "./static/js/8691.9ccf7f89.chunk.js",
|
40
40
|
"static/js/6718.802da17e.chunk.js": "./static/js/6718.802da17e.chunk.js",
|
@@ -152,6 +152,6 @@
|
|
152
152
|
},
|
153
153
|
"entrypoints": [
|
154
154
|
"static/css/main.bf304093.css",
|
155
|
-
"static/js/main.
|
155
|
+
"static/js/main.a41ffabd.js"
|
156
156
|
]
|
157
157
|
}
|
streamlit/static/index.html
CHANGED
@@ -1 +1 @@
|
|
1
|
-
<!doctype html><html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width,initial-scale=1,shrink-to-fit=no"/><link rel="shortcut icon" href="./favicon.png"/><link rel="preload" href="./static/media/SourceSansPro-Regular.0d69e5ff5e92ac64a0c9.woff2" as="font" type="font/woff2" crossorigin><link rel="preload" href="./static/media/SourceSansPro-SemiBold.abed79cd0df1827e18cf.woff2" as="font" type="font/woff2" crossorigin><link rel="preload" href="./static/media/SourceSansPro-Bold.118dea98980e20a81ced.woff2" as="font" type="font/woff2" crossorigin><title>Streamlit</title><script>window.prerenderReady=!1</script><script defer="defer" src="./static/js/main.
|
1
|
+
<!doctype html><html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width,initial-scale=1,shrink-to-fit=no"/><link rel="shortcut icon" href="./favicon.png"/><link rel="preload" href="./static/media/SourceSansPro-Regular.0d69e5ff5e92ac64a0c9.woff2" as="font" type="font/woff2" crossorigin><link rel="preload" href="./static/media/SourceSansPro-SemiBold.abed79cd0df1827e18cf.woff2" as="font" type="font/woff2" crossorigin><link rel="preload" href="./static/media/SourceSansPro-Bold.118dea98980e20a81ced.woff2" as="font" type="font/woff2" crossorigin><title>Streamlit</title><script>window.prerenderReady=!1</script><script defer="defer" src="./static/js/main.a41ffabd.js"></script><link href="./static/css/main.bf304093.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div></body></html>
|
@@ -1 +1 @@
|
|
1
|
-
"use strict";(self.webpackChunk_streamlit_app=self.webpackChunk_streamlit_app||[]).push([[1168],{71168:(l,e,o)=>{o.r(e),o.d(e,{default:()=>
|
1
|
+
"use strict";(self.webpackChunk_streamlit_app=self.webpackChunk_streamlit_app||[]).push([[1168],{71168:(l,e,o)=>{o.r(e),o.d(e,{default:()=>b});var r=o(66845),t=o(25621),c=o(62622),a=o(42736),n=o(96825),i=o.n(n),p=o(92627),s=o(63765),f=o(23849);function y(l,e,o){return l=function(l,e){return(l=(l=(l=(l=(l=(l=(l=(l=l.replaceAll("#000032",(0,p.By)(e))).replaceAll("#000033",(0,p.He)(e))).replaceAll("#000034",(0,p.Iy)(e)?e.colors.blue80:e.colors.blue40)).replaceAll("#000035",(0,p.ny)(e))).replaceAll("#000036",(0,p.Xy)(e))).replaceAll("#000037",(0,p.yq)(e))).replaceAll("#000038",e.colors.bgColor)).replaceAll("#000039",e.colors.fadedText05)).replaceAll("#000040",e.colors.bgMix)}(l,e),l=function(l,e,o){const r="#000001",t="#000002",c="#000003",a="#000004",n="#000005",i="#000006",s="#000007",f="#000008",y="#000009",d="#000010";if("streamlit"===o){const o=(0,p.iY)(e);l=(l=(l=(l=(l=(l=(l=(l=(l=(l=l.replaceAll(r,o[0])).replaceAll(t,o[1])).replaceAll(c,o[2])).replaceAll(a,o[3])).replaceAll(n,o[4])).replaceAll(i,o[5])).replaceAll(s,o[6])).replaceAll(f,o[7])).replaceAll(y,o[8])).replaceAll(d,o[9])}else l=(l=(l=(l=(l=(l=(l=(l=(l=(l=l.replaceAll(r,"#636efa")).replaceAll(t,"#EF553B")).replaceAll(c,"#00cc96")).replaceAll(a,"#ab63fa")).replaceAll(n,"#FFA15A")).replaceAll(i,"#19d3f3")).replaceAll(s,"#FF6692")).replaceAll(f,"#B6E880")).replaceAll(y,"#FF97FF")).replaceAll(d,"#FECB52");return l}(l,e,o),l=function(l,e,o){const r="#000011",t="#000012",c="#000013",a="#000014",n="#000015",i="#000016",s="#000017",f="#000018",y="#000019",d="#000020";if("streamlit"===o){const o=(0,p.Gy)(e);l=(l=(l=(l=(l=(l=(l=(l=(l=(l=l.replaceAll(r,o[0])).replaceAll(t,o[1])).replaceAll(c,o[2])).replaceAll(a,o[3])).replaceAll(n,o[4])).replaceAll(i,o[5])).replaceAll(s,o[6])).replaceAll(f,o[7])).replaceAll(y,o[8])).replaceAll(d,o[9])}else l=(l=(l=(l=(l=(l=(l=(l=(l=(l=l.replaceAll(r,"#0d0887")).replaceAll(t,"#46039f")).replaceAll(c,"#7201a8")).replaceAll(a,"#9c179e")).replaceAll(n,"#bd3786")).replaceAll(i,"#d8576b")).replaceAll(s,"#ed7953")).replaceAll(f,"#fb9f3a")).replaceAll(y,"#fdca26")).replaceAll(d,"#f0f921");return l}(l,e,o),l=function(l,e,o){const r="#000021",t="#000022",c="#000023",a="#000024",n="#000025",i="#000026",s="#000027",f="#000028",y="#000029",d="#000030",u="#000031";if("streamlit"===o){const o=(0,p.ru)(e);l=(l=(l=(l=(l=(l=(l=(l=(l=(l=(l=l.replaceAll(r,o[0])).replaceAll(t,o[1])).replaceAll(c,o[2])).replaceAll(a,o[3])).replaceAll(n,o[4])).replaceAll(i,o[5])).replaceAll(s,o[6])).replaceAll(f,o[7])).replaceAll(y,o[8])).replaceAll(d,o[9])).replaceAll(u,o[10])}else l=(l=(l=(l=(l=(l=(l=(l=(l=(l=(l=l.replaceAll(r,"#8e0152")).replaceAll(t,"#c51b7d")).replaceAll(c,"#de77ae")).replaceAll(a,"#f1b6da")).replaceAll(n,"#fde0ef")).replaceAll(i,"#f7f7f7")).replaceAll(s,"#e6f5d0")).replaceAll(f,"#b8e186")).replaceAll(y,"#7fbc41")).replaceAll(d,"#4d9221")).replaceAll(u,"#276419");return l}(l,e,o),l}function d(l,e){try{!function(l,e){const{genericFonts:o,colors:r,fontSizes:t}=e,c={font:{color:(0,p.Xy)(e),family:o.bodyFont,size:t.twoSmPx},title:{color:r.headingColor,subtitleColor:r.bodyText,font:{family:o.headingFont,size:t.mdPx,color:r.headingColor},pad:{l:e.spacing.twoXSPx},xanchor:"left",x:0},legend:{title:{font:{size:t.twoSmPx,color:(0,p.Xy)(e)},side:"top"},valign:"top",bordercolor:r.transparent,borderwidth:e.spacing.nonePx,font:{size:t.twoSmPx,color:(0,p.yq)(e)}},paper_bgcolor:r.bgColor,plot_bgcolor:r.bgColor,yaxis:{ticklabelposition:"outside",zerolinecolor:(0,p.ny)(e),title:{font:{color:(0,p.Xy)(e),size:t.smPx},standoff:e.spacing.twoXLPx},tickcolor:(0,p.ny)(e),tickfont:{color:(0,p.Xy)(e),size:t.twoSmPx},gridcolor:(0,p.ny)(e),minor:{gridcolor:(0,p.ny)(e)},automargin:!0},xaxis:{zerolinecolor:(0,p.ny)(e),gridcolor:(0,p.ny)(e),showgrid:!1,tickfont:{color:(0,p.Xy)(e),size:t.twoSmPx},tickcolor:(0,p.ny)(e),title:{font:{color:(0,p.Xy)(e),size:t.smPx},standoff:e.spacing.xlPx},minor:{gridcolor:(0,p.ny)(e)},zeroline:!1,automargin:!0,rangeselector:{bgcolor:r.bgColor,bordercolor:(0,p.ny)(e),borderwidth:1,x:0}},margin:{pad:e.spacing.smPx,r:e.spacing.nonePx,l:e.spacing.nonePx},hoverlabel:{bgcolor:r.bgColor,bordercolor:r.fadedText10,font:{color:(0,p.Xy)(e),family:o.bodyFont,size:t.twoSmPx}},coloraxis:{colorbar:{thickness:16,xpad:e.spacing.twoXLPx,ticklabelposition:"outside",outlinecolor:r.transparent,outlinewidth:8,len:.75,y:.5745,title:{font:{color:(0,p.Xy)(e),size:t.smPx}},tickfont:{color:(0,p.Xy)(e),size:t.twoSmPx}}},ternary:{gridcolor:(0,p.Xy)(e),bgcolor:r.bgColor,title:{font:{family:o.bodyFont,size:t.smPx}},color:(0,p.Xy)(e),aaxis:{gridcolor:(0,p.Xy)(e),linecolor:(0,p.Xy)(e),tickfont:{family:o.bodyFont,size:t.twoSmPx}},baxis:{linecolor:(0,p.Xy)(e),gridcolor:(0,p.Xy)(e),tickfont:{family:o.bodyFont,size:t.twoSmPx}},caxis:{linecolor:(0,p.Xy)(e),gridcolor:(0,p.Xy)(e),tickfont:{family:o.bodyFont,size:t.twoSmPx}}}};i()(l,c)}(l.layout.template.layout,e)}catch(o){const l=(0,s.b)(o);(0,f.H)(l)}"title"in l.layout&&(l.layout.title=i()(l.layout.title,{text:"<b>".concat(l.layout.title.text,"</b>")}))}var u=o(40864);const A=450;function g(l){let{element:e,width:o,height:c,isFullScreen:n}=l;const i=e.figure,p=(0,t.u)(),s=(0,r.useCallback)((()=>{const l=JSON.parse(y(i.spec,p,e.theme)),r=l.layout.height,t=l.layout.width;return n?(l.layout.width=o,l.layout.height=c):e.useContainerWidth?l.layout.width=o:(l.layout.width=t,l.layout.height=r),"streamlit"===e.theme?d(l,p):l.layout=function(l,e){const{colors:o,genericFonts:r}=e,t={font:{color:o.bodyText,family:r.bodyFont},paper_bgcolor:o.bgColor,plot_bgcolor:o.secondaryBg};return{...l,font:{...t.font,...l.font},paper_bgcolor:l.paper_bgcolor||t.paper_bgcolor,plot_bgcolor:l.plot_bgcolor||t.plot_bgcolor}}(l.layout,p),l}),[e.theme,e.useContainerWidth,i.spec,c,p,o,n]),[f,A]=(0,r.useState)(JSON.parse(i.config)),[g,b]=(0,r.useState)(s());(0,r.useLayoutEffect)((()=>{A(JSON.parse(i.config)),b(s())}),[e,p,c,o,i.config,s]);const{data:h,layout:m,frames:x}=g;return(0,u.jsx)(a.Z,{className:"stPlotlyChart",data:h,layout:m,config:f,frames:x},n?"fullscreen":"original")}const b=(0,c.Z)((function(l){let{width:e,element:o,height:r,isFullScreen:t}=l;switch(o.chart){case"url":return function(l){let{url:e,width:o,height:r}=l;const t=r||A;return(0,u.jsx)("iframe",{title:"Plotly",src:e,style:{width:o,height:t,colorScheme:"normal"}})}({url:o.url,height:r,width:e});case"figure":return(0,u.jsx)(g,{width:e,element:o,height:r,isFullScreen:t});default:throw new Error("Unrecognized PlotlyChart type: ".concat(o.chart))}}))}}]);
|
@@ -1 +1 @@
|
|
1
|
-
"use strict";(self.webpackChunk_streamlit_app=self.webpackChunk_streamlit_app||[]).push([[4666],{90186:(e,t,i)=>{i.d(t,{$:()=>p,Z:()=>c});var s=i(66845),l=i(25621),n=i(66694),a=i(92627),r=i(38570),o=i(80318),d=i(40864);let p;!function(e){e.EXTRASMALL="xs",e.SMALL="sm",e.MEDIUM="md",e.LARGE="lg",e.EXTRALARGE="xl"}(p||(p={}));const c=function(e){let{value:t,width:i,size:c=p.SMALL,overrides:g}=e;const h=(0,l.u)(),u={xs:h.spacing.twoXS,sm:h.spacing.sm,md:h.spacing.lg,lg:h.spacing.xl,xl:h.spacing.twoXL},{activeTheme:m}=s.useContext(n.E),f=!(0,a.MJ)(m),x={BarContainer:{style:{marginTop:h.spacing.none,marginBottom:h.spacing.none,marginRight:h.spacing.none,marginLeft:h.spacing.none}},Bar:{style:e=>{let{$theme:t}=e;return{width:i?i.toString():void 0,marginTop:h.spacing.none,marginBottom:h.spacing.none,marginRight:h.spacing.none,marginLeft:h.spacing.none,height:u[c],backgroundColor:t.colors.progressbarTrackFill,borderTopLeftRadius:h.spacing.twoXS,borderTopRightRadius:h.spacing.twoXS,borderBottomLeftRadius:h.spacing.twoXS,borderBottomRightRadius:h.spacing.twoXS}}},BarProgress:{style:()=>({backgroundColor:f?h.colors.primary:h.colors.blue70,borderTopLeftRadius:h.spacing.twoXS,borderTopRightRadius:h.spacing.twoXS,borderBottomLeftRadius:h.spacing.twoXS,borderBottomRightRadius:h.spacing.twoXS})}};return(0,d.jsx)(r.Z,{value:t,overrides:(0,o.aO)(x,g)})}},77367:(e,t,i)=>{i.d(t,{R:()=>s});class s{setStatus(e){return new s(this.name,this.size,this.id,e)}constructor(e,t,i,s){this.name=void 0,this.size=void 0,this.status=void 0,this.id=void 0,this.name=e,this.size=t,this.id=i,this.status=s}}},14666:(e,t,i)=>{i.r(t),i.d(t,{default:()=>he});var s=i(18080),l=i(62813),n=i.n(l),a=i(84693),r=i.n(a),o=i(66845),d=i(16295),p=i(87814),c=i(50641);let g;!function(e){e.Gigabyte="gb",e.Megabyte="mb",e.Kilobyte="kb",e.Byte="b"}(g||(g={}));const h=(0,c.rA)()?1024:1e3,u=[g.Gigabyte,g.Megabyte,g.Kilobyte,g.Byte],m=function(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;if(t||(t=g.Byte),i<0&&(i=0),e<0)throw new Error("Size must be greater than or equal to 0");const s=u.indexOf(t);return s&&e>h/2?m(e/h,u[s-1],i):"".concat(e.toFixed(i)).concat(t.toUpperCase())};var f=i(98478),x=i(86659),w=i(8879),y=i(68411),b=i(51622),F=i(9003),S=i(81354),v=i(1515);const j=(0,v.Z)("section",{target:"e1b2p2ww15"})((e=>{let{isDisabled:t,theme:i}=e;return{display:"flex",alignItems:"center",padding:i.spacing.lg,backgroundColor:i.colors.secondaryBg,borderRadius:i.radii.lg,":focus":{outline:"none"},":focus-visible":{boxShadow:"0 0 0 1px ".concat(i.colors.primary)},color:t?i.colors.gray:i.colors.bodyText}}),""),I=(0,v.Z)("div",{target:"e1b2p2ww14"})((()=>({marginRight:"auto",alignItems:"center",display:"flex"})),""),U=(0,v.Z)("span",{target:"e1b2p2ww13"})((e=>{let{theme:t}=e;return{color:t.colors.darkenedBgMix100,marginRight:t.spacing.lg}}),""),M=(0,v.Z)("span",{target:"e1b2p2ww12"})((e=>{let{theme:t}=e;return{marginBottom:t.spacing.twoXS}}),""),z=(0,v.Z)("div",{target:"e1b2p2ww11"})({name:"1fttcpj",styles:"display:flex;flex-direction:column"}),L=(0,v.Z)("div",{target:"e1b2p2ww10"})((e=>{let{theme:t}=e;return{left:0,right:0,lineHeight:t.lineHeights.tight,paddingTop:t.spacing.md,paddingLeft:t.spacing.lg,paddingRight:t.spacing.lg}}),""),C=(0,v.Z)("ul",{target:"e1b2p2ww9"})((()=>({listStyleType:"none",marginBottom:0})),""),B=(0,v.Z)("li",{target:"e1b2p2ww8"})((e=>{let{theme:t}=e;return{margin:t.spacing.none,padding:t.spacing.none}}),""),Z=(0,v.Z)("div",{target:"e1b2p2ww7"})((e=>{let{theme:t}=e;return{display:"flex",alignItems:"baseline",flex:1,paddingLeft:t.spacing.lg,overflow:"hidden"}}),""),R=(0,v.Z)("div",{target:"e1b2p2ww6"})((e=>{let{theme:t}=e;return{marginRight:t.spacing.sm,marginBottom:t.spacing.twoXS,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}}),""),k=(0,v.Z)("div",{target:"e1b2p2ww5"})((e=>{let{theme:t}=e;return{display:"flex",alignItems:"center",marginBottom:t.spacing.twoXS}}),""),T=(0,v.Z)("span",{target:"e1b2p2ww4"})((e=>{let{theme:t}=e;return{marginRight:t.spacing.twoXS}}),""),D=(0,v.Z)("div",{target:"e1b2p2ww3"})((e=>{let{theme:t}=e;return{display:"flex",padding:t.spacing.twoXS,color:t.colors.darkenedBgMix100}}),""),X=(0,v.Z)("small",{target:"e1b2p2ww2"})((e=>{let{theme:t}=e;return{color:t.colors.danger,fontSize:t.fontSizes.sm,height:t.fontSizes.sm,lineHeight:t.fontSizes.sm,display:"flex",alignItems:"center",whiteSpace:"nowrap"}}),""),P=(0,v.Z)("span",{target:"e1b2p2ww1"})({name:"0",styles:""}),E=e=>({[j]:{display:"flex",flexDirection:"column",alignItems:"flex-start"},[I]:{marginBottom:e.spacing.lg},[U]:{display:"none"},[L]:{paddingRight:e.spacing.lg},[k]:{maxWidth:"inherit",flex:1,alignItems:"flex-start",marginBottom:e.spacing.sm},[R]:{width:e.sizes.full},[Z]:{flexDirection:"column"},[X]:{height:"auto",whiteSpace:"initial"},[P]:{display:"none"},[B]:{margin:e.spacing.none,padding:e.spacing.none}}),A=(0,v.Z)("div",{target:"e1b2p2ww0"})((e=>{let{theme:t}=e;return t.inSidebar?E(t):{["@media (max-width: ".concat(t.breakpoints.sm,")")]:E(t)}}),"");var V=i(74529),N=i(46927),W=i(33746),O=i(40864);const H=e=>{let{multiple:t,acceptedExtensions:i,maxSizeBytes:s}=e;return(0,O.jsxs)(I,{"data-testid":"stFileUploaderDropzoneInstructions",children:[(0,O.jsx)(U,{children:(0,O.jsx)(N.Z,{content:V.n,size:"threeXL"})}),(0,O.jsxs)(z,{children:[(0,O.jsxs)(M,{children:["Drag and drop file",t?"s":""," here"]}),(0,O.jsxs)(W.x,{children:["Limit ".concat(m(s,g.Byte,0)," per file"),i.length?" \u2022 ".concat(i.map((e=>e.replace(/^\./,"").toUpperCase())).join(", ")):null]})]})]})},_=e=>{let{onDrop:t,multiple:i,acceptedExtensions:s,maxSizeBytes:l,disabled:n,label:a}=e;return(0,O.jsx)(b.ZP,{onDrop:t,multiple:i,accept:s.length?s:void 0,maxSize:l,disabled:n,useFsAccessApi:!1,children:e=>{let{getRootProps:t,getInputProps:r}=e;return(0,O.jsxs)(j,{...t(),"data-testid":"stFileUploaderDropzone",isDisabled:n,"aria-label":a,children:[(0,O.jsx)("input",{"data-testid":"stFileUploaderDropzoneInput",...r()}),(0,O.jsx)(H,{multiple:i,acceptedExtensions:s,maxSizeBytes:l}),(0,O.jsx)(F.ZP,{kind:S.nW.SECONDARY,disabled:n,size:S.V5.SMALL,children:"Browse files"})]})}})};var G=i(13005),K=i.n(G),$=i(30351),q=i(14609);const J=(0,v.Z)("div",{target:"e16k0npc1"})((e=>{let{theme:t}=e;return{display:"flex",alignItems:"center",justifyContent:"space-between",paddingBottom:t.spacing.twoXS,marginBottom:t.spacing.twoXS}}),""),Y=(0,v.Z)("div",{target:"e16k0npc0"})((e=>{let{theme:t}=e;return{display:"flex",alignItems:"center",justifyContent:"center",color:t.colors.fadedText40}}),""),Q=e=>{let{className:t,currentPage:i,totalPages:s,onNext:l,onPrevious:n}=e;return(0,O.jsxs)(J,{className:t,"data-testid":"stPagination",children:[(0,O.jsx)(W.x,{children:"Showing page ".concat(i," of ").concat(s)}),(0,O.jsxs)(Y,{children:[(0,O.jsx)(F.ZP,{onClick:n,kind:S.nW.MINIMAL,children:(0,O.jsx)(N.Z,{content:$.s,size:"xl"})}),(0,O.jsx)(F.ZP,{onClick:l,kind:S.nW.MINIMAL,children:(0,O.jsx)(N.Z,{content:q._,size:"xl"})})]})]})};var ee=i(88235);const te=(e,t)=>Math.ceil(e.length/t),ie=e=>K()((t=>{let{pageSize:i,items:s,resetOnAdd:l,...n}=t;const[a,r]=(0,o.useState)(0),[d,p]=(0,o.useState)(te(s,i)),c=(0,ee.D)(s);(0,o.useEffect)((()=>{c&&c.length!==s.length&&p(te(s,i)),c&&c.length<s.length?l&&r(0):a+1>=d&&r(d-1)}),[s,a,i,c,l,d]);const g=s.slice(a*i,a*i+i);return(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(e,{items:g,...n}),s.length>i?(0,O.jsx)(Q,{className:"streamlit-paginator",pageSize:i,totalPages:d,currentPage:a+1,onNext:()=>{r(Math.min(a+1,d-1))},onPrevious:()=>{r(Math.max(0,a-1))}}):null]})}),e);var se=i(62288),le=i(87847),ne=i(31197),ae=i(90186);const re=e=>{let{fileInfo:t}=e;return"uploading"===t.status.type?(0,O.jsx)(ae.Z,{value:t.status.progress,size:ae.$.SMALL,overrides:{Bar:{style:{marginLeft:0,marginTop:"4px"}}}}):"error"===t.status.type?(0,O.jsxs)(X,{children:[(0,O.jsx)(T,{"data-testid":"stFileUploaderFileErrorMessage",children:t.status.errorMessage}),(0,O.jsx)(P,{children:(0,O.jsx)(N.Z,{content:se.j,size:"lg"})})]}):"uploaded"===t.status.type?(0,O.jsx)(W.x,{children:m(t.size,g.Byte)}):null},oe=e=>{let{fileInfo:t,onDelete:i}=e;return(0,O.jsxs)(k,{className:"stFileUploaderFile","data-testid":"stFileUploaderFile",children:[(0,O.jsx)(D,{children:(0,O.jsx)(N.Z,{content:le.h,size:"twoXL"})}),(0,O.jsxs)(Z,{className:"stFileUploaderFileData",children:[(0,O.jsx)(R,{className:"stFileUploaderFileName","data-testid":"stFileUploaderFileName",title:t.name,children:t.name}),(0,O.jsx)(re,{fileInfo:t})]}),(0,O.jsx)("div",{"data-testid":"stFileUploaderDeleteBtn",children:(0,O.jsx)(F.ZP,{onClick:()=>i(t.id),kind:S.nW.MINIMAL,children:(0,O.jsx)(N.Z,{content:ne.U,size:"lg"})})})]})},de=ie((e=>{let{items:t,onDelete:i}=e;return(0,O.jsx)(C,{children:t.map((e=>(0,O.jsx)(B,{children:(0,O.jsx)(oe,{fileInfo:e,onDelete:i})},e.id)))})})),pe=e=>(0,O.jsx)(L,{children:(0,O.jsx)(de,{...e})});var ce=i(77367);class ge extends o.PureComponent{constructor(e){super(e),this.formClearHelper=new p.K,this.localFileIdCounter=1,this.componentDidUpdate=()=>{if("ready"!==this.status)return;const e=this.createWidgetValue(),{element:t,widgetMgr:i,fragmentId:s}=this.props,l=i.getFileUploaderStateValue(t);n()(e,l)||i.setFileUploaderStateValue(t,e,{fromUi:!0},s)},this.reset=()=>{this.setState({files:[]})},this.dropHandler=(e,t)=>{const{element:i}=this.props,{multipleFiles:s}=i;if(!s&&0===e.length&&t.length>1){const i=t.findIndex((e=>1===e.errors.length&&"too-many-files"===e.errors[0].code));i>=0&&(e.push(t[i].file),t.splice(i,1))}if(this.props.uploadClient.fetchFileURLs(e).then((t=>{if(!s&&e.length>0){const e=this.state.files.find((e=>"error"!==e.status.type));e&&this.deleteFile(e.id)}r()(t,e).forEach((e=>{let[t,i]=e;this.uploadFile(t,i)}))})).catch((t=>{this.addFiles(e.map((e=>new ce.R(e.name,e.size,this.nextLocalFileId(),{type:"error",errorMessage:t}))))})),t.length>0){const e=t.map((e=>{const{file:t}=e;return new ce.R(t.name,t.size,this.nextLocalFileId(),{type:"error",errorMessage:this.getErrorMessage(e.errors[0].code,e.file)})}));this.addFiles(e)}},this.uploadFile=(e,t)=>{const i=s.Z.CancelToken.source(),l=new ce.R(t.name,t.size,this.nextLocalFileId(),{type:"uploading",cancelToken:i,progress:1});this.addFile(l),this.props.uploadClient.uploadFile(this.props.element,e.uploadUrl,t,(e=>this.onUploadProgress(e,l.id)),i.token).then((()=>this.onUploadComplete(l.id,e))).catch((e=>{s.Z.isCancel(e)||this.updateFile(l.id,l.setStatus({type:"error",errorMessage:e?e.toString():"Unknown error"}))}))},this.onUploadComplete=(e,t)=>{const i=this.getFile(e);null!=i&&"uploading"===i.status.type&&this.updateFile(i.id,i.setStatus({type:"uploaded",fileId:t.fileId,fileUrls:t}))},this.getErrorMessage=(e,t)=>{switch(e){case"file-too-large":return"File must be ".concat(m(this.maxUploadSizeInBytes,g.Byte)," or smaller.");case"file-invalid-type":return"".concat(t.type," files are not allowed.");case"file-too-small":return"File size is too small.";case"too-many-files":return"Only one file is allowed.";default:return"Unexpected error. Please try again."}},this.deleteFile=e=>{const t=this.getFile(e);null!=t&&("uploading"===t.status.type&&t.status.cancelToken.cancel(),"uploaded"===t.status.type&&t.status.fileUrls.deleteUrl&&this.props.uploadClient.deleteFile(t.status.fileUrls.deleteUrl),this.removeFile(e))},this.addFile=e=>{this.setState((t=>({files:[...t.files,e]})))},this.addFiles=e=>{this.setState((t=>({files:[...t.files,...e]})))},this.removeFile=e=>{this.setState((t=>({files:t.files.filter((t=>t.id!==e))})))},this.getFile=e=>this.state.files.find((t=>t.id===e)),this.updateFile=(e,t)=>{this.setState((i=>({files:i.files.map((i=>i.id===e?t:i))})))},this.onUploadProgress=(e,t)=>{const i=this.getFile(t);if(null==i||"uploading"!==i.status.type)return;const s=Math.round(100*e.loaded/e.total);i.status.progress!==s&&this.updateFile(t,i.setStatus({type:"uploading",cancelToken:i.status.cancelToken,progress:s}))},this.onFormCleared=()=>{this.setState({files:[]},(()=>{const e=this.createWidgetValue();if(null==e)return;const{widgetMgr:t,element:i,fragmentId:s}=this.props;t.setFileUploaderStateValue(i,e,{fromUi:!0},s)}))},this.state=this.initialValue}get initialValue(){const e={files:[],newestServerFileId:0},{widgetMgr:t,element:i}=this.props,s=t.getFileUploaderStateValue(i);if(null==s)return e;const{uploadedFileInfo:l}=s;return null==l||0===l.length?e:{files:l.map((e=>{const t=e.name,i=e.size,s=e.fileId,l=e.fileUrls;return new ce.R(t,i,this.nextLocalFileId(),{type:"uploaded",fileId:s,fileUrls:l})}))}}componentWillUnmount(){this.formClearHelper.disconnect()}get maxUploadSizeInBytes(){return((e,t,i)=>{if(e<0)throw Error("Size must be 0 or greater");const s=u.findIndex((e=>e===t)),l=u.findIndex((e=>e===i));if(-1===s||-1===l)throw Error("Unexpected byte unit provided");if(s===l)return e;const n=Math.abs(s-l),a=h**n;return s>l?e/a:e*a})(this.props.element.maxUploadSizeMb,g.Megabyte,g.Byte)}get status(){return this.state.files.some((e=>"uploading"===e.status.type))?"updating":"ready"}componentDidMount(){const e=this.createWidgetValue(),{element:t,widgetMgr:i,fragmentId:s}=this.props;void 0===i.getFileUploaderStateValue(t)&&i.setFileUploaderStateValue(t,e,{fromUi:!1},s)}createWidgetValue(){const e=this.state.files.filter((e=>"uploaded"===e.status.type)).map((e=>{const{name:t,size:i,status:s}=e,{fileId:l,fileUrls:n}=s;return new d.jM({fileId:l,fileUrls:n,name:t,size:i})}));return new d.xO({uploadedFileInfo:e})}render(){var e;const{files:t}=this.state,{element:i,disabled:s,widgetMgr:l}=this.props,n=i.type;this.formClearHelper.manageFormClearListener(l,i.formId,this.onFormCleared);const a=t.slice().reverse();return(0,O.jsxs)(A,{"data-testid":"stFileUploader",children:[(0,O.jsx)(f.O,{label:i.label,disabled:s,labelVisibility:(0,c.iF)(null===(e=i.labelVisibility)||void 0===e?void 0:e.value),children:i.help&&(0,O.jsx)(x.dT,{children:(0,O.jsx)(w.Z,{content:i.help,placement:y.u.TOP_RIGHT})})}),(0,O.jsx)(_,{onDrop:this.dropHandler,multiple:i.multipleFiles,acceptedExtensions:n,maxSizeBytes:this.maxUploadSizeInBytes,label:i.label,disabled:s}),a.length>0&&(0,O.jsx)(pe,{items:a,pageSize:3,onDelete:this.deleteFile,resetOnAdd:!0})]})}nextLocalFileId(){return this.localFileIdCounter++}}const he=ge},87814:(e,t,i)=>{i.d(t,{K:()=>l});var s=i(50641);class l{constructor(){this.formClearListener=void 0,this.lastWidgetMgr=void 0,this.lastFormId=void 0}manageFormClearListener(e,t,i){null!=this.formClearListener&&this.lastWidgetMgr===e&&this.lastFormId===t||(this.disconnect(),(0,s.bM)(t)&&(this.formClearListener=e.addFormClearedListener(t,i),this.lastWidgetMgr=e,this.lastFormId=t))}disconnect(){var e;null===(e=this.formClearListener)||void 0===e||e.disconnect(),this.formClearListener=void 0,this.lastWidgetMgr=void 0,this.lastFormId=void 0}}}}]);
|
1
|
+
"use strict";(self.webpackChunk_streamlit_app=self.webpackChunk_streamlit_app||[]).push([[4666],{90186:(e,t,i)=>{i.d(t,{$:()=>p,Z:()=>c});var s=i(66845),n=i(25621),l=i(66694),a=i(92627),r=i(38570),o=i(80318),d=i(40864);let p;!function(e){e.EXTRASMALL="xs",e.SMALL="sm",e.MEDIUM="md",e.LARGE="lg",e.EXTRALARGE="xl"}(p||(p={}));const c=function(e){let{value:t,width:i,size:c=p.SMALL,overrides:g}=e;const h=(0,n.u)(),u={xs:h.spacing.twoXS,sm:h.spacing.sm,md:h.spacing.lg,lg:h.spacing.xl,xl:h.spacing.twoXL},{activeTheme:m}=s.useContext(l.E),f=!(0,a.MJ)(m),x={BarContainer:{style:{marginTop:h.spacing.none,marginBottom:h.spacing.none,marginRight:h.spacing.none,marginLeft:h.spacing.none}},Bar:{style:e=>{let{$theme:t}=e;return{width:i?i.toString():void 0,marginTop:h.spacing.none,marginBottom:h.spacing.none,marginRight:h.spacing.none,marginLeft:h.spacing.none,height:u[c],backgroundColor:t.colors.progressbarTrackFill,borderTopLeftRadius:h.spacing.twoXS,borderTopRightRadius:h.spacing.twoXS,borderBottomLeftRadius:h.spacing.twoXS,borderBottomRightRadius:h.spacing.twoXS}}},BarProgress:{style:()=>({backgroundColor:f?h.colors.primary:h.colors.blue70,borderTopLeftRadius:h.spacing.twoXS,borderTopRightRadius:h.spacing.twoXS,borderBottomLeftRadius:h.spacing.twoXS,borderBottomRightRadius:h.spacing.twoXS})}};return(0,d.jsx)(r.Z,{value:t,overrides:(0,o.aO)(x,g)})}},77367:(e,t,i)=>{i.d(t,{R:()=>s});class s{setStatus(e){return new s(this.name,this.size,this.id,e)}constructor(e,t,i,s){this.name=void 0,this.size=void 0,this.status=void 0,this.id=void 0,this.name=e,this.size=t,this.id=i,this.status=s}}},14666:(e,t,i)=>{i.r(t),i.d(t,{default:()=>he});var s=i(18080),n=i(62813),l=i.n(n),a=i(84693),r=i.n(a),o=i(66845),d=i(16295),p=i(87814),c=i(50641);let g;!function(e){e.Gigabyte="gb",e.Megabyte="mb",e.Kilobyte="kb",e.Byte="b"}(g||(g={}));const h=(0,c.rA)()?1024:1e3,u=[g.Gigabyte,g.Megabyte,g.Kilobyte,g.Byte],m=function(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;if(t||(t=g.Byte),i<0&&(i=0),e<0)throw new Error("Size must be greater than or equal to 0");const s=u.indexOf(t);return s&&e>h/2?m(e/h,u[s-1],i):"".concat(e.toFixed(i)).concat(t.toUpperCase())};var f=i(98478),x=i(86659),w=i(8879),y=i(68411),b=i(51622),F=i(9003),S=i(81354),v=i(1515);const j=(0,v.Z)("section",{target:"e1b2p2ww15"})((e=>{let{isDisabled:t,theme:i}=e;return{display:"flex",alignItems:"center",padding:i.spacing.lg,backgroundColor:i.colors.secondaryBg,borderRadius:i.radii.lg,":focus":{outline:"none"},":focus-visible":{boxShadow:"0 0 0 1px ".concat(i.colors.primary)},color:t?i.colors.gray:i.colors.bodyText}}),""),I=(0,v.Z)("div",{target:"e1b2p2ww14"})((()=>({marginRight:"auto",alignItems:"center",display:"flex"})),""),U=(0,v.Z)("span",{target:"e1b2p2ww13"})((e=>{let{theme:t}=e;return{color:t.colors.darkenedBgMix100,marginRight:t.spacing.lg}}),""),M=(0,v.Z)("span",{target:"e1b2p2ww12"})((e=>{let{theme:t}=e;return{marginBottom:t.spacing.twoXS}}),""),z=(0,v.Z)("div",{target:"e1b2p2ww11"})({name:"1fttcpj",styles:"display:flex;flex-direction:column"}),L=(0,v.Z)("div",{target:"e1b2p2ww10"})((e=>{let{theme:t}=e;return{left:0,right:0,lineHeight:t.lineHeights.tight,paddingTop:t.spacing.md,paddingLeft:t.spacing.lg,paddingRight:t.spacing.lg}}),""),C=(0,v.Z)("ul",{target:"e1b2p2ww9"})((()=>({listStyleType:"none",marginBottom:0})),""),B=(0,v.Z)("li",{target:"e1b2p2ww8"})((e=>{let{theme:t}=e;return{margin:t.spacing.none,padding:t.spacing.none}}),""),Z=(0,v.Z)("div",{target:"e1b2p2ww7"})((e=>{let{theme:t}=e;return{display:"flex",alignItems:"baseline",flex:1,paddingLeft:t.spacing.lg,overflow:"hidden"}}),""),R=(0,v.Z)("div",{target:"e1b2p2ww6"})((e=>{let{theme:t}=e;return{marginRight:t.spacing.sm,marginBottom:t.spacing.twoXS,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}}),""),k=(0,v.Z)("div",{target:"e1b2p2ww5"})((e=>{let{theme:t}=e;return{display:"flex",alignItems:"center",marginBottom:t.spacing.twoXS}}),""),T=(0,v.Z)("span",{target:"e1b2p2ww4"})((e=>{let{theme:t}=e;return{marginRight:t.spacing.twoXS}}),""),D=(0,v.Z)("div",{target:"e1b2p2ww3"})((e=>{let{theme:t}=e;return{display:"flex",padding:t.spacing.twoXS,color:t.colors.darkenedBgMix100}}),""),X=(0,v.Z)("small",{target:"e1b2p2ww2"})((e=>{let{theme:t}=e;return{color:t.colors.danger,fontSize:t.fontSizes.sm,height:t.fontSizes.sm,lineHeight:t.fontSizes.sm,display:"flex",alignItems:"center",whiteSpace:"nowrap"}}),""),P=(0,v.Z)("span",{target:"e1b2p2ww1"})({name:"0",styles:""}),E=e=>({[j]:{display:"flex",flexDirection:"column",alignItems:"flex-start"},[I]:{marginBottom:e.spacing.lg},[U]:{display:"none"},[L]:{paddingRight:e.spacing.lg},[k]:{maxWidth:"inherit",flex:1,alignItems:"flex-start",marginBottom:e.spacing.sm},[R]:{width:e.sizes.full},[Z]:{flexDirection:"column"},[X]:{height:"auto",whiteSpace:"initial"},[P]:{display:"none"},[B]:{margin:e.spacing.none,padding:e.spacing.none}}),A=(0,v.Z)("div",{target:"e1b2p2ww0"})((e=>{let{theme:t}=e;return t.inSidebar?E(t):{["@media (max-width: ".concat(t.breakpoints.sm,")")]:E(t)}}),"");var V=i(74529),N=i(46927),W=i(33746),O=i(40864);const H=e=>{let{multiple:t,acceptedExtensions:i,maxSizeBytes:s}=e;return(0,O.jsxs)(I,{"data-testid":"stFileUploaderDropzoneInstructions",children:[(0,O.jsx)(U,{children:(0,O.jsx)(N.Z,{content:V.n,size:"threeXL"})}),(0,O.jsxs)(z,{children:[(0,O.jsxs)(M,{children:["Drag and drop file",t?"s":""," here"]}),(0,O.jsxs)(W.x,{children:["Limit ".concat(m(s,g.Byte,0)," per file"),i.length?" \u2022 ".concat(i.map((e=>e.replace(/^\./,"").toUpperCase())).join(", ")):null]})]})]})},_=e=>{let{onDrop:t,multiple:i,acceptedExtensions:s,maxSizeBytes:n,disabled:l,label:a}=e;return(0,O.jsx)(b.ZP,{onDrop:t,multiple:i,accept:s.length?s:void 0,maxSize:n,disabled:l,useFsAccessApi:!1,children:e=>{let{getRootProps:t,getInputProps:r}=e;return(0,O.jsxs)(j,{...t(),"data-testid":"stFileUploaderDropzone",isDisabled:l,"aria-label":a,children:[(0,O.jsx)("input",{"data-testid":"stFileUploaderDropzoneInput",...r()}),(0,O.jsx)(H,{multiple:i,acceptedExtensions:s,maxSizeBytes:n}),(0,O.jsx)(F.ZP,{kind:S.nW.SECONDARY,disabled:l,size:S.V5.SMALL,children:"Browse files"})]})}})};var G=i(13005),K=i.n(G),$=i(30351),q=i(14609);const J=(0,v.Z)("div",{target:"e16k0npc1"})((e=>{let{theme:t}=e;return{display:"flex",alignItems:"center",justifyContent:"space-between",paddingBottom:t.spacing.twoXS,marginBottom:t.spacing.twoXS}}),""),Y=(0,v.Z)("div",{target:"e16k0npc0"})((e=>{let{theme:t}=e;return{display:"flex",alignItems:"center",justifyContent:"center",color:t.colors.fadedText40}}),""),Q=e=>{let{className:t,currentPage:i,totalPages:s,onNext:n,onPrevious:l}=e;return(0,O.jsxs)(J,{className:t,"data-testid":"stPagination",children:[(0,O.jsx)(W.x,{children:"Showing page ".concat(i," of ").concat(s)}),(0,O.jsxs)(Y,{children:[(0,O.jsx)(F.ZP,{onClick:l,kind:S.nW.MINIMAL,children:(0,O.jsx)(N.Z,{content:$.s,size:"xl"})}),(0,O.jsx)(F.ZP,{onClick:n,kind:S.nW.MINIMAL,children:(0,O.jsx)(N.Z,{content:q._,size:"xl"})})]})]})};var ee=i(88235);const te=(e,t)=>Math.ceil(e.length/t),ie=e=>K()((t=>{let{pageSize:i,items:s,resetOnAdd:n,...l}=t;const[a,r]=(0,o.useState)(0),[d,p]=(0,o.useState)(te(s,i)),c=(0,ee.D)(s);(0,o.useEffect)((()=>{c&&c.length!==s.length&&p(te(s,i)),c&&c.length<s.length?n&&r(0):a+1>=d&&r(d-1)}),[s,a,i,c,n,d]);const g=s.slice(a*i,a*i+i);return(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(e,{items:g,...l}),s.length>i?(0,O.jsx)(Q,{className:"streamlit-paginator",pageSize:i,totalPages:d,currentPage:a+1,onNext:()=>{r(Math.min(a+1,d-1))},onPrevious:()=>{r(Math.max(0,a-1))}}):null]})}),e);var se=i(62288),ne=i(87847),le=i(31197),ae=i(90186);const re=e=>{let{fileInfo:t}=e;return"uploading"===t.status.type?(0,O.jsx)(ae.Z,{value:t.status.progress,size:ae.$.SMALL,overrides:{Bar:{style:{marginLeft:0,marginTop:"4px"}}}}):"error"===t.status.type?(0,O.jsxs)(X,{children:[(0,O.jsx)(T,{"data-testid":"stFileUploaderFileErrorMessage",children:t.status.errorMessage}),(0,O.jsx)(P,{children:(0,O.jsx)(N.Z,{content:se.j,size:"lg"})})]}):"uploaded"===t.status.type?(0,O.jsx)(W.x,{children:m(t.size,g.Byte)}):null},oe=e=>{let{fileInfo:t,onDelete:i}=e;return(0,O.jsxs)(k,{className:"stFileUploaderFile","data-testid":"stFileUploaderFile",children:[(0,O.jsx)(D,{children:(0,O.jsx)(N.Z,{content:ne.h,size:"twoXL"})}),(0,O.jsxs)(Z,{className:"stFileUploaderFileData",children:[(0,O.jsx)(R,{className:"stFileUploaderFileName","data-testid":"stFileUploaderFileName",title:t.name,children:t.name}),(0,O.jsx)(re,{fileInfo:t})]}),(0,O.jsx)("div",{"data-testid":"stFileUploaderDeleteBtn",children:(0,O.jsx)(F.ZP,{onClick:()=>i(t.id),kind:S.nW.MINIMAL,children:(0,O.jsx)(N.Z,{content:le.U,size:"lg"})})})]})},de=ie((e=>{let{items:t,onDelete:i}=e;return(0,O.jsx)(C,{children:t.map((e=>(0,O.jsx)(B,{children:(0,O.jsx)(oe,{fileInfo:e,onDelete:i})},e.id)))})})),pe=e=>(0,O.jsx)(L,{children:(0,O.jsx)(de,{...e})});var ce=i(77367);class ge extends o.PureComponent{constructor(e){super(e),this.formClearHelper=new p.K,this.localFileIdCounter=1,this.forceUpdatingStatus=!1,this.componentDidUpdate=()=>{if("ready"!==this.status)return;const e=this.createWidgetValue(),{element:t,widgetMgr:i,fragmentId:s}=this.props,n=i.getFileUploaderStateValue(t);l()(e,n)||i.setFileUploaderStateValue(t,e,{fromUi:!0},s)},this.reset=()=>{this.setState({files:[]})},this.dropHandler=(e,t)=>{const{element:i}=this.props,{multipleFiles:s}=i;if(!s&&0===e.length&&t.length>1){const i=t.findIndex((e=>1===e.errors.length&&"too-many-files"===e.errors[0].code));i>=0&&(e.push(t[i].file),t.splice(i,1))}if(this.props.uploadClient.fetchFileURLs(e).then((t=>{if(!s&&e.length>0){const e=this.state.files.find((e=>"error"!==e.status.type));e&&(this.forceUpdatingStatus=!0,this.deleteFile(e.id),this.forceUpdatingStatus=!1)}r()(t,e).forEach((e=>{let[t,i]=e;this.uploadFile(t,i)}))})).catch((t=>{this.addFiles(e.map((e=>new ce.R(e.name,e.size,this.nextLocalFileId(),{type:"error",errorMessage:t}))))})),t.length>0){const e=t.map((e=>{const{file:t}=e;return new ce.R(t.name,t.size,this.nextLocalFileId(),{type:"error",errorMessage:this.getErrorMessage(e.errors[0].code,e.file)})}));this.addFiles(e)}},this.uploadFile=(e,t)=>{const i=s.Z.CancelToken.source(),n=new ce.R(t.name,t.size,this.nextLocalFileId(),{type:"uploading",cancelToken:i,progress:1});this.addFile(n),this.props.uploadClient.uploadFile(this.props.element,e.uploadUrl,t,(e=>this.onUploadProgress(e,n.id)),i.token).then((()=>this.onUploadComplete(n.id,e))).catch((e=>{s.Z.isCancel(e)||this.updateFile(n.id,n.setStatus({type:"error",errorMessage:e?e.toString():"Unknown error"}))}))},this.onUploadComplete=(e,t)=>{const i=this.getFile(e);null!=i&&"uploading"===i.status.type&&this.updateFile(i.id,i.setStatus({type:"uploaded",fileId:t.fileId,fileUrls:t}))},this.getErrorMessage=(e,t)=>{switch(e){case"file-too-large":return"File must be ".concat(m(this.maxUploadSizeInBytes,g.Byte)," or smaller.");case"file-invalid-type":return"".concat(t.type," files are not allowed.");case"file-too-small":return"File size is too small.";case"too-many-files":return"Only one file is allowed.";default:return"Unexpected error. Please try again."}},this.deleteFile=e=>{const t=this.getFile(e);null!=t&&("uploading"===t.status.type&&t.status.cancelToken.cancel(),"uploaded"===t.status.type&&t.status.fileUrls.deleteUrl&&this.props.uploadClient.deleteFile(t.status.fileUrls.deleteUrl),this.removeFile(e))},this.addFile=e=>{this.setState((t=>({files:[...t.files,e]})))},this.addFiles=e=>{this.setState((t=>({files:[...t.files,...e]})))},this.removeFile=e=>{this.setState((t=>({files:t.files.filter((t=>t.id!==e))})))},this.getFile=e=>this.state.files.find((t=>t.id===e)),this.updateFile=(e,t)=>{this.setState((i=>({files:i.files.map((i=>i.id===e?t:i))})))},this.onUploadProgress=(e,t)=>{const i=this.getFile(t);if(null==i||"uploading"!==i.status.type)return;const s=Math.round(100*e.loaded/e.total);i.status.progress!==s&&this.updateFile(t,i.setStatus({type:"uploading",cancelToken:i.status.cancelToken,progress:s}))},this.onFormCleared=()=>{this.setState({files:[]},(()=>{const e=this.createWidgetValue();if(null==e)return;const{widgetMgr:t,element:i,fragmentId:s}=this.props;t.setFileUploaderStateValue(i,e,{fromUi:!0},s)}))},this.state=this.initialValue}get initialValue(){const e={files:[],newestServerFileId:0},{widgetMgr:t,element:i}=this.props,s=t.getFileUploaderStateValue(i);if(null==s)return e;const{uploadedFileInfo:n}=s;return null==n||0===n.length?e:{files:n.map((e=>{const t=e.name,i=e.size,s=e.fileId,n=e.fileUrls;return new ce.R(t,i,this.nextLocalFileId(),{type:"uploaded",fileId:s,fileUrls:n})}))}}componentWillUnmount(){this.formClearHelper.disconnect()}get maxUploadSizeInBytes(){return((e,t,i)=>{if(e<0)throw Error("Size must be 0 or greater");const s=u.findIndex((e=>e===t)),n=u.findIndex((e=>e===i));if(-1===s||-1===n)throw Error("Unexpected byte unit provided");if(s===n)return e;const l=Math.abs(s-n),a=h**l;return s>n?e/a:e*a})(this.props.element.maxUploadSizeMb,g.Megabyte,g.Byte)}get status(){return this.state.files.some((e=>"uploading"===e.status.type))||this.forceUpdatingStatus?"updating":"ready"}componentDidMount(){const e=this.createWidgetValue(),{element:t,widgetMgr:i,fragmentId:s}=this.props;void 0===i.getFileUploaderStateValue(t)&&i.setFileUploaderStateValue(t,e,{fromUi:!1},s)}createWidgetValue(){const e=this.state.files.filter((e=>"uploaded"===e.status.type)).map((e=>{const{name:t,size:i,status:s}=e,{fileId:n,fileUrls:l}=s;return new d.jM({fileId:n,fileUrls:l,name:t,size:i})}));return new d.xO({uploadedFileInfo:e})}render(){var e;const{files:t}=this.state,{element:i,disabled:s,widgetMgr:n}=this.props,l=i.type;this.formClearHelper.manageFormClearListener(n,i.formId,this.onFormCleared);const a=t.slice().reverse();return(0,O.jsxs)(A,{"data-testid":"stFileUploader",children:[(0,O.jsx)(f.O,{label:i.label,disabled:s,labelVisibility:(0,c.iF)(null===(e=i.labelVisibility)||void 0===e?void 0:e.value),children:i.help&&(0,O.jsx)(x.dT,{children:(0,O.jsx)(w.Z,{content:i.help,placement:y.u.TOP_RIGHT})})}),(0,O.jsx)(_,{onDrop:this.dropHandler,multiple:i.multipleFiles,acceptedExtensions:l,maxSizeBytes:this.maxUploadSizeInBytes,label:i.label,disabled:s}),a.length>0&&(0,O.jsx)(pe,{items:a,pageSize:3,onDelete:this.deleteFile,resetOnAdd:!0})]})}nextLocalFileId(){return this.localFileIdCounter++}}const he=ge},87814:(e,t,i)=>{i.d(t,{K:()=>n});var s=i(50641);class n{constructor(){this.formClearListener=void 0,this.lastWidgetMgr=void 0,this.lastFormId=void 0}manageFormClearListener(e,t,i){null!=this.formClearListener&&this.lastWidgetMgr===e&&this.lastFormId===t||(this.disconnect(),(0,s.bM)(t)&&(this.formClearListener=e.addFormClearedListener(t,i),this.lastWidgetMgr=e,this.lastFormId=t))}disconnect(){var e;null===(e=this.formClearListener)||void 0===e||e.disconnect(),this.formClearListener=void 0,this.lastWidgetMgr=void 0,this.lastFormId=void 0}}}}]);
|
@@ -0,0 +1 @@
|
|
1
|
+
"use strict";(self.webpackChunk_streamlit_app=self.webpackChunk_streamlit_app||[]).push([[8427],{18427:(e,t,o)=>{o.r(t),o.d(t,{default:()=>b});var i=o(66845),r=o(25621),s=o(69021),n=o(92627),a=o(21e3),l=o(59033),d=o(36989),c=o(1515);const g=(0,c.Z)("button",{target:"elibz2u3"})((e=>{let{theme:t}=e;return{fontSize:t.fontSizes.sm,lineHeight:"1.4rem",color:t.colors.fadedText60,backgroundColor:t.colors.transparent,border:"none",boxShadow:"none",padding:"0px","&:hover, &:active, &:focus":{border:"none",outline:"none",boxShadow:"none"},"&:hover":{color:t.colors.primary}}}),""),p=(0,c.Z)("div",{target:"elibz2u2"})((e=>{let{theme:t}=e;return{display:"flex",flexDirection:"row",gap:t.spacing.lg}}),""),u=(0,c.Z)("div",{target:"elibz2u1"})((e=>{let{theme:t}=e;return{fontSize:t.fontSizes.xl}}),""),h=(0,c.Z)("div",{target:"elibz2u0"})((e=>{let{theme:t}=e;return{display:"flex",flexDirection:"column",gap:t.spacing.sm,alignItems:"start",justifyContent:"center",overflow:"hidden",minHeight:"100%",fontSize:t.fontSizes.sm,lineHeight:t.lineHeights.base}}),"");var f=o(40864);const b=(0,r.b)((function(e){let{theme:t,body:o,icon:r,width:c}=e;const b=function(e){if(e.length>109){let t=e.replace(/^(.{109}[^\s]*).*/,"$1");return t.length>109&&(t=t.substring(0,109).split(" ").slice(0,-1).join(" ")),t.trim()}return e}(o),m=o!==b,[x,w]=(0,i.useState)(!m),[y,S]=(0,i.useState)(0),v=(0,i.useCallback)((()=>{w(!x)}),[x]),z=(0,i.useMemo)((()=>function(e){const t=(0,n.Iy)(e);return{Body:{props:{"data-testid":"stToast"},style:{display:"flex",flexDirection:"row",gap:e.spacing.md,width:e.sizes.sidebar,marginTop:"8px",borderTopLeftRadius:e.radii.lg,borderTopRightRadius:e.radii.lg,borderBottomLeftRadius:e.radii.lg,borderBottomRightRadius:e.radii.lg,paddingTop:e.spacing.lg,paddingBottom:e.spacing.lg,paddingLeft:e.spacing.twoXL,paddingRight:e.spacing.twoXL,backgroundColor:t?e.colors.gray10:e.colors.gray90,color:e.colors.bodyText,boxShadow:t?"0px 4px 16px rgba(0, 0, 0, 0.16)":"0px 4px 16px rgba(0, 0, 0, 0.7)"}},CloseIcon:{style:{color:e.colors.fadedText40,width:e.fontSizes.lg,height:e.fontSizes.lg,marginRight:"calc(-1 * ".concat(e.spacing.lg," / 2)"),":hover":{color:e.colors.bodyText}}}}}(t)),[t]),R=(0,i.useMemo)((()=>(0,f.jsx)(f.Fragment,{children:(0,f.jsxs)(p,{expanded:x,children:[(0,f.jsx)(u,{children:r}),(0,f.jsxs)(h,{children:[(0,f.jsx)(a.ZP,{source:x?o:b,allowHTML:!1,isToast:!0}),m&&(0,f.jsx)(g,{"data-testid":"toastViewButton",className:"toastViewButton",onClick:v,children:x?"view less":"view more"})]})]})})),[m,x,o,r,b,v]);(0,i.useEffect)((()=>{if(t.inSidebar)return;const e=s.Z.info(R,{overrides:{...z}});return S(e),()=>{s.Z.update(e,{overrides:{Body:{style:{transitionDuration:0}}}}),s.Z.clear(e)}}),[]),(0,i.useEffect)((()=>{s.Z.update(y,{children:R,overrides:{...z}})}),[y,R,z]);const T=(0,f.jsx)(d.Z,{kind:l.h.ERROR,body:"Streamlit API Error: `st.toast` cannot be called directly on the sidebar with `st.sidebar.toast`. See our `st.toast` API [docs](https://docs.streamlit.io/library/api-reference/status/st.toast) for more information.",width:c});return(0,f.jsx)(f.Fragment,{children:t.inSidebar&&T})}))}}]);
|