streamlit-nightly 1.33.1.dev20240415__py2.py3-none-any.whl → 1.33.1.dev20240417__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.
Files changed (45) hide show
  1. streamlit/components/v1/custom_component.py +2 -0
  2. streamlit/delta_generator.py +0 -5
  3. streamlit/elements/__init__.py +0 -57
  4. streamlit/elements/arrow_vega_lite.py +8 -1
  5. streamlit/elements/form.py +5 -1
  6. streamlit/elements/lib/column_types.py +2 -2
  7. streamlit/elements/spinner.py +16 -30
  8. streamlit/elements/utils.py +36 -1
  9. streamlit/elements/widgets/button.py +21 -2
  10. streamlit/elements/widgets/camera_input.py +3 -0
  11. streamlit/elements/widgets/chat.py +8 -1
  12. streamlit/elements/widgets/checkbox.py +3 -1
  13. streamlit/elements/widgets/color_picker.py +3 -0
  14. streamlit/elements/widgets/data_editor.py +10 -1
  15. streamlit/elements/widgets/file_uploader.py +3 -0
  16. streamlit/elements/widgets/multiselect.py +4 -1
  17. streamlit/elements/widgets/number_input.py +3 -0
  18. streamlit/elements/widgets/radio.py +4 -0
  19. streamlit/elements/widgets/select_slider.py +4 -0
  20. streamlit/elements/widgets/selectbox.py +3 -1
  21. streamlit/elements/widgets/slider.py +3 -1
  22. streamlit/elements/widgets/text_widgets.py +4 -2
  23. streamlit/elements/widgets/time_widgets.py +4 -1
  24. streamlit/runtime/caching/__init__.py +1 -19
  25. streamlit/runtime/caching/cache_errors.py +0 -38
  26. streamlit/runtime/caching/cached_message_replay.py +27 -69
  27. streamlit/runtime/fragment.py +1 -1
  28. streamlit/runtime/legacy_caching/__init__.py +2 -12
  29. streamlit/runtime/legacy_caching/caching.py +1 -80
  30. streamlit/runtime/scriptrunner/script_run_context.py +4 -0
  31. streamlit/static/asset-manifest.json +4 -4
  32. streamlit/static/index.html +1 -1
  33. streamlit/static/static/js/3092.152fd2b7.chunk.js +1 -0
  34. streamlit/static/static/js/43.05a14cc7.chunk.js +1 -0
  35. streamlit/static/static/js/{main.4a20073e.js → main.f215a056.js} +2 -2
  36. streamlit/type_util.py +11 -0
  37. {streamlit_nightly-1.33.1.dev20240415.dist-info → streamlit_nightly-1.33.1.dev20240417.dist-info}/METADATA +1 -1
  38. {streamlit_nightly-1.33.1.dev20240415.dist-info → streamlit_nightly-1.33.1.dev20240417.dist-info}/RECORD +43 -43
  39. streamlit/static/static/js/3092.ad569cc8.chunk.js +0 -1
  40. streamlit/static/static/js/43.9ae03282.chunk.js +0 -1
  41. /streamlit/static/static/js/{main.4a20073e.js.LICENSE.txt → main.f215a056.js.LICENSE.txt} +0 -0
  42. {streamlit_nightly-1.33.1.dev20240415.data → streamlit_nightly-1.33.1.dev20240417.data}/scripts/streamlit.cmd +0 -0
  43. {streamlit_nightly-1.33.1.dev20240415.dist-info → streamlit_nightly-1.33.1.dev20240417.dist-info}/WHEEL +0 -0
  44. {streamlit_nightly-1.33.1.dev20240415.dist-info → streamlit_nightly-1.33.1.dev20240417.dist-info}/entry_points.txt +0 -0
  45. {streamlit_nightly-1.33.1.dev20240415.dist-info → streamlit_nightly-1.33.1.dev20240417.dist-info}/top_level.txt +0 -0
@@ -96,44 +96,6 @@ class CacheError(Exception):
96
96
  pass
97
97
 
98
98
 
99
- class CachedStFunctionWarning(StreamlitAPIWarning):
100
- def __init__(
101
- self,
102
- cache_type: CacheType,
103
- st_func_name: str,
104
- cached_func: types.FunctionType,
105
- ):
106
- args = {
107
- "st_func_name": f"`st.{st_func_name}()`",
108
- "func_name": self._get_cached_func_name_md(cached_func),
109
- "decorator_name": get_decorator_api_name(cache_type),
110
- }
111
-
112
- msg = (
113
- """
114
- Your script uses %(st_func_name)s to write to your Streamlit app from within
115
- some cached code at %(func_name)s. This code will only be called when we detect
116
- a cache "miss", which can lead to unexpected results.
117
-
118
- How to fix this:
119
- * Move the %(st_func_name)s call outside %(func_name)s.
120
- * Or, if you know what you're doing, use `@st.%(decorator_name)s(experimental_allow_widgets=True)`
121
- to enable widget replay and suppress this warning.
122
- """
123
- % args
124
- ).strip("\n")
125
-
126
- super().__init__(msg)
127
-
128
- @staticmethod
129
- def _get_cached_func_name_md(func: types.FunctionType) -> str:
130
- """Get markdown representation of the function name."""
131
- if hasattr(func, "__name__"):
132
- return "`%s()`" % func.__name__
133
- else:
134
- return "a cached function"
135
-
136
-
137
99
  class CacheReplayClosureError(StreamlitAPIException):
138
100
  def __init__(
139
101
  self,
@@ -33,13 +33,9 @@ from google.protobuf.message import Message
33
33
 
34
34
  import streamlit as st
35
35
  from streamlit import runtime, util
36
- from streamlit.elements import NONWIDGET_ELEMENTS, WIDGETS
37
36
  from streamlit.logger import get_logger
38
37
  from streamlit.proto.Block_pb2 import Block
39
- from streamlit.runtime.caching.cache_errors import (
40
- CachedStFunctionWarning,
41
- CacheReplayClosureError,
42
- )
38
+ from streamlit.runtime.caching.cache_errors import CacheReplayClosureError
43
39
  from streamlit.runtime.caching.cache_type import CacheType
44
40
  from streamlit.runtime.caching.hashing import update_hash
45
41
  from streamlit.runtime.scriptrunner.script_run_context import (
@@ -120,10 +116,10 @@ cache keys act as one true cache key, just split up because the second part depe
120
116
  on the first.
121
117
 
122
118
  We need to treat widgets as implicit arguments of the cached function, because
123
- the behavior of the function, inluding what elements are created and what it
119
+ the behavior of the function, including what elements are created and what it
124
120
  returns, can be and usually will be influenced by the values of those widgets.
125
121
  For example:
126
- > @st.memo
122
+ > @st.cache_data
127
123
  > def example_fn(x):
128
124
  > y = x + 1
129
125
  > if st.checkbox("hi"):
@@ -239,15 +235,13 @@ class CachedMessageReplayContext(threading.local):
239
235
  """
240
236
 
241
237
  def __init__(self, cache_type: CacheType):
242
- self._cached_func_stack: list[types.FunctionType] = []
243
- self._suppress_st_function_warning = 0
244
238
  self._cached_message_stack: list[list[MsgData]] = []
245
239
  self._seen_dg_stack: list[set[str]] = []
246
240
  self._most_recent_messages: list[MsgData] = []
247
241
  self._registered_metadata: WidgetMetadata[Any] | None = None
248
242
  self._media_data: list[MediaMsgData] = []
249
243
  self._cache_type = cache_type
250
- self._allow_widgets: int = 0
244
+ self._allow_widgets: bool = False
251
245
 
252
246
  def __repr__(self) -> str:
253
247
  return util.repr_(self)
@@ -260,19 +254,36 @@ class CachedMessageReplayContext(threading.local):
260
254
  It allows us to track any `st.foo` messages that are generated from inside the function
261
255
  for playback during cache retrieval.
262
256
  """
263
- self._cached_func_stack.append(func)
264
257
  self._cached_message_stack.append([])
265
258
  self._seen_dg_stack.append(set())
266
- if allow_widgets:
267
- self._allow_widgets += 1
259
+ self._allow_widgets = allow_widgets
260
+
261
+ nested_call = False
262
+ ctx = get_script_run_ctx()
263
+ if ctx:
264
+ if ctx.disallow_cached_widget_usage:
265
+ # The disallow_cached_widget_usage is already set to true.
266
+ # This indicates that this cached function run is called from another
267
+ # cached function that disallows widget usage.
268
+ # We need to deactivate the widget usage for this cached function run
269
+ # even if it was allowed.
270
+ self._allow_widgets = False
271
+ nested_call = True
272
+
273
+ if not self._allow_widgets:
274
+ # If we're in a cached function that disallows widget usage, we need to set
275
+ # the disallow_cached_widget_usage to true for this cached function run
276
+ # to prevent widget usage (triggers a warning).
277
+ ctx.disallow_cached_widget_usage = True
268
278
  try:
269
279
  yield
270
280
  finally:
271
- self._cached_func_stack.pop()
272
281
  self._most_recent_messages = self._cached_message_stack.pop()
273
282
  self._seen_dg_stack.pop()
274
- if allow_widgets:
275
- self._allow_widgets -= 1
283
+ if ctx and not nested_call:
284
+ # Reset the disallow_cached_widget_usage flag. But only if this
285
+ # is not nested inside a cached function that disallows widget usage.
286
+ ctx.disallow_cached_widget_usage = False
276
287
 
277
288
  def save_element_message(
278
289
  self,
@@ -365,59 +376,6 @@ class CachedMessageReplayContext(threading.local):
365
376
  ) -> None:
366
377
  self._media_data.append(MediaMsgData(image_data, mimetype, image_id))
367
378
 
368
- @contextlib.contextmanager
369
- def suppress_cached_st_function_warning(self) -> Iterator[None]:
370
- self._suppress_st_function_warning += 1
371
- try:
372
- yield
373
- finally:
374
- self._suppress_st_function_warning -= 1
375
- assert self._suppress_st_function_warning >= 0
376
-
377
- def maybe_show_cached_st_function_warning(
378
- self,
379
- dg: DeltaGenerator,
380
- st_func_name: str,
381
- ) -> None:
382
- """If appropriate, warn about calling st.foo inside @memo.
383
-
384
- DeltaGenerator's @_with_element and @_widget wrappers use this to warn
385
- the user when they're calling st.foo() from within a function that is
386
- wrapped in @st.cache.
387
-
388
- Parameters
389
- ----------
390
- dg : DeltaGenerator
391
- The DeltaGenerator to publish the warning to.
392
-
393
- st_func_name : str
394
- The name of the Streamlit function that was called.
395
-
396
- """
397
- # There are some elements not in either list, which we still want to warn about.
398
- # Ideally we will fix this by either updating the lists or creating a better
399
- # way of categorizing elements.
400
- if st_func_name in NONWIDGET_ELEMENTS:
401
- return
402
- if st_func_name in WIDGETS and self._allow_widgets > 0:
403
- return
404
-
405
- if len(self._cached_func_stack) > 0 and self._suppress_st_function_warning <= 0:
406
- cached_func = self._cached_func_stack[-1]
407
- self._show_cached_st_function_warning(dg, st_func_name, cached_func)
408
-
409
- def _show_cached_st_function_warning(
410
- self,
411
- dg: DeltaGenerator,
412
- st_func_name: str,
413
- cached_func: types.FunctionType,
414
- ) -> None:
415
- # Avoid infinite recursion by suppressing additional cached
416
- # function warnings from within the cached function warning.
417
- with self.suppress_cached_st_function_warning():
418
- e = CachedStFunctionWarning(self._cache_type, st_func_name, cached_func)
419
- dg.exception(e)
420
-
421
379
 
422
380
  def replay_cached_messages(
423
381
  result: CachedResult, cache_type: CacheType, cached_func: types.FunctionType
@@ -140,7 +140,7 @@ def fragment(
140
140
  with each fragment rerun, until the next full-script rerun.
141
141
 
142
142
  Calling `st.sidebar` in a fragment is not supported. To write elements to
143
- the sidebar with a fragment, call your fragment funciton inside a
143
+ the sidebar with a fragment, call your fragment function inside a
144
144
  `with st.sidebar` context manager.
145
145
 
146
146
  Fragment code can interact with Session State, imported modules, and
@@ -12,16 +12,6 @@
12
12
  # See the License for the specific language governing permissions and
13
13
  # limitations under the License.
14
14
 
15
- from streamlit.runtime.legacy_caching.caching import (
16
- cache,
17
- clear_cache,
18
- get_cache_path,
19
- maybe_show_cached_st_function_warning,
20
- )
15
+ from streamlit.runtime.legacy_caching.caching import cache, clear_cache, get_cache_path
21
16
 
22
- __all__ = [
23
- "cache",
24
- "clear_cache",
25
- "get_cache_path",
26
- "maybe_show_cached_st_function_warning",
27
- ]
17
+ __all__ = ["cache", "clear_cache", "get_cache_path"]
@@ -236,7 +236,6 @@ _mem_caches = _MemCaches()
236
236
  class ThreadLocalCacheInfo(threading.local):
237
237
  def __init__(self):
238
238
  self.cached_func_stack: list[Callable[..., Any]] = []
239
- self.suppress_st_function_warning = 0
240
239
 
241
240
  def __repr__(self) -> str:
242
241
  return util.repr_(self)
@@ -254,54 +253,6 @@ def _calling_cached_function(func: Callable[..., Any]) -> Iterator[None]:
254
253
  _cache_info.cached_func_stack.pop()
255
254
 
256
255
 
257
- @contextlib.contextmanager
258
- def suppress_cached_st_function_warning() -> Iterator[None]:
259
- _cache_info.suppress_st_function_warning += 1
260
- try:
261
- yield
262
- finally:
263
- _cache_info.suppress_st_function_warning -= 1
264
- assert _cache_info.suppress_st_function_warning >= 0
265
-
266
-
267
- def _show_cached_st_function_warning(
268
- dg: st.delta_generator.DeltaGenerator,
269
- st_func_name: str,
270
- cached_func: Callable[..., Any],
271
- ) -> None:
272
- # Avoid infinite recursion by suppressing additional cached
273
- # function warnings from within the cached function warning.
274
- with suppress_cached_st_function_warning():
275
- e = CachedStFunctionWarning(st_func_name, cached_func)
276
- dg.exception(e)
277
-
278
-
279
- def maybe_show_cached_st_function_warning(
280
- dg: st.delta_generator.DeltaGenerator, st_func_name: str
281
- ) -> None:
282
- """If appropriate, warn about calling st.foo inside @cache.
283
-
284
- DeltaGenerator's @_with_element and @_widget wrappers use this to warn
285
- the user when they're calling st.foo() from within a function that is
286
- wrapped in @st.cache.
287
-
288
- Parameters
289
- ----------
290
- dg : DeltaGenerator
291
- The DeltaGenerator to publish the warning to.
292
-
293
- st_func_name : str
294
- The name of the Streamlit function that was called.
295
-
296
- """
297
- if (
298
- len(_cache_info.cached_func_stack) > 0
299
- and _cache_info.suppress_st_function_warning <= 0
300
- ):
301
- cached_func = _cache_info.cached_func_stack[-1]
302
- _show_cached_st_function_warning(dg, st_func_name, cached_func)
303
-
304
-
305
256
  def _read_from_mem_cache(
306
257
  mem_cache: MemCache,
307
258
  key: str,
@@ -683,11 +634,7 @@ def cache(
683
634
  _LOGGER.debug("Cache miss: %s", non_optional_func)
684
635
 
685
636
  with _calling_cached_function(non_optional_func):
686
- if suppress_st_warning:
687
- with suppress_cached_st_function_warning():
688
- return_value = non_optional_func(*args, **kwargs)
689
- else:
690
- return_value = non_optional_func(*args, **kwargs)
637
+ return_value = non_optional_func(*args, **kwargs)
691
638
 
692
639
  _write_to_cache(
693
640
  mem_cache=mem_cache,
@@ -826,32 +773,6 @@ class CachedObjectMutationError(ValueError):
826
773
  return util.repr_(self)
827
774
 
828
775
 
829
- class CachedStFunctionWarning(StreamlitAPIWarning):
830
- def __init__(self, st_func_name, cached_func):
831
- msg = self._get_message(st_func_name, cached_func)
832
- super().__init__(msg)
833
-
834
- def _get_message(self, st_func_name, cached_func):
835
- args = {
836
- "st_func_name": "`st.%s()` or `st.write()`" % st_func_name,
837
- "func_name": _get_cached_func_name_md(cached_func),
838
- }
839
-
840
- return (
841
- """
842
- Your script uses %(st_func_name)s to write to your Streamlit app from within
843
- some cached code at %(func_name)s. This code will only be called when we detect
844
- a cache "miss", which can lead to unexpected results.
845
-
846
- How to fix this:
847
- * Move the %(st_func_name)s call outside %(func_name)s.
848
- * Or, if you know what you're doing, use `@st.cache(suppress_st_warning=True)`
849
- to suppress the warning.
850
- """
851
- % args
852
- ).strip("\n")
853
-
854
-
855
776
  class CachedObjectMutationWarning(StreamlitAPIWarning):
856
777
  def __init__(self, orig_exc):
857
778
  msg = self._get_message(orig_exc)
@@ -79,6 +79,9 @@ class ScriptRunContext:
79
79
  fragment_ids_this_run: set[str] | None = None
80
80
  # we allow only one dialog to be open at the same time
81
81
  has_dialog_opened: bool = False
82
+ # If true, it indicates that we are in a cached function that disallows
83
+ # the usage of widgets.
84
+ disallow_cached_widget_usage: bool = False
82
85
 
83
86
  # TODO(willhuang1997): Remove this variable when experimental query params are removed
84
87
  _experimental_query_params_used = False
@@ -105,6 +108,7 @@ class ScriptRunContext:
105
108
  self.current_fragment_id = None
106
109
  self.fragment_ids_this_run = fragment_ids_this_run
107
110
  self.has_dialog_opened = False
111
+ self.disallow_cached_widget_usage = False
108
112
 
109
113
  parsed_query_params = parse.parse_qs(query_string, keep_blank_values=True)
110
114
  with self.session_state.query_params() as qp:
@@ -1,15 +1,15 @@
1
1
  {
2
2
  "files": {
3
3
  "main.css": "./static/css/main.bf304093.css",
4
- "main.js": "./static/js/main.4a20073e.js",
4
+ "main.js": "./static/js/main.f215a056.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",
8
8
  "static/js/3301.1d1b10bb.chunk.js": "./static/js/3301.1d1b10bb.chunk.js",
9
9
  "static/css/3092.95a45cfe.chunk.css": "./static/css/3092.95a45cfe.chunk.css",
10
- "static/js/3092.ad569cc8.chunk.js": "./static/js/3092.ad569cc8.chunk.js",
10
+ "static/js/3092.152fd2b7.chunk.js": "./static/js/3092.152fd2b7.chunk.js",
11
11
  "static/css/43.e3b876c5.chunk.css": "./static/css/43.e3b876c5.chunk.css",
12
- "static/js/43.9ae03282.chunk.js": "./static/js/43.9ae03282.chunk.js",
12
+ "static/js/43.05a14cc7.chunk.js": "./static/js/43.05a14cc7.chunk.js",
13
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.935c68ec.chunk.js": "./static/js/4185.935c68ec.chunk.js",
@@ -152,6 +152,6 @@
152
152
  },
153
153
  "entrypoints": [
154
154
  "static/css/main.bf304093.css",
155
- "static/js/main.4a20073e.js"
155
+ "static/js/main.f215a056.js"
156
156
  ]
157
157
  }
@@ -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.4a20073e.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
+ <!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.f215a056.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>
@@ -0,0 +1 @@
1
+ "use strict";(self.webpackChunk_streamlit_app=self.webpackChunk_streamlit_app||[]).push([[3092],{49839:(e,t,n)=>{n.r(t),n.d(t,{default:()=>Nt});var i=n(66845),o=n(67930),a=n(6998),r=n(17330),l=n(57463),s=n(97943),d=n(41342),c=n(17875),u=n(87814),m=n(62622),h=n(16295),p=n(50641),g=n(25621),f=n(34367),b=n(31011),v=n(21e3),y=n(68411),w=n(9003),x=n(81354),C=n(46927),E=n(1515),M=n(92627);const T=(0,E.Z)("div",{target:"e2wxzia1"})((e=>{let{theme:t,locked:n,target:i}=e;return{padding:"0.5rem 0 0.5rem 0.5rem",position:"absolute",top:n?"-2.4rem":"-1rem",right:t.spacing.none,transition:"none",...!n&&{opacity:0,"&:active, &:focus-visible, &:hover":{transition:"opacity 150ms 100ms, top 100ms 100ms",opacity:1,top:"-2.4rem"},...i&&{["".concat(i,":hover &, ").concat(i,":active &, ").concat(i,":focus-visible &")]:{transition:"opacity 150ms 100ms, top 100ms 100ms",opacity:1,top:"-2.4rem"}}}}}),""),k=(0,E.Z)("div",{target:"e2wxzia0"})((e=>{let{theme:t}=e;return{color:(0,M.Iy)(t)?t.colors.fadedText60:t.colors.bodyText,display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"flex-end",boxShadow:"1px 2px 8px rgba(0, 0, 0, 0.08)",borderRadius:t.radii.lg,backgroundColor:t.colors.lightenedBg05,width:"fit-content",zIndex:t.zIndices.sidebar+1}}),"");var R=n(40864);function N(e){let{label:t,show_label:n,icon:i,onClick:o}=e;const a=(0,g.u)(),r=n?t:"";return(0,R.jsx)("div",{"data-testid":"stElementToolbarButton",children:(0,R.jsx)(y.Z,{content:(0,R.jsx)(v.ZP,{source:t,allowHTML:!1,style:{fontSize:a.fontSizes.sm}}),placement:y.u.TOP,onMouseEnterDelay:1e3,inline:!0,children:(0,R.jsxs)(w.ZP,{onClick:e=>{o&&o(),e.stopPropagation()},kind:x.nW.ELEMENT_TOOLBAR,children:[i&&(0,R.jsx)(C.Z,{content:i,size:"md",testid:"stElementToolbarButtonIcon"}),r&&(0,R.jsx)("span",{children:r})]})})})}const S=e=>{let{onExpand:t,onCollapse:n,isFullScreen:i,locked:o,children:a,target:r,disableFullscreenMode:l}=e;return(0,R.jsx)(T,{className:"stElementToolbar","data-testid":"stElementToolbar",locked:o||i,target:r,children:(0,R.jsxs)(k,{children:[a,t&&!l&&!i&&(0,R.jsx)(N,{label:"Fullscreen",icon:f.i,onClick:()=>t()}),n&&!l&&i&&(0,R.jsx)(N,{label:"Close fullscreen",icon:b.m,onClick:()=>n()})]})})};var _=n(38145),I=n.n(_),O=n(96825),D=n.n(O),F=n(29724),A=n.n(F),H=n(52347),z=n(53608),V=n.n(z),j=(n(87717),n(55842),n(28391));const L=["true","t","yes","y","on","1"],W=["false","f","no","n","off","0"];function B(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";return e="\u26a0\ufe0f ".concat(e),{kind:o.p6.Text,readonly:!0,allowOverlay:!0,data:e+(t?"\n\n".concat(t,"\n"):""),displayData:e,isError:!0}}function Y(e){return e.hasOwnProperty("isError")&&e.isError}function P(e){return e.hasOwnProperty("isMissingValue")&&e.isMissingValue}function Z(){return arguments.length>0&&void 0!==arguments[0]&&arguments[0]?{kind:o.p6.Loading,allowOverlay:!1,isMissingValue:!0}:{kind:o.p6.Loading,allowOverlay:!1}}function q(e,t){const n=t?"faded":"normal";return{kind:o.p6.Text,data:"",displayData:"",allowOverlay:!0,readonly:e,style:n}}function J(e){return{id:e.id,title:e.title,hasMenu:!1,themeOverride:e.themeOverride,icon:e.icon,...e.isStretched&&{grow:e.isIndex?1:3},...e.width&&{width:e.width}}}function U(e,t){return(0,p.le)(e)?t||{}:(0,p.le)(t)?e||{}:D()(e,t)}function K(e){if((0,p.le)(e))return[];if("number"===typeof e||"boolean"===typeof e)return[e];if("string"===typeof e){if(""===e)return[];if(!e.trim().startsWith("[")||!e.trim().endsWith("]"))return e.split(",");try{return JSON.parse(e)}catch(t){return[e]}}try{const t=JSON.parse(JSON.stringify(e,((e,t)=>"bigint"===typeof t?Number(t):t)));return Array.isArray(t)?t.map((e=>["string","number","boolean","null"].includes(typeof e)?e:G(e))):[G(t)]}catch(t){return[G(e)]}}function G(e){try{try{return I()(e)}catch(t){return JSON.stringify(e,((e,t)=>"bigint"===typeof t?Number(t):t))}}catch(t){return"[".concat(typeof e,"]")}}function X(e){if((0,p.le)(e))return null;if("boolean"===typeof e)return e;const t=G(e).toLowerCase().trim();return""===t?null:!!L.includes(t)||!W.includes(t)&&void 0}function Q(e){if((0,p.le)(e))return null;if(Array.isArray(e))return NaN;if("string"===typeof e){if(0===e.trim().length)return null;try{const t=A().unformat(e.trim());if((0,p.bb)(t))return t}catch(t){}}else if(e instanceof Int32Array)return Number(e[0]);return Number(e)}function $(e,t,n){return Number.isNaN(e)||!Number.isFinite(e)?"":(0,p.le)(t)||""===t?(0===n&&(e=Math.round(e)),A()(e).format((0,p.bb)(n)?"0,0.".concat("0".repeat(n)):"0,0.[0000]")):"percent"===t?new Intl.NumberFormat(void 0,{style:"percent",minimumFractionDigits:2,maximumFractionDigits:2}).format(e):["compact","scientific","engineering"].includes(t)?new Intl.NumberFormat(void 0,{notation:t}).format(e):"duration[ns]"===t?V().duration(e/1e6,"milliseconds").humanize():t.startsWith("period[")?j.fu.formatPeriodType(BigInt(e),t):(0,H.sprintf)(t,e)}function ee(e,t){return"locale"===t?new Intl.DateTimeFormat(void 0,{dateStyle:"medium",timeStyle:"medium"}).format(e.toDate()):"distance"===t?e.fromNow():"relative"===t?e.calendar():e.format(t)}function te(e){if((0,p.le)(e))return null;if(e instanceof Date)return isNaN(e.getTime())?void 0:e;if("string"===typeof e&&0===e.trim().length)return null;try{const t=Number(e);if(!isNaN(t)){let e=t;t>=10**18?e=t/1e3**3:t>=10**15?e=t/1e6:t>=10**12&&(e=t/1e3);const n=V().unix(e).utc();if(n.isValid())return n.toDate()}if("string"===typeof e){const t=V().utc(e);if(t.isValid())return t.toDate();const n=V().utc(e,[V().HTML5_FMT.TIME_MS,V().HTML5_FMT.TIME_SECONDS,V().HTML5_FMT.TIME]);if(n.isValid())return n.toDate()}}catch(t){return}}function ne(e){if(e%1===0)return 0;let t=e.toString();return-1!==t.indexOf("e")&&(t=e.toLocaleString("fullwide",{useGrouping:!1,maximumFractionDigits:20})),-1===t.indexOf(".")?0:t.split(".")[1].length}const ie=new RegExp(/(\r\n|\n|\r)/gm);function oe(e){return-1!==e.indexOf("\n")?e.replace(ie," "):e}var ae=n(23849);function re(e){const t={kind:o.p6.Text,data:"",displayData:"",allowOverlay:!0,contentAlignment:e.contentAlignment,readonly:!0,style:e.isIndex?"faded":"normal"};return{...e,kind:"object",sortMode:"default",isEditable:!1,getCell(e){try{const n=(0,p.bb)(e)?G(e):null,i=(0,p.bb)(n)?oe(n):"";return{...t,data:n,displayData:i,isMissingValue:(0,p.le)(e)}}catch(n){return B(G(e),"The value cannot be interpreted as a string. Error: ".concat(n))}},getCellValue:e=>void 0===e.data?null:e.data}}re.isEditableType=!1;const le=re;function se(e){const t=e.columnTypeOptions||{};let n;if(t.validate)try{n=new RegExp(t.validate,"us")}catch(r){n="Invalid validate regex: ".concat(t.validate,".\nError: ").concat(r)}const i={kind:o.p6.Text,data:"",displayData:"",allowOverlay:!0,contentAlignment:e.contentAlignment,readonly:!e.isEditable,style:e.isIndex?"faded":"normal"},a=i=>{if((0,p.le)(i))return!e.isRequired;let o=G(i),a=!1;return t.max_chars&&o.length>t.max_chars&&(o=o.slice(0,t.max_chars),a=!0),!(n instanceof RegExp&&!1===n.test(o))&&(!a||o)};return{...e,kind:"text",sortMode:"default",validateInput:a,getCell(e,t){if("string"===typeof n)return B(G(e),n);if(t){const t=a(e);if(!1===t)return B(G(e),"Invalid input.");"string"===typeof t&&(e=t)}try{const t=(0,p.bb)(e)?G(e):null,n=(0,p.bb)(t)?oe(t):"";return{...i,isMissingValue:(0,p.le)(t),data:t,displayData:n}}catch(r){return B("Incompatible value","The value cannot be interpreted as string. Error: ".concat(r))}},getCellValue:e=>void 0===e.data?null:e.data}}se.isEditableType=!0;const de=se;function ce(e,t){return e=t.startsWith("+")||t.startsWith("-")?e.utcOffset(t,!1):e.tz(t)}function ue(e,t,n,i,a,r,l){var s;const d=U({format:n,step:i,timezone:l},t.columnTypeOptions);let c,u,m;if((0,p.bb)(d.timezone))try{var h;c=(null===(h=ce(V()(),d.timezone))||void 0===h?void 0:h.utcOffset())||void 0}catch(b){}(0,p.bb)(d.min_value)&&(u=te(d.min_value)||void 0),(0,p.bb)(d.max_value)&&(m=te(d.max_value)||void 0);const g={kind:o.p6.Custom,allowOverlay:!0,copyData:"",readonly:!t.isEditable,contentAlign:t.contentAlignment,style:t.isIndex?"faded":"normal",data:{kind:"date-picker-cell",date:void 0,displayDate:"",step:(null===(s=d.step)||void 0===s?void 0:s.toString())||"1",format:a,min:u,max:m}},f=e=>{const n=te(e);return null===n?!t.isRequired:void 0!==n&&(!((0,p.bb)(u)&&r(n)<r(u))&&!((0,p.bb)(m)&&r(n)>r(m)))};return{...t,kind:e,sortMode:"default",validateInput:f,getCell(e,t){if(!0===t){const t=f(e);if(!1===t)return B(G(e),"Invalid input.");t instanceof Date&&(e=t)}const i=te(e);let o="",a="",r=c;if(void 0===i)return B(G(e),"The value cannot be interpreted as a datetime object.");if(null!==i){let e=V().utc(i);if(!e.isValid())return B(G(i),"This should never happen. Please report this bug. \nError: ".concat(e.toString()));if(d.timezone){try{e=ce(e,d.timezone)}catch(b){return B(e.toISOString(),"Failed to adjust to the provided timezone: ".concat(d.timezone,". \nError: ").concat(b))}r=e.utcOffset()}try{a=ee(e,d.format||n)}catch(b){return B(e.toISOString(),"Failed to format the date for rendering with: ".concat(d.format,". \nError: ").concat(b))}o=ee(e,n)}return{...g,copyData:o,isMissingValue:(0,p.le)(i),data:{...g.data,date:i,displayDate:a,timezoneOffset:r}}},getCellValue(e){var t;return(0,p.le)(null===e||void 0===e||null===(t=e.data)||void 0===t?void 0:t.date)?null:r(e.data.date)}}}function me(e){var t,n,i,o,a;let r="YYYY-MM-DD HH:mm:ss";(null===(t=e.columnTypeOptions)||void 0===t?void 0:t.step)>=60?r="YYYY-MM-DD HH:mm":(null===(n=e.columnTypeOptions)||void 0===n?void 0:n.step)<1&&(r="YYYY-MM-DD HH:mm:ss.SSS");const l=null===(i=e.arrowType)||void 0===i||null===(o=i.meta)||void 0===o?void 0:o.timezone,s=(0,p.bb)(l)||(0,p.bb)(null===e||void 0===e||null===(a=e.columnTypeOptions)||void 0===a?void 0:a.timezone);return ue("datetime",e,s?r+"Z":r,1,"datetime-local",(e=>s?e.toISOString():e.toISOString().replace("Z","")),l)}function he(e){var t,n;let i="HH:mm:ss";return(null===(t=e.columnTypeOptions)||void 0===t?void 0:t.step)>=60?i="HH:mm":(null===(n=e.columnTypeOptions)||void 0===n?void 0:n.step)<1&&(i="HH:mm:ss.SSS"),ue("time",e,i,1,"time",(e=>e.toISOString().split("T")[1].replace("Z","")))}function pe(e){return ue("date",e,"YYYY-MM-DD",1,"date",(e=>e.toISOString().split("T")[0]))}function ge(e){const t={kind:o.p6.Boolean,data:!1,allowOverlay:!1,contentAlign:e.contentAlignment,readonly:!e.isEditable,style:e.isIndex?"faded":"normal"};return{...e,kind:"checkbox",sortMode:"default",getCell(e){let n=null;return n=X(e),void 0===n?B(G(e),"The value cannot be interpreted as boolean."):{...t,data:n,isMissingValue:(0,p.le)(n)}},getCellValue:e=>void 0===e.data?null:e.data}}me.isEditableType=!0,he.isEditableType=!0,pe.isEditableType=!0,ge.isEditableType=!0;const fe=ge;function be(e){return e.startsWith("int")&&!e.startsWith("interval")||"range"===e||e.startsWith("uint")}function ve(e){const t=j.fu.getTypeName(e.arrowType);let n;"timedelta64[ns]"===t?n="duration[ns]":t.startsWith("period[")&&(n=t);const i=U({step:be(t)?1:void 0,min_value:t.startsWith("uint")?0:void 0,format:n},e.columnTypeOptions),a=(0,p.le)(i.min_value)||i.min_value<0,r=(0,p.bb)(i.step)&&!Number.isNaN(i.step)?ne(i.step):void 0,l={kind:o.p6.Number,data:void 0,displayData:"",readonly:!e.isEditable,allowOverlay:!0,contentAlign:e.contentAlignment||"right",style:e.isIndex?"faded":"normal",allowNegative:a,fixedDecimals:r},s=t=>{let n=Q(t);if((0,p.le)(n))return!e.isRequired;if(Number.isNaN(n))return!1;let o=!1;return(0,p.bb)(i.max_value)&&n>i.max_value&&(n=i.max_value,o=!0),!((0,p.bb)(i.min_value)&&n<i.min_value)&&(!o||n)};return{...e,kind:"number",sortMode:"smart",validateInput:s,getCell(e,t){if(!0===t){const t=s(e);if(!1===t)return B(G(e),"Invalid input.");"number"===typeof t&&(e=t)}let n=Q(e),o="";if((0,p.bb)(n)){if(Number.isNaN(n))return B(G(e),"The value cannot be interpreted as a number.");if((0,p.bb)(r)&&(a=n,n=0===(d=r)?Math.trunc(a):Math.trunc(a*10**d)/10**d),Number.isInteger(n)&&!Number.isSafeInteger(n))return B(G(e),"The value is larger than the maximum supported integer values in number columns (2^53).");try{o=$(n,i.format,r)}catch(c){return B(G(n),(0,p.bb)(i.format)?"Failed to format the number based on the provided format configuration: (".concat(i.format,"). Error: ").concat(c):"Failed to format the number. Error: ".concat(c))}}var a,d;return{...l,data:n,displayData:o,isMissingValue:(0,p.le)(n)}},getCellValue:e=>void 0===e.data?null:e.data}}ve.isEditableType=!0;const ye=ve;function we(e){let t="string";const n=U({options:"bool"===j.fu.getTypeName(e.arrowType)?[!0,!1]:[]},e.columnTypeOptions),i=new Set(n.options.map((e=>typeof e)));1===i.size&&(i.has("number")||i.has("bigint")?t="number":i.has("boolean")&&(t="boolean"));const a={kind:o.p6.Custom,allowOverlay:!0,copyData:"",contentAlign:e.contentAlignment,readonly:!e.isEditable,data:{kind:"dropdown-cell",allowedValues:[...!0!==e.isRequired?[null]:[],...n.options.filter((e=>null!==e&&""!==e)).map((e=>G(e)))],value:"",readonly:!e.isEditable}};return{...e,kind:"selectbox",sortMode:"default",getCell(e,t){let n=null;return(0,p.bb)(e)&&""!==e&&(n=G(e)),t&&!a.data.allowedValues.includes(n)?B(G(n),"The value is not part of the allowed options."):{...a,isMissingValue:null===n,copyData:n||"",data:{...a.data,value:n}}},getCellValue(e){var n,i,o,a,r,l,s;return(0,p.le)(null===(n=e.data)||void 0===n?void 0:n.value)||""===(null===(i=e.data)||void 0===i?void 0:i.value)?null:"number"===t?null!==(a=Q(null===(r=e.data)||void 0===r?void 0:r.value))&&void 0!==a?a:null:"boolean"===t?null!==(l=X(null===(s=e.data)||void 0===s?void 0:s.value))&&void 0!==l?l:null:null===(o=e.data)||void 0===o?void 0:o.value}}}we.isEditableType=!0;const xe=we;function Ce(e){const t={kind:o.p6.Bubble,data:[],allowOverlay:!0,contentAlign:e.contentAlignment,style:e.isIndex?"faded":"normal"};return{...e,kind:"list",sortMode:"default",isEditable:!1,getCell(e){const n=(0,p.le)(e)?[]:K(e);return{...t,data:n,isMissingValue:(0,p.le)(e),copyData:(0,p.le)(e)?"":G(n.map((e=>"string"===typeof e&&e.includes(",")?e.replace(/,/g," "):e)))}},getCellValue:e=>(0,p.le)(e.data)||P(e)?null:e.data}}Ce.isEditableType=!1;const Ee=Ce;function Me(e,t,n){const i=new RegExp("".concat(e,"[,\\s].*{(?:[^}]*[\\s;]{1})?").concat(t,":\\s*([^;}]+)[;]?.*}"),"gm");n=n.replace(/{/g," {");const o=i.exec(n);if(o)return o[1].trim()}function Te(e,t){const n=e.types.index[t],i=e.indexNames[t];let o=!0;return"range"===j.fu.getTypeName(n)&&(o=!1),{id:"index-".concat(t),name:i,title:i,isEditable:o,arrowType:n,isIndex:!0,isHidden:!1}}function ke(e,t){const n=e.columns[0][t];let i,o=e.types.data[t];if((0,p.le)(o)&&(o={meta:null,numpy_type:"object",pandas_type:"object"}),"categorical"===j.fu.getTypeName(o)){const n=e.getCategoricalOptions(t);(0,p.bb)(n)&&(i={options:n})}return{id:"column-".concat(n,"-").concat(t),name:n,title:n,isEditable:!0,arrowType:o,columnTypeOptions:i,isIndex:!1,isHidden:!1}}function Re(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0;const i=e.arrowType?j.fu.getTypeName(e.arrowType):null;let a;if("object"===e.kind)a=e.getCell((0,p.bb)(t.content)?oe(j.fu.format(t.content,t.contentType,t.field)):null);else if(["time","date","datetime"].includes(e.kind)&&(0,p.bb)(t.content)&&("number"===typeof t.content||"bigint"===typeof t.content)){var r,l;let n;var s,d,c;if("time"===i&&(0,p.bb)(null===(r=t.field)||void 0===r||null===(l=r.type)||void 0===l?void 0:l.unit))n=V().unix(j.fu.convertToSeconds(t.content,null!==(s=null===(d=t.field)||void 0===d||null===(c=d.type)||void 0===c?void 0:c.unit)&&void 0!==s?s:0)).utc().toDate();else n=V().utc(Number(t.content)).toDate();a=e.getCell(n)}else if("decimal"===i){const n=(0,p.le)(t.content)?null:j.fu.format(t.content,t.contentType,t.field);a=e.getCell(n)}else a=e.getCell(t.content);if(Y(a))return a;if(!e.isEditable){if((0,p.bb)(t.displayContent)){var u;const e=oe(t.displayContent);a.kind===o.p6.Text||a.kind===o.p6.Number||a.kind===o.p6.Uri?a={...a,displayData:e}:a.kind===o.p6.Custom&&"date-picker-cell"===(null===(u=a.data)||void 0===u?void 0:u.kind)&&(a={...a,data:{...a.data,displayDate:e}})}n&&t.cssId&&(a=function(e,t,n){const i={},o=Me(t,"color",n);o&&(i.textDark=o);const a=Me(t,"background-color",n);return a&&(i.bgCell=a),"yellow"===a&&void 0===o&&(i.textDark="#31333F"),i?{...e,themeOverride:i}:e}(a,t.cssId,n))}return a}function Ne(e){const t=e.columnTypeOptions||{};let n,i;if(t.validate)try{n=new RegExp(t.validate,"us")}catch(l){n="Invalid validate regex: ".concat(t.validate,".\nError: ").concat(l)}if(!(0,p.le)(t.display_text)&&t.display_text.includes("(")&&t.display_text.includes(")"))try{i=new RegExp(t.display_text,"us")}catch(l){i=void 0}const a={kind:o.p6.Uri,readonly:!e.isEditable,allowOverlay:!0,contentAlign:e.contentAlignment,style:e.isIndex?"faded":"normal",hoverEffect:!0,data:"",displayData:"",copyData:""},r=i=>{if((0,p.le)(i))return!e.isRequired;const o=G(i);return!(t.max_chars&&o.length>t.max_chars)&&!(n instanceof RegExp&&!1===n.test(o))};return{...e,kind:"link",sortMode:"default",validateInput:r,getCell(e,o){if((0,p.le)(e))return{...a,data:null,isMissingValue:!0,onClickUri:()=>{}};const s=e;if("string"===typeof n)return B(G(s),n);if(o){if(!1===r(s))return B(G(s),"Invalid input.")}let d="";return s&&(d=void 0!==i?function(e,t){if((0,p.le)(t))return"";try{const n=t.match(e);return n&&void 0!==n[1]?decodeURI(n[1]):t}catch(l){return t}}(i,s):t.display_text||s),{...a,data:s,displayData:d,isMissingValue:(0,p.le)(s),onClickUri:e=>{window.open(s.startsWith("www.")?"https://".concat(s):s,"_blank","noopener,noreferrer"),e.preventDefault()},copyData:s}},getCellValue:e=>(0,p.le)(e.data)?null:e.data}}Ne.isEditableType=!0;const Se=Ne;function _e(e){const t={kind:o.p6.Image,data:[],displayData:[],readonly:!0,allowOverlay:!0,contentAlign:e.contentAlignment||"center",style:e.isIndex?"faded":"normal"};return{...e,kind:"image",sortMode:"default",isEditable:!1,getCell(e){const n=(0,p.bb)(e)?[G(e)]:[];return{...t,data:n,isMissingValue:!(0,p.bb)(e),displayData:n}},getCellValue:e=>void 0===e.data||0===e.data.length?null:e.data[0]}}_e.isEditableType=!1;const Ie=_e;function Oe(e){const t=be(j.fu.getTypeName(e.arrowType)),n=U({min_value:0,max_value:t?100:1,step:t?1:.01,format:t?"%3d%%":"percent"},e.columnTypeOptions);let i;try{i=$(n.max_value,n.format)}catch(l){i=G(n.max_value)}const a=(0,p.le)(n.step)||Number.isNaN(n.step)?void 0:ne(n.step),r={kind:o.p6.Custom,allowOverlay:!1,copyData:"",contentAlign:e.contentAlignment,data:{kind:"range-cell",min:n.min_value,max:n.max_value,step:n.step,value:n.min_value,label:String(n.min_value),measureLabel:i,readonly:!0}};return{...e,kind:"progress",sortMode:"smart",isEditable:!1,getCell(e){if((0,p.le)(e))return Z();if((0,p.le)(n.min_value)||(0,p.le)(n.max_value)||Number.isNaN(n.min_value)||Number.isNaN(n.max_value)||n.min_value>=n.max_value)return B("Invalid min/max parameters","The min_value (".concat(n.min_value,") and max_value (").concat(n.max_value,") parameters must be valid numbers."));if((0,p.le)(n.step)||Number.isNaN(n.step))return B("Invalid step parameter","The step parameter (".concat(n.step,") must be a valid number."));const t=Q(e);if(Number.isNaN(t)||(0,p.le)(t))return B(G(e),"The value cannot be interpreted as a number.");if(Number.isInteger(t)&&!Number.isSafeInteger(t))return B(G(e),"The value is larger than the maximum supported integer values in number columns (2^53).");let i="";try{i=$(t,n.format,a)}catch(l){return B(G(t),(0,p.bb)(n.format)?"Failed to format the number based on the provided format configuration: (".concat(n.format,"). Error: ").concat(l):"Failed to format the number. Error: ".concat(l))}const o=Math.min(n.max_value,Math.max(n.min_value,t));return{...r,isMissingValue:(0,p.le)(e),copyData:String(t),data:{...r.data,value:o,label:i}}},getCellValue(e){var t,n;return e.kind===o.p6.Loading||void 0===(null===(t=e.data)||void 0===t?void 0:t.value)?null:null===(n=e.data)||void 0===n?void 0:n.value}}}Oe.isEditableType=!1;const De=Oe;function Fe(e,t,n){const i=U({y_min:0,y_max:1},t.columnTypeOptions),a={kind:o.p6.Custom,allowOverlay:!1,copyData:"",contentAlign:t.contentAlignment,data:{kind:"sparkline-cell",values:[],displayValues:[],graphKind:n,yAxis:[i.y_min,i.y_max]}};return{...t,kind:e,sortMode:"default",isEditable:!1,getCell(e){if((0,p.le)(i.y_min)||(0,p.le)(i.y_max)||Number.isNaN(i.y_min)||Number.isNaN(i.y_max)||i.y_min>=i.y_max)return B("Invalid min/max y-axis configuration","The y_min (".concat(i.y_min,") and y_max (").concat(i.y_max,") configuration options must be valid numbers."));if((0,p.le)(e))return Z();const t=K(e),n=[];let o=[];if(0===t.length)return Z();let r=Number.MIN_SAFE_INTEGER,l=Number.MAX_SAFE_INTEGER;for(let i=0;i<t.length;i++){const e=Q(t[i]);if(Number.isNaN(e)||(0,p.le)(e))return B(G(t),"The value cannot be interpreted as a numeric array. ".concat(G(e)," is not a number."));e>r&&(r=e),e<l&&(l=e),n.push(e)}return o=n.length>0&&(r>i.y_max||l<i.y_min)?n.map((e=>r-l===0?r>(i.y_max||1)?i.y_max||1:i.y_min||0:((i.y_max||1)-(i.y_min||0))*((e-l)/(r-l))+(i.y_min||0))):n,{...a,copyData:n.join(","),data:{...a.data,values:o,displayValues:n.map((e=>$(e)))},isMissingValue:(0,p.le)(e)}},getCellValue(e){var t,n;return e.kind===o.p6.Loading||void 0===(null===(t=e.data)||void 0===t?void 0:t.values)?null:null===(n=e.data)||void 0===n?void 0:n.values}}}function Ae(e){return Fe("line_chart",e,"line")}function He(e){return Fe("bar_chart",e,"bar")}function ze(e){return Fe("area_chart",e,"area")}Ae.isEditableType=!1,He.isEditableType=!1,ze.isEditableType=!1;const Ve=new Map(Object.entries({object:le,text:de,checkbox:fe,selectbox:xe,list:Ee,number:ye,link:Se,datetime:me,date:pe,time:he,line_chart:Ae,bar_chart:He,area_chart:ze,image:Ie,progress:De})),je=[],Le="_index",We="_pos:",Be={small:75,medium:200,large:400};function Ye(e){if(!(0,p.le)(e))return"number"===typeof e?e:e in Be?Be[e]:void 0}function Pe(e,t){if(!t)return e;let n;return t.has(e.name)&&e.name!==Le?n=t.get(e.name):t.has("".concat(We).concat(e.indexNumber))?n=t.get("".concat(We).concat(e.indexNumber)):e.isIndex&&t.has(Le)&&(n=t.get(Le)),n?D()({...e},{title:n.label,width:Ye(n.width),isEditable:(0,p.bb)(n.disabled)?!n.disabled:void 0,isHidden:n.hidden,isRequired:n.required,columnTypeOptions:n.type_config,contentAlignment:n.alignment,defaultValue:n.default,help:n.help}):e}function Ze(e){var t;const n=null===(t=e.columnTypeOptions)||void 0===t?void 0:t.type;let i;return(0,p.bb)(n)&&(Ve.has(n)?i=Ve.get(n):(0,ae.KE)("Unknown column type configured in column configuration: ".concat(n))),(0,p.le)(i)&&(i=function(e){let t=e?j.fu.getTypeName(e):null;return t?(t=t.toLowerCase().trim(),["unicode","empty"].includes(t)?de:["datetime","datetimetz"].includes(t)?me:"time"===t?he:"date"===t?pe:["object","bytes"].includes(t)?le:["bool"].includes(t)?fe:["int8","int16","int32","int64","uint8","uint16","uint32","uint64","float16","float32","float64","float96","float128","range","decimal"].includes(t)?ye:"categorical"===t?xe:t.startsWith("list")?Ee:le):le}(e.arrowType)),i}const qe=function(e,t,n){const o=(0,g.u)(),a=i.useMemo((()=>function(e){if(!e)return new Map;try{return new Map(Object.entries(JSON.parse(e)))}catch(t){return(0,ae.H)(t),new Map}}(e.columns)),[e.columns]),r=e.useContainerWidth||(0,p.bb)(e.width)&&e.width>0;return{columns:i.useMemo((()=>{let i=function(e){const t=[],{dimensions:n}=e,i=n.headerColumns,o=n.dataColumns;if(0===i&&0===o)return t.push({id:"empty-index",title:"",indexNumber:0,isEditable:!1,isIndex:!0}),t;for(let a=0;a<i;a++){const n={...Te(e,a),indexNumber:a};t.push(n)}for(let a=0;a<o;a++){const n={...ke(e,a),indexNumber:a+i};t.push(n)}return t}(t).map((t=>{let i={...t,...Pe(t,a),isStretched:r};const l=Ze(i);return(e.editingMode===h.Eh.EditingMode.READ_ONLY||n||!1===l.isEditableType)&&(i={...i,isEditable:!1}),e.editingMode!==h.Eh.EditingMode.READ_ONLY&&1==i.isEditable&&(i={...i,icon:"editable"},i.isRequired&&e.editingMode===h.Eh.EditingMode.DYNAMIC&&(i={...i,isHidden:!1})),l(i,o)})).filter((e=>!e.isHidden));if(e.columnOrder&&e.columnOrder.length>0){const t=[];i.forEach((e=>{e.isIndex&&t.push(e)})),e.columnOrder.forEach((e=>{const n=i.find((t=>t.name===e));n&&!n.isIndex&&t.push(n)})),i=t}return i.length>0?i:[le({id:"empty-index",title:"",indexNumber:0,isEditable:!1,isIndex:!0})]}),[t,a,r,n,e.editingMode,e.columnOrder,o])}};function Je(e){return e.isIndex?Le:(0,p.le)(e.name)?"":e.name}const Ue=class{constructor(e){this.editedCells=new Map,this.addedRows=[],this.deletedRows=[],this.numRows=0,this.numRows=e}toJson(e){const t=new Map;e.forEach((e=>{t.set(e.indexNumber,e)}));const n={edited_rows:{},added_rows:[],deleted_rows:[]};this.editedCells.forEach(((e,i,o)=>{const a={};e.forEach(((e,n,i)=>{const o=t.get(n);o&&(a[Je(o)]=o.getCellValue(e))})),n.edited_rows[i]=a})),this.addedRows.forEach((e=>{const i={};let o=!1;e.forEach(((e,n,a)=>{const r=t.get(n);if(r){const t=r.getCellValue(e);r.isRequired&&r.isEditable&&P(e)&&(o=!0),(0,p.bb)(t)&&(i[Je(r)]=t)}})),o||n.added_rows.push(i)})),n.deleted_rows=this.deletedRows;return JSON.stringify(n,((e,t)=>void 0===t?null:t))}fromJson(e,t){this.editedCells=new Map,this.addedRows=[],this.deletedRows=[];const n=JSON.parse(e),i=new Map;t.forEach((e=>{i.set(e.indexNumber,e)}));const o=new Map;t.forEach((e=>{o.set(Je(e),e)})),Object.keys(n.edited_rows).forEach((e=>{const t=Number(e),i=n.edited_rows[e];Object.keys(i).forEach((e=>{const n=i[e],a=o.get(e);if(a){const e=a.getCell(n);var r;if(e)this.editedCells.has(t)||this.editedCells.set(t,new Map),null===(r=this.editedCells.get(t))||void 0===r||r.set(a.indexNumber,e)}}))})),n.added_rows.forEach((e=>{const t=new Map;Object.keys(e).forEach((n=>{const i=e[n],a=o.get(n);if(a){const e=a.getCell(i);e&&t.set(a.indexNumber,e)}})),this.addedRows.push(t)})),this.deletedRows=n.deleted_rows}isAddedRow(e){return e>=this.numRows}getCell(e,t){if(this.isAddedRow(t))return this.addedRows[t-this.numRows].get(e);const n=this.editedCells.get(t);return void 0!==n?n.get(e):void 0}setCell(e,t,n){if(this.isAddedRow(t)){if(t-this.numRows>=this.addedRows.length)return;this.addedRows[t-this.numRows].set(e,n)}else{void 0===this.editedCells.get(t)&&this.editedCells.set(t,new Map);this.editedCells.get(t).set(e,n)}}addRow(e){this.addedRows.push(e)}deleteRows(e){e.sort(((e,t)=>t-e)).forEach((e=>{this.deleteRow(e)}))}deleteRow(e){(0,p.le)(e)||e<0||(this.isAddedRow(e)?this.addedRows.splice(e-this.numRows,1):(this.deletedRows.includes(e)||(this.deletedRows.push(e),this.deletedRows=this.deletedRows.sort(((e,t)=>e-t))),this.editedCells.delete(e)))}getOriginalRowIndex(e){let t=e;for(let n=0;n<this.deletedRows.length&&!(this.deletedRows[n]>t);n++)t+=1;return t}getNumRows(){return this.numRows+this.addedRows.length-this.deletedRows.length}};var Ke=n(35704);const Ge=function(){const e=(0,g.u)(),t=i.useMemo((()=>({editable:e=>'<svg xmlns="http://www.w3.org/2000/svg" height="40" viewBox="0 96 960 960" width="40" fill="'.concat(e.bgColor,'"><path d="m800.641 679.743-64.384-64.384 29-29q7.156-6.948 17.642-6.948 10.485 0 17.742 6.948l29 29q6.948 7.464 6.948 17.95 0 10.486-6.948 17.434l-29 29Zm-310.64 246.256v-64.383l210.82-210.821 64.384 64.384-210.821 210.82h-64.383Zm-360-204.872v-50.254h289.743v50.254H130.001Zm0-162.564v-50.255h454.615v50.255H130.001Zm0-162.307v-50.255h454.615v50.255H130.001Z"/></svg>')})),[]);return{theme:i.useMemo((()=>({accentColor:e.colors.primary,accentFg:e.colors.white,accentLight:(0,Ke.DZ)(e.colors.primary,.9),borderColor:e.colors.fadedText05,horizontalBorderColor:e.colors.fadedText05,fontFamily:e.genericFonts.bodyFont,bgSearchResult:(0,Ke.DZ)(e.colors.primary,.9),resizeIndicatorColor:e.colors.primary,bgIconHeader:e.colors.fadedText60,fgIconHeader:e.colors.white,bgHeader:e.colors.bgMix,bgHeaderHasFocus:e.colors.secondaryBg,bgHeaderHovered:e.colors.secondaryBg,textHeader:e.colors.fadedText60,textHeaderSelected:e.colors.white,textGroupHeader:e.colors.fadedText60,headerFontStyle:"".concat(e.fontSizes.sm),baseFontStyle:e.fontSizes.sm,editorFontSize:e.fontSizes.sm,textDark:e.colors.bodyText,textMedium:(0,Ke.DZ)(e.colors.bodyText,.2),textLight:e.colors.fadedText40,textBubble:e.colors.fadedText60,bgCell:e.colors.bgColor,bgCellMedium:e.colors.bgColor,cellHorizontalPadding:8,cellVerticalPadding:3,bgBubble:e.colors.secondaryBg,bgBubbleSelected:e.colors.secondaryBg,linkColor:e.colors.linkText,drilldownBorder:e.colors.darkenedBgMix25})),[e]),tableBorderRadius:e.radii.lg,headerIcons:t}};const Xe=function(e,t,n,o){return{getCellContent:i.useCallback((i=>{let[a,r]=i;if(a>t.length-1)return B("Column index out of bounds.","This should never happen. Please report this bug.");if(r>n-1)return B("Row index out of bounds.","This should never happen. Please report this bug.");const l=t[a],s=l.indexNumber,d=o.current.getOriginalRowIndex(r);if(l.isEditable||o.current.isAddedRow(d)){const e=o.current.getCell(s,d);if(void 0!==e)return e}try{return Re(l,e.getCell(d+1,s),e.cssStyles)}catch(c){return(0,ae.H)(c),B("Error during cell creation.","This should never happen. Please report this bug. \nError: ".concat(c))}}),[t,n,e,o])}};var Qe=n(32700);const $e=function(e,t,n){const[o,a]=i.useState(),{getCellContent:r,getOriginalIndex:l}=(0,Qe.fF)({columns:t.map((e=>J(e))),getCellContent:n,rows:e,sort:o}),s=i.useMemo((()=>function(e,t){return void 0===t?e:e.map((e=>e.id===t.column.id?{...e,title:"asc"===t.direction?"\u2191 ".concat(e.title):"\u2193 ".concat(e.title)}:e))}(t,o)),[t,o]),d=i.useCallback((e=>{let t="asc";const n=s[e];if(o&&o.column.id===n.id){if("asc"!==o.direction)return void a(void 0);t="desc"}a({column:J(n),direction:t,mode:n.sortMode})}),[o,s]);return{columns:s,sortColumn:d,getOriginalIndex:l,getCellContent:r}},et=",",tt='"',nt='"',it="\n",ot=new RegExp("[".concat([et,tt,it].join(""),"]"));function at(e){return e.map((e=>function(e){if((0,p.le)(e))return"";const t=G(e);if(ot.test(t))return"".concat(tt).concat(t.replace(new RegExp(tt,"g"),nt+tt)).concat(tt);return t}(e))).join(et)+it}const rt=function(e,t,o){return{exportToCsv:i.useCallback((async()=>{try{const i=await n.e(5345).then(n.bind(n,95345)),a=(new Date).toISOString().slice(0,16).replace(":","-"),r="".concat(a,"_export.csv"),l=await i.showSaveFilePicker({suggestedName:r,types:[{accept:{"text/csv":[".csv"]}}],excludeAcceptAllOption:!1}),s=new TextEncoder,d=await l.createWritable();await d.write(s.encode("\ufeff"));const c=t.map((e=>e.name));await d.write(s.encode(at(c)));for(let n=0;n<o;n++){const i=[];t.forEach(((t,o,a)=>{i.push(t.getCellValue(e([o,n])))})),await d.write(s.encode(at(i)))}await d.close()}catch(i){(0,ae.KE)("Failed to export data as CSV",i)}}),[t,o,e])}};const lt=function(e,t,n,o,a,r,l){const s=i.useCallback(((t,i)=>{let[r,s]=t;const d=e[r];if(!d.isEditable)return;const c=d.indexNumber,u=n.current.getOriginalRowIndex(a(s)),m=o([r,s]),h=d.getCellValue(m),p=d.getCellValue(i);if(!Y(m)&&p===h)return;const g=d.getCell(p,!0);Y(g)?(0,ae.KE)("Not applying the cell edit since it causes this error:\n ".concat(g.data)):(n.current.setCell(c,u,{...g,lastUpdated:performance.now()}),l())}),[e,n,a,o,l]),d=i.useCallback((()=>{if(t)return;const i=new Map;e.forEach((e=>{i.set(e.indexNumber,e.getCell(e.defaultValue))})),n.current.addRow(i)}),[e,n,t]),c=i.useCallback((()=>{t||(d(),l())}),[d,l,t]),u=i.useCallback((i=>{var o;if(i.rows.length>0){if(t)return!0;const e=i.rows.toArray().map((e=>n.current.getOriginalRowIndex(a(e))));return n.current.deleteRows(e),l(!0),!1}if(null!==(o=i.current)&&void 0!==o&&o.range){const t=[],n=i.current.range;for(let i=n.y;i<n.y+n.height;i++)for(let o=n.x;o<n.x+n.width;o++){const n=e[o];n.isEditable&&!n.isRequired&&(t.push({cell:[o,i]}),s([o,i],n.getCell(null)))}return t.length>0&&(l(),r(t)),!1}return!0}),[e,n,t,r,a,l,s]),m=i.useCallback(((i,s)=>{const[c,u]=i,m=[];for(let h=0;h<s.length;h++){const i=s[h];if(h+u>=n.current.getNumRows()){if(t)break;d()}for(let t=0;t<i.length;t++){const r=i[t],l=h+u,s=t+c;if(s>=e.length)break;const d=e[s];if(d.isEditable){const e=d.getCell(r,!0);if((0,p.bb)(e)&&!Y(e)){const t=d.indexNumber,i=n.current.getOriginalRowIndex(a(l)),r=d.getCellValue(o([s,l]));d.getCellValue(e)!==r&&(n.current.setCell(t,i,{...e,lastUpdated:performance.now()}),m.push({cell:[s,l]}))}}}m.length>0&&(l(),r(m))}return!1}),[e,n,t,a,o,d,l,r]),h=i.useCallback(((t,n)=>{const i=t[0];if(i>=e.length)return!0;const o=e[i];if(o.validateInput){const e=o.validateInput(o.getCellValue(n));return!0===e||!1===e?e:o.getCell(e)}return!0}),[e]);return{onCellEdited:s,onPaste:m,onRowAppended:c,onDelete:u,validateCell:h}};const st=function(e,t){const[n,o]=i.useState(),a=i.useRef(null),r=i.useCallback((n=>{if(clearTimeout(a.current),a.current=0,o(void 0),("header"===n.kind||"cell"===n.kind)&&n.location){const i=n.location[0],r=n.location[1];let l;if(i<0||i>=e.length)return;const s=e[i];if("header"===n.kind&&(0,p.bb)(s))l=s.help;else if("cell"===n.kind){const e=t([i,r]);s.isRequired&&s.isEditable&&P(e)?l="\u26a0\ufe0f Please fill out this cell.":function(e){return e.hasOwnProperty("tooltip")&&""!==e.tooltip}(e)&&(l=e.tooltip)}l&&(a.current=setTimeout((()=>{l&&o({content:l,left:n.bounds.x+n.bounds.width/2,top:n.bounds.y})}),600))}}),[e,t,o,a]);return{tooltip:n,clearTooltip:i.useCallback((()=>{o(void 0)}),[o]),onItemHovered:r}};var dt=n(39806),ct=n(97613),ut=n(5527),mt=n(85e3),ht=n(37538);const pt=function(e){return{drawCell:i.useCallback(((t,n)=>{const{cell:i,theme:o,ctx:a,rect:r}=t,l=t.col;if(P(i)&&l<e.length){const i=e[l];return["checkbox","line_chart","bar_chart","progress"].includes(i.kind)?n():(e=>{const{cell:t,theme:n,ctx:i}=e;(0,dt.L6)({...e,theme:{...n,textDark:n.textLight,headerFontFull:"".concat(n.headerFontStyle," ").concat(n.fontFamily),baseFontFull:"".concat(n.baseFontStyle," ").concat(n.fontFamily),markerFontFull:"".concat(n.markerFontStyle," ").concat(n.fontFamily)},spriteManager:{},hyperWrapping:!1},"None",t.contentAlign),i.fillStyle=n.textDark})(t),void(i.isRequired&&i.isEditable&&function(e,t,n){e.save(),e.beginPath(),e.moveTo(t.x+t.width-8,t.y+1),e.lineTo(t.x+t.width,t.y+1),e.lineTo(t.x+t.width,t.y+1+8),e.fillStyle=n.accentColor,e.fill(),e.restore()}(a,r,o))}n()}),[e]),customRenderers:i.useMemo((()=>[ct.Z,ut.Z,mt.Z,ht.ZP,...je]),[])}};const gt=function(e){const[t,n]=(0,i.useState)((()=>new Map)),o=i.useCallback(((e,i,o,a)=>{e.id&&n(new Map(t).set(e.id,a))}),[t]);return{columns:i.useMemo((()=>e.map((e=>e.id&&t.has(e.id)&&void 0!==t.get(e.id)?{...e,width:t.get(e.id),grow:0}:e))),[e,t]),onColumnResize:o}},ft=2,bt=35,vt=50+ft,yt=2*bt+ft;const wt=function(e,t,n,o,a){let r,l=function(e){return Math.max(e*bt+ft,yt)}(t+1+(e.editingMode===h.Eh.EditingMode.DYNAMIC?1:0)),s=Math.min(l,400);e.height&&(s=Math.max(e.height,yt),l=Math.max(e.height,l)),o&&(s=Math.min(s,o),l=Math.min(l,o),e.height||(s=l));let d=n;e.useContainerWidth?r=n:e.width&&(r=Math.min(Math.max(e.width,vt),n),d=Math.min(Math.max(e.width,d),n));const[c,u]=i.useState({width:r||"100%",height:s});return i.useLayoutEffect((()=>{e.useContainerWidth&&"100%"===c.width&&u({width:n,height:c.height})}),[n]),i.useLayoutEffect((()=>{u({width:c.width,height:s})}),[t]),i.useLayoutEffect((()=>{u({width:r||"100%",height:c.height})}),[r]),i.useLayoutEffect((()=>{u({width:c.width,height:s})}),[s]),i.useLayoutEffect((()=>{if(a){const t=e.useContainerWidth||(0,p.bb)(e.width)&&e.width>0;u({width:t?d:"100%",height:l})}else u({width:r||"100%",height:s})}),[a]),{minHeight:yt,maxHeight:l,minWidth:vt,maxWidth:d,resizableSize:c,setResizableSize:u}},xt=(0,E.Z)("img",{target:"e24uaba0"})((()=>({maxWidth:"100%",maxHeight:"600px",objectFit:"scale-down"})),""),Ct=e=>{let{urls:t}=e;const n=t&&t.length>0?t[0]:"";return n.startsWith("http")?(0,R.jsx)("a",{href:n,target:"_blank",rel:"noreferrer noopener",children:(0,R.jsx)(xt,{src:n})}):(0,R.jsx)(xt,{src:n})};var Et=n(31572),Mt=n(13553),Tt=n(80152);const kt=function(e){let{top:t,left:n,content:o,clearTooltip:a}=e;const[r,l]=i.useState(!0),s=(0,g.u)(),{colors:d,fontSizes:c,radii:u}=s,m=i.useCallback((()=>{l(!1),a()}),[a,l]);return(0,R.jsx)(Et.Z,{content:(0,R.jsx)(Tt.Uo,{className:"stTooltipContent",children:(0,R.jsx)(v.ZP,{style:{fontSize:c.sm},source:o,allowHTML:!1})}),placement:Mt.r4.top,accessibilityType:Mt.SI.tooltip,showArrow:!1,popoverMargin:5,onClickOutside:m,onEsc:m,overrides:{Body:{style:{borderTopLeftRadius:u.md,borderTopRightRadius:u.md,borderBottomLeftRadius:u.md,borderBottomRightRadius:u.md,paddingTop:"0 !important",paddingBottom:"0 !important",paddingLeft:"0 !important",paddingRight:"0 !important",backgroundColor:"transparent"}},Inner:{style:{backgroundColor:(0,M.Iy)(s)?d.bgColor:d.secondaryBg,color:d.bodyText,fontSize:c.sm,fontWeight:"normal",paddingTop:"0 !important",paddingBottom:"0 !important",paddingLeft:"0 !important",paddingRight:"0 !important"}}},isOpen:r,children:(0,R.jsx)("div",{className:"stTooltipTarget","data-testid":"stTooltipTarget",style:{position:"fixed",top:t,left:n}})})},Rt=(0,E.Z)("div",{target:"e1w7nams0"})((e=>{let{hasCustomizedScrollbars:t,theme:n}=e;return{position:"relative",display:"inline-block","& .glideDataEditor":{height:"100%",minWidth:"100%",borderRadius:n.radii.lg},"& .dvn-scroller":{...!t&&{scrollbarWidth:"thin"},overflowX:"auto !important",overflowY:"auto !important"}}}),"");n(2739),n(24665);const Nt=(0,m.Z)((function(e){let{element:t,data:n,width:m,height:g,disabled:f,widgetMgr:b,isFullScreen:v,disableFullscreenMode:y,expand:w,collapse:x,fragmentId:C}=e;const E=i.useRef(null),M=i.useRef(null),T=i.useRef(null),{theme:k,headerIcons:_,tableBorderRadius:I}=Ge(),[O,D]=i.useState(!0),[F,A]=i.useState(!1),[H,z]=i.useState(!1),[V,j]=i.useState(!1),L=i.useMemo((()=>window.matchMedia&&window.matchMedia("(pointer: coarse)").matches),[]),W=i.useMemo((()=>window.navigator.userAgent.includes("Mac OS")&&window.navigator.userAgent.includes("Safari")||window.navigator.userAgent.includes("Chrome")),[]),[B,Y]=i.useState({columns:o.EV.empty(),rows:o.EV.empty(),current:void 0}),P=i.useCallback((()=>{Y({columns:o.EV.empty(),rows:o.EV.empty(),current:void 0})}),[]),Z=i.useCallback((()=>{Y({columns:B.columns,rows:B.rows,current:void 0})}),[B]),U=i.useCallback((e=>{var t;null===(t=M.current)||void 0===t||t.updateCells(e)}),[]);(0,p.le)(t.editingMode)&&(t.editingMode=h.Eh.EditingMode.READ_ONLY);const{READ_ONLY:K,DYNAMIC:G}=h.Eh.EditingMode,X=n.dimensions,Q=Math.max(0,X.rows-1),$=0===Q&&!(t.editingMode===G&&X.dataColumns>0),ee=Q>15e4,te=i.useRef(new Ue(Q)),[ne,ie]=i.useState(te.current.getNumRows());i.useEffect((()=>{te.current=new Ue(Q),ie(te.current.getNumRows())}),[Q]);const oe=i.useCallback((()=>{te.current=new Ue(Q),ie(te.current.getNumRows())}),[Q]),{columns:ae}=qe(t,n,f);i.useEffect((()=>{if(t.editingMode!==K){const e=b.getStringValue(t);e&&(te.current.fromJson(e,ae),ie(te.current.getNumRows()))}}),[]);const{getCellContent:re}=Xe(n,ae,ne,te),{columns:le,sortColumn:se,getOriginalIndex:de,getCellContent:ce}=$e(Q,ae,re),ue=i.useCallback((function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];ne!==te.current.getNumRows()&&ie(te.current.getNumRows()),e&&P(),(0,p.Ds)(100,(()=>{const e=te.current.toJson(le);let i=b.getStringValue(t);void 0===i&&(i=new Ue(0).toJson([])),e!==i&&b.setStringValue(t,e,{fromUi:n},C)}))()}),[b,t,ne,P,le]),{exportToCsv:me}=rt(ce,le,ne),{onCellEdited:he,onPaste:pe,onRowAppended:ge,onDelete:fe,validateCell:be}=lt(le,t.editingMode!==G,te,ce,de,U,ue),{tooltip:ve,clearTooltip:ye,onItemHovered:we}=st(le,ce),{drawCell:xe,customRenderers:Ce}=pt(le),Ee=i.useMemo((()=>le.map((e=>J(e)))),[le]),{columns:Me,onColumnResize:Te}=gt(Ee),{minHeight:ke,maxHeight:Re,minWidth:Ne,maxWidth:Se,resizableSize:_e,setResizableSize:Ie}=wt(t,ne,m,g,v),Oe=i.useCallback((e=>{let[t,n]=e;return{...q(!0,!1),displayData:"empty",contentAlign:"center",allowOverlay:!1,themeOverride:{textDark:k.textLight},span:[0,Math.max(le.length-1,0)]}}),[le,k.textLight]);i.useEffect((()=>{const e=new u.K;return e.manageFormClearListener(b,t.formId,oe),()=>{e.disconnect()}}),[t.formId,oe,b]);const De=!$&&t.editingMode===G&&!f,Fe=B.rows.length>0,Ae=void 0!==B.current,He=$?0:le.filter((e=>e.isIndex)).length;return i.useEffect((()=>{setTimeout((()=>{if(T.current&&M.current){var e,t;const n=null===(e=T.current)||void 0===e||null===(t=e.querySelector(".dvn-stack"))||void 0===t?void 0:t.getBoundingClientRect();n&&(z(n.height>T.current.clientHeight),j(n.width>T.current.clientWidth))}}),1)}),[_e,ne,Me]),i.useEffect((()=>{Z()}),[v]),(0,R.jsxs)(Rt,{"data-testid":"stDataFrame",className:"stDataFrame",hasCustomizedScrollbars:W,ref:T,onMouseDown:e=>{if(T.current&&W){const t=T.current.getBoundingClientRect();V&&t.height-7<e.clientY-t.top&&e.stopPropagation(),H&&t.width-7<e.clientX-t.left&&e.stopPropagation()}},onBlur:e=>{O||L||e.currentTarget.contains(e.relatedTarget)||Z()},children:[(0,R.jsxs)(S,{isFullScreen:v,disableFullscreenMode:y,locked:Fe||Ae||L&&O,onExpand:w,onCollapse:x,target:Rt,children:[De&&Fe&&(0,R.jsx)(N,{label:"Delete row(s)",icon:l.H,onClick:()=>{fe&&(fe(B),ye())}}),De&&!Fe&&(0,R.jsx)(N,{label:"Add row",icon:s.m,onClick:()=>{ge&&(D(!0),ge(),ye())}}),!ee&&!$&&(0,R.jsx)(N,{label:"Download as CSV",icon:d.k,onClick:()=>me()}),!$&&(0,R.jsx)(N,{label:"Search",icon:c.o,onClick:()=>{F?A(!1):(D(!0),A(!0)),ye()}})]}),(0,R.jsx)(r.e,{"data-testid":"stDataFrameResizable",ref:E,defaultSize:_e,style:{border:"1px solid ".concat(k.borderColor),borderRadius:"".concat(I)},minHeight:ke,maxHeight:Re,minWidth:Ne,maxWidth:Se,size:_e,enable:{top:!1,right:!1,bottom:!1,left:!1,topRight:!1,bottomRight:!0,bottomLeft:!1,topLeft:!1},grid:[1,bt],snapGap:bt/3,onResizeStop:(e,t,n,i)=>{E.current&&Ie({width:E.current.size.width,height:Re-E.current.size.height===ft?E.current.size.height+ft:E.current.size.height})},children:(0,R.jsx)(a.F,{className:"glideDataEditor",ref:M,columns:Me,rows:$?1:ne,minColumnWidth:50,maxColumnWidth:1e3,maxColumnAutoWidth:500,rowHeight:bt,headerHeight:bt,getCellContent:$?Oe:ce,onColumnResize:L?void 0:Te,resizeIndicator:"header",freezeColumns:He,smoothScrollX:!0,smoothScrollY:!0,verticalBorder:!0,getCellsForSelection:!0,rowMarkers:"none",rangeSelect:L?"cell":"rect",columnSelect:"none",rowSelect:"none",onItemHovered:we,keybindings:{downFill:!0},onKeyDown:e=>{(e.ctrlKey||e.metaKey)&&"f"===e.key&&(A((e=>!e)),e.stopPropagation(),e.preventDefault())},showSearch:F,onSearchClose:()=>{A(!1),ye()},onHeaderClicked:$||ee?void 0:se,gridSelection:B,onGridSelectionChange:e=>{(O||L)&&(Y(e),void 0!==ve&&ye())},theme:k,onMouseMove:e=>{"out-of-bounds"===e.kind&&O?D(!1):"out-of-bounds"===e.kind||O||D(!0)},fixedShadowX:!0,fixedShadowY:!0,experimental:{scrollbarWidthOverride:0,...W&&{paddingBottom:V?-6:void 0,paddingRight:H?-6:void 0}},drawCell:xe,customRenderers:Ce,imageEditorOverride:Ct,headerIcons:_,validateCell:be,onPaste:!1,...!$&&t.editingMode!==K&&!f&&{fillHandle:!L,onCellEdited:he,onPaste:pe,onDelete:fe},...!$&&t.editingMode===G&&{trailingRowOptions:{sticky:!1,tint:!0},rowMarkerTheme:{bgCell:k.bgHeader,bgCellMedium:k.bgHeader},rowMarkers:"checkbox",rowSelectionMode:"multi",rowSelect:f?"none":"multi",onRowAppended:f?void 0:ge,onHeaderClicked:void 0}})}),ve&&ve.content&&(0,R.jsx)(kt,{top:ve.top,left:ve.left,content:ve.content,clearTooltip:ye})]})}),!0)},87814:(e,t,n)=>{n.d(t,{K:()=>o});var i=n(50641);class o{constructor(){this.formClearListener=void 0,this.lastWidgetMgr=void 0,this.lastFormId=void 0}manageFormClearListener(e,t,n){null!=this.formClearListener&&this.lastWidgetMgr===e&&this.lastFormId===t||(this.disconnect(),(0,i.bM)(t)&&(this.formClearListener=e.addFormClearedListener(t,n),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([[43],{10043:(t,e,o)=>{o.r(e),o.d(e,{default:()=>D});var n=o(66845),i=o(25621),a=o(41558),s=o(95199),r=o(60784),l=o(23849),d=o(62622),c=o(63765),h=o(28391),g=o(96825),u=o.n(g),m=o(99394),f=o.n(m),p=o(92627);function b(t,e){const o={font:e.genericFonts.bodyFont,background:e.colors.bgColor,fieldTitle:"verbal",autosize:{type:"fit",contains:"padding"},title:{align:"left",anchor:"start",color:e.colors.headingColor,titleFontStyle:"normal",fontWeight:e.fontWeights.bold,fontSize:e.fontSizes.smPx+2,orient:"top",offset:26},header:{titleFontWeight:e.fontWeights.normal,titleFontSize:e.fontSizes.mdPx,titleColor:(0,p.Xy)(e),titleFontStyle:"normal",labelFontSize:e.fontSizes.twoSmPx,labelFontWeight:e.fontWeights.normal,labelColor:(0,p.Xy)(e),labelFontStyle:"normal"},axis:{labelFontSize:e.fontSizes.twoSmPx,labelFontWeight:e.fontWeights.normal,labelColor:(0,p.Xy)(e),labelFontStyle:"normal",titleFontWeight:e.fontWeights.normal,titleFontSize:e.fontSizes.smPx,titleColor:(0,p.Xy)(e),titleFontStyle:"normal",ticks:!1,gridColor:(0,p.ny)(e),domain:!1,domainWidth:1,domainColor:(0,p.ny)(e),labelFlush:!0,labelFlushOffset:1,labelBound:!1,labelLimit:100,titlePadding:e.spacing.lgPx,labelPadding:e.spacing.lgPx,labelSeparation:e.spacing.twoXSPx,labelOverlap:!0},legend:{labelFontSize:e.fontSizes.smPx,labelFontWeight:e.fontWeights.normal,labelColor:(0,p.Xy)(e),titleFontSize:e.fontSizes.smPx,titleFontWeight:e.fontWeights.normal,titleFontStyle:"normal",titleColor:(0,p.Xy)(e),titlePadding:5,labelPadding:e.spacing.lgPx,columnPadding:e.spacing.smPx,rowPadding:e.spacing.twoXSPx,padding:7,symbolStrokeWidth:4},range:{category:(0,p.iY)(e),diverging:(0,p.ru)(e),ramp:(0,p.Gy)(e),heatmap:(0,p.Gy)(e)},view:{columns:1,strokeWidth:0,stroke:"transparent",continuousHeight:350,continuousWidth:400},concat:{columns:1},facet:{columns:1},mark:{tooltip:!0,...(0,p.Iy)(e)?{color:"#0068C9"}:{color:"#83C9FF"}},bar:{binSpacing:e.spacing.twoXSPx,discreteBandSize:{band:.85}},axisDiscrete:{grid:!1},axisXPoint:{grid:!1},axisTemporal:{grid:!1},axisXBand:{grid:!1}};return t?f()({},o,t,((t,e)=>Array.isArray(e)?e:void 0)):o}const y=(0,o(1515).Z)("div",{target:"egd2k5h0"})((t=>{let{theme:e,useContainerWidth:o,isFullScreen:n}=t;return{width:o||n?"100%":"auto",height:n?"100%":"auto","&.vega-embed":{"&:hover summary, .vega-embed:focus summary":{background:"transparent"},"&.has-actions":{paddingRight:0},".vega-actions":{zIndex:e.zIndices.popupMenu,backgroundColor:e.colors.bgColor,boxShadow:"rgb(0 0 0 / 16%) 0px 4px 16px",border:"1px solid ".concat(e.colors.fadedText10),a:{fontFamily:e.genericFonts.bodyFont,fontWeight:e.fontWeights.normal,fontSize:e.fontSizes.md,margin:0,padding:"".concat(e.spacing.twoXS," ").concat(e.spacing.twoXL),color:e.colors.bodyText},"a:hover":{backgroundColor:e.colors.secondaryBg,color:e.colors.bodyText},":before":{content:"none"},":after":{content:"none"}},summary:{opacity:0,height:"auto",zIndex:e.zIndices.menuButton,border:"none",boxShadow:"none",borderRadius:e.radii.lg,color:e.colors.fadedText10,backgroundColor:"transparent",transition:"opacity 300ms 150ms,transform 300ms 150ms","&:active, &:focus-visible, &:hover":{border:"none",boxShadow:"none",color:e.colors.bodyText,opacity:"1 !important",background:e.colors.darkenedBgMix25}}}}}),"");var w=o(40864);const v={DATAFRAME_INDEX:"(index)"},x="source",S=new Set([h.GI.DatetimeIndex,h.GI.Float64Index,h.GI.Int64Index,h.GI.RangeIndex,h.GI.UInt64Index]);class F extends n.PureComponent{constructor(){super(...arguments),this.vegaView=void 0,this.vegaFinalizer=void 0,this.defaultDataName=x,this.element=null,this.state={error:void 0},this.finalizeView=()=>{this.vegaFinalizer&&this.vegaFinalizer(),this.vegaFinalizer=void 0,this.vegaView=void 0},this.generateSpec=()=>{var t,e;const{element:o,theme:n,isFullScreen:i,width:a,height:s}=this.props,r=JSON.parse(o.spec),{useContainerWidth:l}=o;if("streamlit"===o.vegaLiteTheme?r.config=b(r.config,n):"streamlit"===(null===(t=r.usermeta)||void 0===t||null===(e=t.embedOptions)||void 0===e?void 0:e.theme)?(r.config=b(r.config,n),r.usermeta.embedOptions.theme=void 0):r.config=function(t,e){const{colors:o,fontSizes:n,genericFonts:i}=e,a={labelFont:i.bodyFont,titleFont:i.bodyFont,labelFontSize:n.twoSmPx,titleFontSize:n.twoSmPx},s={background:o.bgColor,axis:{labelColor:o.bodyText,titleColor:o.bodyText,gridColor:(0,p.ny)(e),...a},legend:{labelColor:o.bodyText,titleColor:o.bodyText,...a},title:{color:o.bodyText,subtitleColor:o.bodyText,...a},header:{labelColor:o.bodyText,titleColor:o.bodyText,...a},view:{stroke:(0,p.ny)(e),continuousHeight:350,continuousWidth:400},mark:{tooltip:!0}};return t?u()({},s,t):s}(r.config,n),i?(r.width=a,r.height=s,"vconcat"in r&&r.vconcat.forEach((t=>{t.width=a}))):l&&(r.width=a,"vconcat"in r&&r.vconcat.forEach((t=>{t.width=a}))),r.padding||(r.padding={}),null==r.padding.bottom&&(r.padding.bottom=20),r.datasets)throw new Error("Datasets should not be passed as part of the spec");return r}}async componentDidMount(){try{await this.createView()}catch(t){const e=(0,c.b)(t);this.setState({error:e})}}componentWillUnmount(){this.finalizeView()}async componentDidUpdate(t){const{element:e,theme:o}=t,{element:n,theme:i}=this.props,a=e.spec,{spec:s}=n;if(!this.vegaView||a!==s||o!==i||t.width!==this.props.width||t.height!==this.props.height||t.element.vegaLiteTheme!==this.props.element.vegaLiteTheme){(0,l.ji)("Vega spec changed.");try{await this.createView()}catch(u){const t=(0,c.b)(u);this.setState({error:t})}return}const r=e.data,{data:d}=n;(r||d)&&this.updateData(this.defaultDataName,r,d);const h=z(e)||{},g=z(n)||{};for(const[l,c]of Object.entries(g)){const t=l||this.defaultDataName,e=h[t];this.updateData(t,e,c)}for(const l of Object.keys(h))g.hasOwnProperty(l)||l===this.defaultDataName||this.updateData(l,null,null);this.vegaView.resize().runAsync()}updateData(t,e,o){if(!this.vegaView)throw new Error("Chart has not been drawn yet");if(!o||0===o.data.numRows){return void(this.vegaView._runtime.data.hasOwnProperty(t)&&this.vegaView.remove(t,s.truthy))}if(!e||0===e.data.numRows)return void this.vegaView.insert(t,C(o));const{dataRows:n,dataColumns:i}=e.dimensions,{dataRows:a,dataColumns:r}=o.dimensions;if(function(t,e,o,n,i,a){if(o!==a)return!1;if(e>=i)return!1;if(0===e)return!1;const s=a-1,r=e-1;if(t.getDataValue(0,s)!==n.getDataValue(0,s)||t.getDataValue(r,s)!==n.getDataValue(r,s))return!1;return!0}(e,n,i,o,a,r))n<a&&this.vegaView.insert(t,C(o,n));else{const e=s.changeset().remove(s.truthy).insert(C(o));this.vegaView.change(t,e),(0,l.ji)("Had to clear the ".concat(t," dataset before inserting data through Vega view."))}}async createView(){if((0,l.ji)("Creating a new Vega view."),!this.element)throw Error("Element missing.");this.finalizeView();const t=this.props.element,e=this.generateSpec(),o={ast:!0,expr:r.N,tooltip:{disableDefaultStyle:!0},defaultStyle:!1,forceActionsMenu:!0},{vgSpec:n,view:i,finalize:s}=await(0,a.ZP)(this.element,e,o);this.vegaView=i,this.vegaFinalizer=s;const d=function(t){const e=z(t);if(null==e)return null;const o={};for(const[n,i]of Object.entries(e))o[n]=C(i);return o}(t),c=d?Object.keys(d):[];if(1===c.length){const[t]=c;this.defaultDataName=t}else 0===c.length&&n.data&&(this.defaultDataName=x);const h=function(t){const e=t.data;if(!e||0===e.data.numRows)return null;return C(e)}(t);if(h&&i.insert(this.defaultDataName,h),d)for(const[a,r]of Object.entries(d))i.insert(a,r);await i.runAsync(),this.vegaView.resize().runAsync()}render(){if(this.state.error)throw this.state.error;return(0,w.jsx)(y,{"data-testid":"stArrowVegaLiteChart",useContainerWidth:this.props.element.useContainerWidth,isFullScreen:this.props.isFullScreen,ref:t=>{this.element=t}})}}function z(t){var e;if(0===(null===(e=t.datasets)||void 0===e?void 0:e.length))return null;const o={};return t.datasets.forEach((t=>{if(!t)return;const e=t.hasName?t.name:null;o[e]=t.data})),o}function C(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if(t.isEmpty())return[];const o=[],{dataRows:n,dataColumns:i}=t.dimensions,a=h.fu.getTypeName(t.types.index[0]),s=S.has(a);for(let r=e;r<n;r++){const e={};if(s){const o=t.getIndexValue(r,0);e[v.DATAFRAME_INDEX]="bigint"===typeof o?Number(o):o}for(let o=0;o<i;o++){const n=t.getDataValue(r,o),i=t.types.data[o],a=h.fu.getTypeName(i);if("datetimetz"!==a&&(n instanceof Date||Number.isFinite(n))&&(a.startsWith("datetime")||"date"===a)){const i=60*new Date(n).getTimezoneOffset()*1e3;e[t.columns[0][o]]=n.valueOf()+i}else e[t.columns[0][o]]="bigint"===typeof n?Number(n):n}o.push(e)}return o}const D=(0,i.b)((0,d.Z)(F))}}]);