streamlit-nightly 1.32.1.dev20240307__py2.py3-none-any.whl → 1.32.1.dev20240309__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/elements/widgets/button.py +3 -1
- streamlit/elements/widgets/chat.py +3 -1
- streamlit/static/asset-manifest.json +13 -13
- streamlit/static/index.html +1 -1
- streamlit/static/static/js/{1168.d5c307a0.chunk.js → 1168.6deb594c.chunk.js} +1 -1
- streamlit/static/static/js/3092.3d4df25e.chunk.js +1 -0
- streamlit/static/static/js/{4185.21ca0590.chunk.js → 4185.234fd55f.chunk.js} +1 -1
- streamlit/static/static/js/{43.770724a5.chunk.js → 43.76c54963.chunk.js} +1 -1
- streamlit/static/static/js/{4666.ad225eae.chunk.js → 4666.2b4d1728.chunk.js} +1 -1
- streamlit/static/static/js/{6013.299d692d.chunk.js → 6013.75c92264.chunk.js} +1 -1
- streamlit/static/static/js/{6853.3cbd385e.chunk.js → 6853.d999ac75.chunk.js} +1 -1
- streamlit/static/static/js/{7602.7e796651.chunk.js → 7602.002aa3ff.chunk.js} +1 -1
- streamlit/static/static/js/{8427.d65e7c96.chunk.js → 8427.5c2cf22b.chunk.js} +1 -1
- streamlit/static/static/js/{8477.7419a0aa.chunk.js → 8477.e948c092.chunk.js} +1 -1
- streamlit/static/static/js/{8492.3394e630.chunk.js → 8492.e6dab83f.chunk.js} +1 -1
- streamlit/static/static/js/{main.ee2467b6.js → main.eb0d13b9.js} +2 -2
- streamlit/testing/v1/element_tree.py +2 -2
- streamlit/testing/v1/local_script_runner.py +1 -3
- {streamlit_nightly-1.32.1.dev20240307.dist-info → streamlit_nightly-1.32.1.dev20240309.dist-info}/METADATA +1 -1
- {streamlit_nightly-1.32.1.dev20240307.dist-info → streamlit_nightly-1.32.1.dev20240309.dist-info}/RECORD +25 -25
- streamlit/static/static/js/3092.dc70fcfe.chunk.js +0 -1
- /streamlit/static/static/js/{main.ee2467b6.js.LICENSE.txt → main.eb0d13b9.js.LICENSE.txt} +0 -0
- {streamlit_nightly-1.32.1.dev20240307.data → streamlit_nightly-1.32.1.dev20240309.data}/scripts/streamlit.cmd +0 -0
- {streamlit_nightly-1.32.1.dev20240307.dist-info → streamlit_nightly-1.32.1.dev20240309.dist-info}/WHEEL +0 -0
- {streamlit_nightly-1.32.1.dev20240307.dist-info → streamlit_nightly-1.32.1.dev20240309.dist-info}/entry_points.txt +0 -0
- {streamlit_nightly-1.32.1.dev20240307.dist-info → streamlit_nightly-1.32.1.dev20240309.dist-info}/top_level.txt +0 -0
@@ -39,7 +39,7 @@ from streamlit.runtime.state import (
|
|
39
39
|
WidgetKwargs,
|
40
40
|
register_widget,
|
41
41
|
)
|
42
|
-
from streamlit.runtime.state.common import compute_widget_id
|
42
|
+
from streamlit.runtime.state.common import compute_widget_id, save_for_app_testing
|
43
43
|
from streamlit.string_util import validate_emoji
|
44
44
|
from streamlit.type_util import Key, to_key
|
45
45
|
|
@@ -762,6 +762,8 @@ class ButtonMixin:
|
|
762
762
|
ctx=ctx,
|
763
763
|
)
|
764
764
|
|
765
|
+
if ctx:
|
766
|
+
save_for_app_testing(ctx, id, button_state.value)
|
765
767
|
self.dg._enqueue("button", button_proto)
|
766
768
|
|
767
769
|
return button_state.value
|
@@ -35,7 +35,7 @@ from streamlit.runtime.state import (
|
|
35
35
|
WidgetKwargs,
|
36
36
|
register_widget,
|
37
37
|
)
|
38
|
-
from streamlit.runtime.state.common import compute_widget_id
|
38
|
+
from streamlit.runtime.state.common import compute_widget_id, save_for_app_testing
|
39
39
|
from streamlit.string_util import is_emoji
|
40
40
|
from streamlit.type_util import Key, to_key
|
41
41
|
|
@@ -352,6 +352,8 @@ class ChatMixin:
|
|
352
352
|
chat_input_proto.value = widget_state.value
|
353
353
|
chat_input_proto.set_value = True
|
354
354
|
|
355
|
+
if ctx:
|
356
|
+
save_for_app_testing(ctx, id, widget_state.value)
|
355
357
|
if position == "bottom":
|
356
358
|
# We import it here to avoid circular imports.
|
357
359
|
from streamlit import _bottom
|
@@ -1,39 +1,39 @@
|
|
1
1
|
{
|
2
2
|
"files": {
|
3
3
|
"main.css": "./static/css/main.77d1c464.css",
|
4
|
-
"main.js": "./static/js/main.
|
4
|
+
"main.js": "./static/js/main.eb0d13b9.js",
|
5
5
|
"static/js/9336.2d95d840.chunk.js": "./static/js/9336.2d95d840.chunk.js",
|
6
6
|
"static/js/9330.c0dd1723.chunk.js": "./static/js/9330.c0dd1723.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.
|
10
|
+
"static/js/3092.3d4df25e.chunk.js": "./static/js/3092.3d4df25e.chunk.js",
|
11
11
|
"static/css/43.e3b876c5.chunk.css": "./static/css/43.e3b876c5.chunk.css",
|
12
|
-
"static/js/43.
|
13
|
-
"static/js/8427.
|
12
|
+
"static/js/43.76c54963.chunk.js": "./static/js/43.76c54963.chunk.js",
|
13
|
+
"static/js/8427.5c2cf22b.chunk.js": "./static/js/8427.5c2cf22b.chunk.js",
|
14
14
|
"static/js/7323.a0a246cc.chunk.js": "./static/js/7323.a0a246cc.chunk.js",
|
15
|
-
"static/js/4185.
|
15
|
+
"static/js/4185.234fd55f.chunk.js": "./static/js/4185.234fd55f.chunk.js",
|
16
16
|
"static/js/7805.51638fbc.chunk.js": "./static/js/7805.51638fbc.chunk.js",
|
17
17
|
"static/js/4500.d1151e3d.chunk.js": "./static/js/4500.d1151e3d.chunk.js",
|
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.6deb594c.chunk.js": "./static/js/1168.6deb594c.chunk.js",
|
22
22
|
"static/js/178.2203b5c2.chunk.js": "./static/js/178.2203b5c2.chunk.js",
|
23
23
|
"static/js/1792.16c16498.chunk.js": "./static/js/1792.16c16498.chunk.js",
|
24
24
|
"static/js/3513.57cff89c.chunk.js": "./static/js/3513.57cff89c.chunk.js",
|
25
|
-
"static/js/7602.
|
26
|
-
"static/js/6013.
|
27
|
-
"static/js/8492.
|
25
|
+
"static/js/7602.002aa3ff.chunk.js": "./static/js/7602.002aa3ff.chunk.js",
|
26
|
+
"static/js/6013.75c92264.chunk.js": "./static/js/6013.75c92264.chunk.js",
|
27
|
+
"static/js/8492.e6dab83f.chunk.js": "./static/js/8492.e6dab83f.chunk.js",
|
28
28
|
"static/js/4177.ab9a7aa1.chunk.js": "./static/js/4177.ab9a7aa1.chunk.js",
|
29
29
|
"static/js/1451.e3be1711.chunk.js": "./static/js/1451.e3be1711.chunk.js",
|
30
30
|
"static/js/1074.71719df6.chunk.js": "./static/js/1074.71719df6.chunk.js",
|
31
|
-
"static/js/8477.
|
32
|
-
"static/js/6853.
|
31
|
+
"static/js/8477.e948c092.chunk.js": "./static/js/8477.e948c092.chunk.js",
|
32
|
+
"static/js/6853.d999ac75.chunk.js": "./static/js/6853.d999ac75.chunk.js",
|
33
33
|
"static/js/4477.2555c11a.chunk.js": "./static/js/4477.2555c11a.chunk.js",
|
34
34
|
"static/js/4319.213fc321.chunk.js": "./static/js/4319.213fc321.chunk.js",
|
35
35
|
"static/js/5106.22187bfc.chunk.js": "./static/js/5106.22187bfc.chunk.js",
|
36
|
-
"static/js/4666.
|
36
|
+
"static/js/4666.2b4d1728.chunk.js": "./static/js/4666.2b4d1728.chunk.js",
|
37
37
|
"static/js/5379.af4bbff3.chunk.js": "./static/js/5379.af4bbff3.chunk.js",
|
38
38
|
"static/js/8691.ee84f70b.chunk.js": "./static/js/8691.ee84f70b.chunk.js",
|
39
39
|
"static/js/6718.97945fc6.chunk.js": "./static/js/6718.97945fc6.chunk.js",
|
@@ -150,6 +150,6 @@
|
|
150
150
|
},
|
151
151
|
"entrypoints": [
|
152
152
|
"static/css/main.77d1c464.css",
|
153
|
-
"static/js/main.
|
153
|
+
"static/js/main.eb0d13b9.js"
|
154
154
|
]
|
155
155
|
}
|
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.eb0d13b9.js"></script><link href="./static/css/main.77d1c464.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:()=>h});var r=o(66845),t=o(25621),c=o(62622),a=o(42736),n=o(96825),i=o.n(n),p=o(
|
1
|
+
"use strict";(self.webpackChunk_streamlit_app=self.webpackChunk_streamlit_app||[]).push([[1168],{71168:(l,e,o)=>{o.r(e),o.d(e,{default:()=>h});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",A="#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(A,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(A,"#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 A=o(40864);const u=450;function g(l){return!!l}function b(l){let{element:e,width:o,height:c}=l;const n=e.figure,i=(0,t.u)(),p=(0,r.useCallback)((()=>{const l=JSON.parse(y(n.spec,i,e.theme)),r=l.layout.height,t=l.layout.width;return g(c)?(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,i):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,i),l}),[e.theme,e.useContainerWidth,n.spec,c,i,o]),[s,f]=(0,r.useState)(JSON.parse(n.config)),[u,b]=(0,r.useState)(p());(0,r.useLayoutEffect)((()=>{f(JSON.parse(n.config)),b(p())}),[e,i,c,o,n.config,p]);const{data:h,layout:m,frames:x}=u;return(0,A.jsx)(a.Z,{className:"stPlotlyChart",data:h,layout:m,config:s,frames:x},g(c)?"fullscreen":"original")}const h=(0,c.Z)((function(l){let{width:e,element:o,height:r}=l;switch(o.chart){case"url":return function(l){let{url:e,width:o,height:r}=l;const t=r||u;return(0,A.jsx)("iframe",{title:"Plotly",src:e,style:{width:o,height:t,colorScheme:"light dark"}})}({url:o.url,height:r,width:e});case"figure":return(0,A.jsx)(b,{width:e,element:o,height:r});default:throw new Error("Unrecognized PlotlyChart type: ".concat(o.chart))}}))}}]);
|
@@ -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);n(87717),n(55842);const j=["true","t","yes","y","on","1"],L=["false","f","no","n","off","0"];function W(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 B(e){return e.hasOwnProperty("isError")&&e.isError}function Y(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 P(e,t){const n=t?"faded":"normal";return{kind:o.p6.Text,data:"",displayData:"",allowOverlay:!0,readonly:e,style:n}}function q(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 J(e,t){return(0,p.le)(e)?t||{}:(0,p.le)(t)?e||{}:D()(e,t)}function U(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:K(e))):[K(t)]}catch(t){return[K(e)]}}function K(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 G(e){if((0,p.le)(e))return null;if("boolean"===typeof e)return e;const t=K(e).toLowerCase().trim();return""===t?null:!!j.includes(t)||!L.includes(t)&&void 0}function X(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 Q(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():(0,H.sprintf)(t,e)}function $(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 ee(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 te(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 ne=new RegExp(/(\r\n|\n|\r)/gm);function ie(e){return-1!==e.indexOf("\n")?e.replace(ne," "):e}var oe=n(23849),ae=n(28391);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)?K(e):null,i=(0,p.bb)(n)?ie(n):"";return{...t,data:n,displayData:i,isMissingValue:(0,p.le)(e)}}catch(n){return W(K(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=K(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 W(K(e),n);if(t){const t=a(e);if(!1===t)return W(K(e),"Invalid input.");"string"===typeof t&&(e=t)}try{const t=(0,p.bb)(e)?K(e):null,n=(0,p.bb)(t)?ie(t):"";return{...i,isMissingValue:(0,p.le)(t),data:t,displayData:n}}catch(r){return W("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=J({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=ee(d.min_value)||void 0),(0,p.bb)(d.max_value)&&(m=ee(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=ee(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 W(K(e),"Invalid input.");t instanceof Date&&(e=t)}const i=ee(e);let o="",a="",r=c;if(void 0===i)return W(K(e),"The value cannot be interpreted as a datetime object.");if(null!==i){let e=V().utc(i);if(!e.isValid())return W(K(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 W(e.toISOString(),"Failed to adjust to the provided timezone: ".concat(d.timezone,". \nError: ").concat(b))}r=e.utcOffset()}try{a=$(e,d.format||n)}catch(b){return W(e.toISOString(),"Failed to format the date for rendering with: ".concat(d.format,". \nError: ").concat(b))}o=$(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=G(e),void 0===n?W(K(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=ae.fu.getTypeName(e.arrowType),n=J({step:be(t)?1:void 0,min_value:t.startsWith("uint")?0:void 0,format:"timedelta64[ns]"===t?"duration[ns]":void 0},e.columnTypeOptions),i=(0,p.le)(n.min_value)||n.min_value<0,a=(0,p.bb)(n.step)&&!Number.isNaN(n.step)?te(n.step):void 0,r={kind:o.p6.Number,data:void 0,displayData:"",readonly:!e.isEditable,allowOverlay:!0,contentAlign:e.contentAlignment||"right",style:e.isIndex?"faded":"normal",allowNegative:i,fixedDecimals:a},l=t=>{let i=X(t);if((0,p.le)(i))return!e.isRequired;if(Number.isNaN(i))return!1;let o=!1;return(0,p.bb)(n.max_value)&&i>n.max_value&&(i=n.max_value,o=!0),!((0,p.bb)(n.min_value)&&i<n.min_value)&&(!o||i)};return{...e,kind:"number",sortMode:"smart",validateInput:l,getCell(e,t){if(!0===t){const t=l(e);if(!1===t)return W(K(e),"Invalid input.");"number"===typeof t&&(e=t)}let i=X(e),o="";if((0,p.bb)(i)){if(Number.isNaN(i))return W(K(e),"The value cannot be interpreted as a number.");if((0,p.bb)(a)&&(s=i,i=0===(d=a)?Math.trunc(s):Math.trunc(s*10**d)/10**d),Number.isInteger(i)&&!Number.isSafeInteger(i))return W(K(e),"The value is larger than the maximum supported integer values in number columns (2^53).");try{o=Q(i,n.format,a)}catch(c){return W(K(i),(0,p.bb)(n.format)?"Failed to format the number based on the provided format configuration: (".concat(n.format,"). Error: ").concat(c):"Failed to format the number. Error: ".concat(c))}}var s,d;return{...r,data:i,displayData:o,isMissingValue:(0,p.le)(i)}},getCellValue:e=>void 0===e.data?null:e.data}}ve.isEditableType=!0;const ye=ve;function we(e){let t="string";const n=J({options:"bool"===ae.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=>K(e)))],value:"",readonly:!e.isEditable}};return{...e,kind:"selectbox",sortMode:"default",getCell(e,t){let n=null;return(0,p.bb)(e)&&""!==e&&(n=K(e)),t&&!a.data.allowedValues.includes(n)?W(K(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=X(null===(r=e.data)||void 0===r?void 0:r.value))&&void 0!==a?a:null:"boolean"===t?null!==(l=G(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)?[]:U(e);return{...t,data:n,isMissingValue:(0,p.le)(e),copyData:(0,p.le)(e)?"":K(n.map((e=>"string"===typeof e&&e.includes(",")?e.replace(/,/g," "):e)))}},getCellValue:e=>(0,p.le)(e.data)||Y(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"===ae.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"===ae.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?ae.fu.getTypeName(e.arrowType):null;let a;if("object"===e.kind)a=e.getCell((0,p.bb)(t.content)?ie(ae.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(ae.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:ae.fu.format(t.content,t.contentType,t.field);a=e.getCell(n)}else a=e.getCell(t.content);if(B(a))return a;if(!e.isEditable){if((0,p.bb)(t.displayContent)){var u;const e=ie(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=K(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 W(K(s),n);if(o){if(!1===r(s))return W(K(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)?[K(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(ae.fu.getTypeName(e.arrowType)),n=J({min_value:0,max_value:t?100:1,step:t?1:.01,format:t?"%3d%%":"percent"},e.columnTypeOptions);let i;try{i=Q(n.max_value,n.format)}catch(l){i=K(n.max_value)}const a=(0,p.le)(n.step)||Number.isNaN(n.step)?void 0:te(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 W("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 W("Invalid step parameter","The step parameter (".concat(n.step,") must be a valid number."));const t=X(e);if(Number.isNaN(t)||(0,p.le)(t))return W(K(e),"The value cannot be interpreted as a number.");if(Number.isInteger(t)&&!Number.isSafeInteger(t))return W(K(e),"The value is larger than the maximum supported integer values in number columns (2^53).");let i="";try{i=Q(t,n.format,a)}catch(l){return W(K(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=J({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 W("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=U(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=X(t[i]);if(Number.isNaN(e)||(0,p.le)(e))return W(K(t),"The value cannot be interpreted as a numeric array. ".concat(K(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=>Q(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 Ze(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 Pe(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,oe.KE)("Unknown column type configured in column configuration: ".concat(n))),(0,p.le)(i)&&(i=function(e){let t=e?ae.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,oe.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,...Ze(t,a),isStretched:r};const l=Pe(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&&Y(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 W("Column index out of bounds.","This should never happen. Please report this bug.");if(r>n-1)return W("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,oe.H)(c),W("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=>q(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:q(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=K(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,oe.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(!B(m)&&p===h)return;const g=d.getCell(p,!0);B(g)?(0,oe.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)&&!B(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&&Y(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(Y(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}=e;const C=i.useRef(null),E=i.useRef(null),M=i.useRef(null),{theme:T,headerIcons:k,tableBorderRadius:_}=Ge(),[I,O]=i.useState(!0),[D,F]=i.useState(!1),[A,H]=i.useState(!1),[z,V]=i.useState(!1),j=i.useMemo((()=>window.matchMedia&&window.matchMedia("(pointer: coarse)").matches),[]),L=i.useMemo((()=>window.navigator.userAgent.includes("Mac OS")&&window.navigator.userAgent.includes("Safari")||window.navigator.userAgent.includes("Chrome")),[]),[W,B]=i.useState({columns:o.EV.empty(),rows:o.EV.empty(),current:void 0}),Y=i.useCallback((()=>{B({columns:o.EV.empty(),rows:o.EV.empty(),current:void 0})}),[]),Z=i.useCallback((()=>{B({columns:W.columns,rows:W.rows,current:void 0})}),[W]),J=i.useCallback((e=>{var t;null===(t=E.current)||void 0===t||t.updateCells(e)}),[]);(0,p.le)(t.editingMode)&&(t.editingMode=h.Eh.EditingMode.READ_ONLY);const{READ_ONLY:U,DYNAMIC:K}=h.Eh.EditingMode,G=n.dimensions,X=Math.max(0,G.rows-1),Q=0===X&&!(t.editingMode===K&&G.dataColumns>0),$=X>15e4,ee=i.useRef(new Ue(X)),[te,ne]=i.useState(ee.current.getNumRows());i.useEffect((()=>{ee.current=new Ue(X),ne(ee.current.getNumRows())}),[X]);const ie=i.useCallback((()=>{ee.current=new Ue(X),ne(ee.current.getNumRows())}),[X]),{columns:oe}=qe(t,n,f);i.useEffect((()=>{if(t.editingMode!==U){const e=b.getStringValue(t);e&&(ee.current.fromJson(e,oe),ne(ee.current.getNumRows()))}}),[]);const{getCellContent:ae}=Xe(n,oe,te,ee),{columns:re,sortColumn:le,getOriginalIndex:se,getCellContent:de}=$e(X,oe,ae),ce=i.useCallback((function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];te!==ee.current.getNumRows()&&ne(ee.current.getNumRows()),e&&Y(),(0,p.Ds)(100,(()=>{const e=ee.current.toJson(re);let i=b.getStringValue(t);void 0===i&&(i=new Ue(0).toJson([])),e!==i&&b.setStringValue(t,e,{fromUi:n})}))()}),[b,t,te,Y,re]),{exportToCsv:ue}=rt(de,re,te),{onCellEdited:me,onPaste:he,onRowAppended:pe,onDelete:ge,validateCell:fe}=lt(re,t.editingMode!==K,ee,de,se,J,ce),{tooltip:be,clearTooltip:ve,onItemHovered:ye}=st(re,de),{drawCell:we,customRenderers:xe}=pt(re),Ce=i.useMemo((()=>re.map((e=>q(e)))),[re]),{columns:Ee,onColumnResize:Me}=gt(Ce),{minHeight:Te,maxHeight:ke,minWidth:Re,maxWidth:Ne,resizableSize:Se,setResizableSize:_e}=wt(t,te,m,g,v),Ie=i.useCallback((e=>{let[t,n]=e;return{...P(!0,!1),displayData:"empty",contentAlign:"center",allowOverlay:!1,themeOverride:{textDark:T.textLight},span:[0,Math.max(re.length-1,0)]}}),[re,T.textLight]);i.useEffect((()=>{const e=new u.K;return e.manageFormClearListener(b,t.formId,ie),()=>{e.disconnect()}}),[t.formId,ie,b]);const Oe=!Q&&t.editingMode===K&&!f,De=W.rows.length>0,Fe=void 0!==W.current,Ae=Q?0:re.filter((e=>e.isIndex)).length;return i.useEffect((()=>{setTimeout((()=>{if(M.current&&E.current){var e,t;const n=null===(e=M.current)||void 0===e||null===(t=e.querySelector(".dvn-stack"))||void 0===t?void 0:t.getBoundingClientRect();n&&(H(n.height>M.current.clientHeight),V(n.width>M.current.clientWidth))}}),1)}),[Se,te,Ee]),i.useEffect((()=>{Z()}),[v]),(0,R.jsxs)(Rt,{"data-testid":"stDataFrame",className:"stDataFrame",hasCustomizedScrollbars:L,ref:M,onMouseDown:e=>{if(M.current&&L){const t=M.current.getBoundingClientRect();z&&t.height-7<e.clientY-t.top&&e.stopPropagation(),A&&t.width-7<e.clientX-t.left&&e.stopPropagation()}},onBlur:e=>{I||j||e.currentTarget.contains(e.relatedTarget)||Z()},children:[(0,R.jsxs)(S,{isFullScreen:v,disableFullscreenMode:y,locked:De||Fe||j&&I,onExpand:w,onCollapse:x,target:Rt,children:[Oe&&De&&(0,R.jsx)(N,{label:"Delete row(s)",icon:l.H,onClick:()=>{ge&&(ge(W),ve())}}),Oe&&!De&&(0,R.jsx)(N,{label:"Add row",icon:s.m,onClick:()=>{pe&&(O(!0),pe(),ve())}}),!$&&!Q&&(0,R.jsx)(N,{label:"Download as CSV",icon:d.k,onClick:()=>ue()}),!Q&&(0,R.jsx)(N,{label:"Search",icon:c.o,onClick:()=>{D?F(!1):(O(!0),F(!0)),ve()}})]}),(0,R.jsx)(r.e,{"data-testid":"stDataFrameResizable",ref:C,defaultSize:Se,style:{border:"1px solid ".concat(T.borderColor),borderRadius:"".concat(_)},minHeight:Te,maxHeight:ke,minWidth:Re,maxWidth:Ne,size:Se,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)=>{C.current&&_e({width:C.current.size.width,height:ke-C.current.size.height===ft?C.current.size.height+ft:C.current.size.height})},children:(0,R.jsx)(a.F,{className:"glideDataEditor",ref:E,columns:Ee,rows:Q?1:te,minColumnWidth:50,maxColumnWidth:1e3,maxColumnAutoWidth:500,rowHeight:bt,headerHeight:bt,getCellContent:Q?Ie:de,onColumnResize:j?void 0:Me,resizeIndicator:"header",freezeColumns:Ae,smoothScrollX:!0,smoothScrollY:!0,verticalBorder:!0,getCellsForSelection:!0,rowMarkers:"none",rangeSelect:j?"cell":"rect",columnSelect:"none",rowSelect:"none",onItemHovered:ye,keybindings:{downFill:!0},onKeyDown:e=>{(e.ctrlKey||e.metaKey)&&"f"===e.key&&(F((e=>!e)),e.stopPropagation(),e.preventDefault())},showSearch:D,onSearchClose:()=>{F(!1),ve()},onHeaderClicked:Q||$?void 0:le,gridSelection:W,onGridSelectionChange:e=>{(I||j)&&(B(e),void 0!==be&&ve())},theme:T,onMouseMove:e=>{"out-of-bounds"===e.kind&&I?O(!1):"out-of-bounds"===e.kind||I||O(!0)},fixedShadowX:!0,fixedShadowY:!0,experimental:{scrollbarWidthOverride:0,...L&&{paddingBottom:z?-6:void 0,paddingRight:A?-6:void 0}},drawCell:we,customRenderers:xe,imageEditorOverride:Ct,headerIcons:k,validateCell:fe,onPaste:!1,...!Q&&t.editingMode!==U&&!f&&{fillHandle:!j,onCellEdited:me,onPaste:he,onDelete:ge},...!Q&&t.editingMode===K&&{trailingRowOptions:{sticky:!1,tint:!0},rowMarkerTheme:{bgCell:T.bgHeader,bgCellMedium:T.bgHeader},rowMarkers:"checkbox",rowSelectionMode:"multi",rowSelect:f?"none":"multi",onRowAppended:f?void 0:pe,onHeaderClicked:void 0}})}),be&&be.content&&(0,R.jsx)(kt,{top:be.top,left:be.left,content:be.content,clearTooltip:ve})]})}),!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}}}}]);
|
@@ -1 +1 @@
|
|
1
|
-
(self.webpackChunk_streamlit_app=self.webpackChunk_streamlit_app||[]).push([[4185],{72394:(t,e,i)=>{"use strict";i.r(e),i.d(e,{default:()=>L});var s=i(66845),o=i(59109),n=i(97365),a=i(62813),r=i.n(a),h=i(3717),c=i(25621),l=i(
|
1
|
+
(self.webpackChunk_streamlit_app=self.webpackChunk_streamlit_app||[]).push([[4185],{72394:(t,e,i)=>{"use strict";i.r(e),i.d(e,{default:()=>L});var s=i(66845),o=i(59109),n=i(97365),a=i(62813),r=i.n(a),h=i(3717),c=i(25621),l=i(92627),p=i(43536),d=i(80248),m=i(44948),g=i(12879),u=i(47203),w=i(61355),x=i(82595),b=i(19754),S=i(62622),k=i(63765),y=i(13005),v=i.n(y),j=i(82309),f=i(40864);const T=t=>{let{error:e,width:i,deltaType:s}=t;return e instanceof J?(0,f.jsx)(j.Z,{width:i,name:"No Mapbox token provided",message:(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)("p",{children:["To use ",(0,f.jsxs)("code",{children:["st.",s]})," or ",(0,f.jsx)("code",{children:"st.map"})," you need to set up a Mapbox access token."]}),(0,f.jsxs)("p",{children:["To get a token, create an account at"," ",(0,f.jsx)("a",{href:"https://mapbox.com",children:"https://mapbox.com"}),". It's free for moderate usage levels!"]}),(0,f.jsxs)("p",{children:["Once you have a token, just set it using the Streamlit config option ",(0,f.jsx)("code",{children:"mapbox.token"})," and don't forget to restart your Streamlit server at this point if it's still running, then reload this tab."]}),(0,f.jsxs)("p",{children:["See"," ",(0,f.jsx)("a",{href:"https://docs.streamlit.io/library/advanced-features/configuration#view-all-configuration-options",children:"our documentation"})," ","for more info on how to set config options."]})]})}):e instanceof Z?(0,f.jsx)(j.Z,{width:i,name:"Error fetching Streamlit Mapbox token",message:(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)("p",{children:"This app requires an internet connection."}),(0,f.jsx)("p",{children:"Please check your connection and try again."}),(0,f.jsxs)("p",{children:["If you think this is a bug, please file bug report"," ",(0,f.jsx)("a",{href:"https://github.com/streamlit/streamlit/issues/new/choose",children:"here"}),"."]})]})}):(0,f.jsx)(j.Z,{width:i,name:"Error fetching Streamlit Mapbox token",message:e.message})};var V=i(23183),C=i(55140),F=i(66694);class J extends Error{}class Z extends Error{}const E="https://data.streamlit.io/tokens.json",z="mapbox",M=t=>e=>{class i extends s.PureComponent{constructor(i){super(i),this.context=void 0,this.initMapboxToken=async()=>{try{const t=await V.Z.get(E),{[z]:e}=t.data;if(!e)throw new Error("Missing token ".concat(z));this.setState({mapboxToken:e,isFetching:!1})}catch(t){const e=(0,k.b)(t);throw this.setState({mapboxTokenError:e,isFetching:!1}),new Z("".concat(e.message," (").concat(E,")"))}},this.render=()=>{const{mapboxToken:i,mapboxTokenError:s,isFetching:o}=this.state,{width:n}=this.props;return s?(0,f.jsx)(T,{width:n,error:s,deltaType:t}):o?(0,f.jsx)(C.O,{}):(0,f.jsx)(e,{...this.props,mapboxToken:i,width:n})},this.state={isFetching:!0,mapboxToken:void 0,mapboxTokenError:void 0}}componentDidMount(){const t=this.props.element.mapboxToken||this.context.libConfig.mapboxToken;t?this.setState({mapboxToken:t,isFetching:!1}):this.initMapboxToken()}}return i.displayName="withMapboxToken(".concat(e.displayName||e.name,")"),i.contextType=F.E,v()(i,e)};var D=i(1515);const I=(0,D.Z)("div",{target:"e1az0zs51"})((t=>{let{width:e,height:i,theme:s}=t;return{marginTop:s.spacing.sm,position:"relative",height:i,width:e}}),""),O=(0,D.Z)("div",{target:"e1az0zs50"})((t=>{let{theme:e}=t;return{position:"absolute",right:"2.625rem",top:e.spacing.md,zIndex:1,"button:not(:disabled)":{background:e.colors.bgColor,"& + button":{borderTopColor:e.colors.secondaryBg},"& span":{filter:(0,l.Iy)(e)?"":"invert(100%)"}}}}),"");i(79259);const P={classes:{...p,...g,...m,...u}};(0,b.fh)([w.w,x.E]);const N=new d.Z({configuration:P});class _ extends s.PureComponent{constructor(){super(...arguments),this.state={viewState:{bearing:0,pitch:0,zoom:11},initialized:!1,initialViewState:{},id:void 0,pydeckJson:void 0,isFullScreen:!1,isLightTheme:(0,l.Iy)(this.props.theme)},this.componentDidMount=()=>{this.setState({initialized:!0})},this.createTooltip=t=>{const{element:e}=this.props;if(!t||!t.object||!e.tooltip)return!1;const i=n.Z.parse(e.tooltip);return i.html?i.html=this.interpolate(t,i.html):i.text=this.interpolate(t,i.text),i},this.interpolate=(t,e)=>{const i=e.match(/{(.*?)}/g);return i&&i.forEach((i=>{const s=i.substring(1,i.length-1);t.object.hasOwnProperty(s)&&(e=e.replace(i,t.object[s]))})),e},this.onViewStateChange=t=>{let{viewState:e}=t;this.setState({viewState:e})}}static getDerivedStateFromProps(t,e){const i=_.getDeckObject(t,e);if(!r()(i.initialViewState,e.initialViewState)){const t=Object.keys(i.initialViewState).reduce(((t,s)=>i.initialViewState[s]===e.initialViewState[s]?t:{...t,[s]:i.initialViewState[s]}),{});return{viewState:{...e.viewState,...t},initialViewState:i.initialViewState}}return null}render(){const t=_.getDeckObject(this.props,this.state),{viewState:e}=this.state;return(0,f.jsx)(I,{className:"stDeckGlJsonChart",width:t.initialViewState.width,height:t.initialViewState.height,"data-testid":"stDeckGlJsonChart",children:(0,f.jsxs)(o.Z,{viewState:e,onViewStateChange:this.onViewStateChange,height:t.initialViewState.height,width:t.initialViewState.width,layers:this.state.initialized?t.layers:[],getTooltip:this.createTooltip,ContextProvider:h.X$.Provider,controller:!0,children:[(0,f.jsx)(h.Z3,{height:t.initialViewState.height,width:t.initialViewState.width,mapStyle:t.mapStyle&&("string"===typeof t.mapStyle?t.mapStyle:t.mapStyle[0]),mapboxApiAccessToken:this.props.element.mapboxToken||this.props.mapboxToken}),(0,f.jsx)(O,{children:(0,f.jsx)(h.Pv,{className:"zoomButton",showCompass:!1})})]})})}}_.getDeckObject=(t,e)=>{var i,s;const{element:o,width:a,height:r,theme:h,isFullScreen:c}=t,p=null!==c&&void 0!==c&&c;var d,m,g;(o.id===e.id&&e.isFullScreen===p&&e.isLightTheme===(0,l.Iy)(h)||(e.pydeckJson=n.Z.parse(o.json),e.id=o.id),null!==(i=e.pydeckJson)&&void 0!==i&&i.mapStyle||(e.pydeckJson.mapStyle="mapbox://styles/mapbox/".concat((0,l.Iy)(h)?"light":"dark","-v9")),c)?Object.assign(null===(d=e.pydeckJson)||void 0===d?void 0:d.initialViewState,{width:a,height:r}):(null!==(m=e.pydeckJson)&&void 0!==m&&null!==(g=m.initialViewState)&&void 0!==g&&g.height||(e.pydeckJson.initialViewState.height=500),o.useContainerWidth&&(e.pydeckJson.initialViewState.width=a));return e.isFullScreen=c,e.isLightTheme=(0,l.Iy)(h),null===(s=e.pydeckJson)||void 0===s||delete s.views,N.convert(e.pydeckJson)};const L=(0,c.b)(M("st.pydeck_chart")((0,S.Z)(_)))},2090:()=>{},72709:()=>{},20035:()=>{},72672:()=>{}}]);
|
@@ -1 +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:()=>V});var n=o(66845),i=o(25621),a=o(41558),r=o(95199),s=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(
|
1
|
+
"use strict";(self.webpackChunk_streamlit_app=self.webpackChunk_streamlit_app||[]).push([[43],{10043:(t,e,o)=>{o.r(e),o.d(e,{default:()=>V});var n=o(66845),i=o(25621),a=o(41558),r=o(95199),s=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}=t;return{"&.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}=this.props,i=JSON.parse(o.spec),{useContainerWidth:a}=o;if("streamlit"===o.vegaLiteTheme?i.config=b(i.config,n):"streamlit"===(null===(t=i.usermeta)||void 0===t||null===(e=t.embedOptions)||void 0===e?void 0:e.theme)?(i.config=b(i.config,n),i.usermeta.embedOptions.theme=void 0):i.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},r={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()({},r,t):r}(i.config,n),this.props.height?(i.width=this.props.width,i.height=this.props.height):a&&(i.width=this.props.width),i.padding||(i.padding={}),null==i.padding.bottom&&(i.padding.bottom=20),i.datasets)throw new Error("Datasets should not be passed as part of the spec");return i}}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:r}=n;if(!this.vegaView||a!==r||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 s=e.data,{data:d}=n;(s||d)&&this.updateData(this.defaultDataName,s,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,r.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:s}=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 r=a-1,s=e-1;if(t.getDataValue(0,r)!==n.getDataValue(0,r)||t.getDataValue(s,r)!==n.getDataValue(s,r))return!1;return!0}(e,n,i,o,a,s))n<a&&this.vegaView.insert(t,C(o,n));else{const e=r.changeset().remove(r.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:s.N,tooltip:{disableDefaultStyle:!0},defaultStyle:!1,forceActionsMenu:!0},{vgSpec:n,view:i,finalize:r}=await(0,a.ZP)(this.element,e,o);this.vegaView=i,this.vegaFinalizer=r;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,s]of Object.entries(d))i.insert(a,s);await i.runAsync(),this.vegaView.resize().runAsync()}render(){if(this.state.error)throw this.state.error;return(0,w.jsx)(y,{"data-testid":"stArrowVegaLiteChart",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]),r=S.has(a);for(let s=e;s<n;s++){const e={};if(r){const o=t.getIndexValue(s,0);e[v.DATAFRAME_INDEX]="bigint"===typeof o?Number(o):o}for(let o=0;o<i;o++){const n=t.getDataValue(s,o);e[t.columns[0][o]]="bigint"===typeof n?Number(n):n}o.push(e)}return o}const V=(0,i.b)((0,d.Z)(F))}}]);
|
@@ -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(27466),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(23183),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}=this.props,s=i.getFileUploaderStateValue(t);n()(e,s)||i.setFileUploaderStateValue(t,e,{fromUi:!0})},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();null!=e&&this.props.widgetMgr.setFileUploaderStateValue(this.props.element,e,{fromUi:!0})}))},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}=this.props;void 0===i.getFileUploaderStateValue(t)&&i.setFileUploaderStateValue(t,e,{fromUi:!1})}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),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(23183),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}=this.props,s=i.getFileUploaderStateValue(t);n()(e,s)||i.setFileUploaderStateValue(t,e,{fromUi:!0})},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();null!=e&&this.props.widgetMgr.setFileUploaderStateValue(this.props.element,e,{fromUi:!0})}))},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}=this.props;void 0===i.getFileUploaderStateValue(t)&&i.setFileUploaderStateValue(t,e,{fromUi:!1})}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 +1 @@
|
|
1
|
-
"use strict";(self.webpackChunk_streamlit_app=self.webpackChunk_streamlit_app||[]).push([[6013],{79986:(e,t,r)=>{r.d(t,{Z:()=>d});r(66845);var n,o=r(50641),i=r(86659),a=r(50669),s=r(1515);const l=(0,r(7865).F4)(n||(n=(0,a.Z)(["\n 50% {\n color: rgba(0, 0, 0, 0);\n }\n"]))),c=(0,s.Z)("span",{target:"edlqvik0"})((e=>{let{includeDot:t,shouldBlink:r,theme:n}=e;return{...t?{"&::before":{opacity:1,content:'"\u2022"',animation:"none",color:n.colors.gray,margin:"0 5px"}}:{},...r?{color:n.colors.red,animationName:"".concat(l),animationDuration:"0.5s",animationIterationCount:5}:{}}}),"");var u=r(40864);const d=e=>{let{dirty:t,value:r,maxLength:n,className:a,type:s="single",inForm:l}=e;const d=[],p=function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];d.push((0,u.jsx)(c,{includeDot:d.length>0,shouldBlink:t,children:e},d.length))};if(t){const e=l?"submit form":"apply";if("multiline"===s){const t=(0,o.Ge)()?"\u2318":"Ctrl";p("Press ".concat(t,"+Enter to ").concat(e))}else"single"===s&&p("Press Enter to ".concat(e))}return n&&("chat"!==s||t)&&p("".concat(r.length,"/").concat(n),t&&r.length>=n),(0,u.jsx)(i.X7,{"data-testid":"InputInstructions",className:a,children:d})}},46013:(e,t,r)=>{r.r(t),r.d(t,{default:()=>x});var n=r(66845),o=r(25621),i=r(25773),a=r(69),s=n.forwardRef((function(e,t){return n.createElement(a.D,(0,i.Z)({iconAttrs:{fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"},iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},e,{ref:t}),n.createElement("rect",{width:24,height:24,fill:"none"}),n.createElement("path",{d:"M3 5.51v3.71c0 .46.31.86.76.97L11 12l-7.24 1.81c-.45.11-.76.51-.76.97v3.71c0 .72.73 1.2 1.39.92l15.42-6.49c.82-.34.82-1.5 0-1.84L4.39 4.58C3.73 4.31 3 4.79 3 5.51z"}))}));s.displayName="Send";var l=r(118),c=r(46927),u=r(79986),d=r(27466),p=r(48266),f=r(1515);const h=(0,f.Z)("div",{target:"e1d2x3se4"})((e=>{var t;let{theme:r,width:n}=e;return{borderRadius:r.radii.lg,display:"flex",backgroundColor:null!==(t=r.colors.widgetBackgroundColor)&&void 0!==t?t:r.colors.secondaryBg,width:"".concat(n,"px")}}),""),y=(0,f.Z)("div",{target:"e1d2x3se3"})((e=>{let{theme:t}=e;return{backgroundColor:t.colors.transparent,position:"relative",flexGrow:1,borderRadius:t.radii.lg,display:"flex",alignItems:"center"}}),""),g=(0,f.Z)("button",{target:"e1d2x3se2"})((e=>{let{theme:t,disabled:r,extended:n}=e;const o=(0,d.Iy)(t),[i,a]=o?[t.colors.gray60,t.colors.gray80]:[t.colors.gray80,t.colors.gray40];return{border:"none",backgroundColor:t.colors.transparent,borderTopRightRadius:n?t.radii.none:t.radii.lg,borderTopLeftRadius:n?t.radii.lg:t.radii.none,borderBottomRightRadius:t.radii.lg,display:"inline-flex",alignItems:"center",justifyContent:"center",lineHeight:1,margin:0,padding:t.spacing.sm,color:r?i:a,pointerEvents:"auto","&:focus":{outline:"none"},":focus":{outline:"none"},"&:focus-visible":{backgroundColor:o?t.colors.gray10:t.colors.gray90},"&:hover":{backgroundColor:t.colors.primary,color:t.colors.white},"&:disabled, &:disabled:hover, &:disabled:active":{backgroundColor:t.colors.transparent,borderColor:t.colors.transparent,color:t.colors.gray}}}),""),b=(0,f.Z)("div",{target:"e1d2x3se1"})((()=>({display:"flex",alignItems:"flex-end",height:"100%",position:"absolute",right:"0px",pointerEvents:"none"})),""),m=(0,f.Z)("div",{target:"e1d2x3se0"})({name:"1lm6gnd",styles:"position:absolute;bottom:0px;right:3rem"});var v=r(40864);const x=function(e){let{width:t,element:r,widgetMgr:i}=e;const a=(0,o.u)(),[f,x]=(0,n.useState)(!1),[w,O]=(0,n.useState)(r.default),[j,C]=(0,n.useState)(0),S=(0,n.useRef)(null),P=(0,n.useRef)({minHeight:0,maxHeight:0}),R=()=>{w&&(i.setStringTriggerValue(r,w,{fromUi:!0}),x(!1),O(""),C(0))};(0,n.useEffect)((()=>{if(r.setValue){r.setValue=!1;const e=r.value||"";O(e),x(""!==e)}}),[r]),(0,n.useEffect)((()=>{if(S.current){const{offsetHeight:e}=S.current;P.current.minHeight=e,P.current.maxHeight=6.5*e}}),[S]);const{disabled:k,placeholder:E,maxChars:I}=r,B=(0,d.Iy)(a),{minHeight:T,maxHeight:F}=P.current,Z=B?a.colors.gray70:a.colors.gray80,z=!!(j>0&&S.current)&&Math.abs(j-T)>1;return(0,v.jsx)(h,{className:"stChatInput","data-testid":"stChatInput",width:t,children:(0,v.jsxs)(y,{children:[(0,v.jsx)(l.Z,{inputRef:S,value:w,placeholder:E,onChange:e=>{const{value:t}=e.target,{maxChars:n}=r;0!==n&&t.length>n||(x(""!==t),O(t),C((()=>{let e=0;const{current:t}=S;if(t){const r=t.placeholder;t.placeholder="",t.style.height="auto",e=t.scrollHeight,t.placeholder=r,t.style.height=""}return e})()))},onKeyDown:e=>{const{metaKey:t,ctrlKey:r,shiftKey:n}=e;(e=>{var t;const{keyCode:r,key:n}=e;return("Enter"===n||13===r||10===r)&&!(!0===(null===(t=e.nativeEvent)||void 0===t?void 0:t.isComposing))})(e)&&!n&&!r&&!t&&(e.preventDefault(),R())},"aria-label":E,disabled:k,rows:1,overrides:{Root:{style:{outline:"none",backgroundColor:a.colors.transparent,borderLeftWidth:"1px",borderRightWidth:"1px",borderTopWidth:"1px",borderBottomWidth:"1px",width:"".concat(t,"px")}},InputContainer:{style:{backgroundColor:a.colors.transparent}},Input:{props:{"data-testid":"stChatInputTextArea"},style:{lineHeight:"1.4",backgroundColor:a.colors.transparent,"::placeholder":{color:Z},height:z?"".concat(j+1,"px"):"auto",maxHeight:F?"".concat(F,"px"):"none",paddingRight:"3rem",paddingLeft:a.spacing.sm,paddingBottom:a.spacing.sm,paddingTop:a.spacing.sm}}}}),t>p.A.hideWidgetDetails&&(0,v.jsx)(m,{children:(0,v.jsx)(u.Z,{dirty:f,value:w,maxLength:I,type:"chat",inForm:!1})}),(0,v.jsx)(b,{children:(0,v.jsx)(g,{onClick:R,disabled:!f||k,extended:z,"data-testid":"stChatInputSubmitButton",children:(0,v.jsx)(c.Z,{content:s,size:"xl",color:"inherit"})})})]})})}},118:(e,t,r)=>{r.d(t,{Z:()=>P});var n=r(66845),o=r(80318),i=r(9656),a=r(38254),s=r(80745),l=r(98479);function c(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function u(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?c(Object(r),!0).forEach((function(t){d(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):c(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function d(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var p=(0,s.zo)("div",(function(e){return u(u({},(0,l.d5)(u(u({$positive:!1},e),{},{$hasIconTrailing:!1}))),{},{width:e.$resize?"fit-content":"100%"})}));p.displayName="StyledTextAreaRoot",p.displayName="StyledTextAreaRoot";var f=(0,s.zo)("div",(function(e){return(0,l.hB)(u({$positive:!1},e))}));f.displayName="StyledTextareaContainer",f.displayName="StyledTextareaContainer";var h=(0,s.zo)("textarea",(function(e){return u(u({},(0,l.Hx)(e)),{},{resize:e.$resize||"none"})}));function y(e){return y="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},y(e)}function g(){return g=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},g.apply(this,arguments)}function b(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==r)return;var n,o,i=[],a=!0,s=!1;try{for(r=r.call(e);!(a=(n=r.next()).done)&&(i.push(n.value),!t||i.length!==t);a=!0);}catch(l){s=!0,o=l}finally{try{a||null==r.return||r.return()}finally{if(s)throw o}}return i}(e,t)||function(e,t){if(!e)return;if("string"===typeof e)return m(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return m(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function m(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function v(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function x(e,t){return x=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},x(e,t)}function w(e){var t=function(){if("undefined"===typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"===typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=j(e);if(t){var o=j(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return function(e,t){if(t&&("object"===y(t)||"function"===typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return O(e)}(this,r)}}function O(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function j(e){return j=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},j(e)}function C(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}h.displayName="StyledTextarea",h.displayName="StyledTextarea";var S=function(e){!function(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&x(e,t)}(c,e);var t,r,s,l=w(c);function c(){var e;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,c);for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];return C(O(e=l.call.apply(l,[this].concat(r))),"state",{isFocused:e.props.autoFocus||!1}),C(O(e),"onFocus",(function(t){e.setState({isFocused:!0}),e.props.onFocus(t)})),C(O(e),"onBlur",(function(t){e.setState({isFocused:!1}),e.props.onBlur(t)})),e}return t=c,(r=[{key:"render",value:function(){var e=this.props.overrides,t=void 0===e?{}:e,r=b((0,o.jb)(t.Root,p),2),s=r[0],l=r[1],c=(0,o.aO)({Input:{component:h},InputContainer:{component:f}},t);return n.createElement(s,g({"data-baseweb":"textarea",$isFocused:this.state.isFocused,$isReadOnly:this.props.readOnly,$disabled:this.props.disabled,$error:this.props.error,$positive:this.props.positive,$required:this.props.required,$resize:this.props.resize},l),n.createElement(i.Z,g({},this.props,{type:a.iB.textarea,overrides:c,onFocus:this.onFocus,onBlur:this.onBlur,resize:this.props.resize})))}}])&&v(t.prototype,r),s&&v(t,s),Object.defineProperty(t,"prototype",{writable:!1}),c}(n.Component);C(S,"defaultProps",{autoFocus:!1,disabled:!1,readOnly:!1,error:!1,name:"",onBlur:function(){},onChange:function(){},onKeyDown:function(){},onKeyPress:function(){},onKeyUp:function(){},onFocus:function(){},overrides:{},placeholder:"",required:!1,rows:3,size:a.NO.default});const P=S}}]);
|
1
|
+
"use strict";(self.webpackChunk_streamlit_app=self.webpackChunk_streamlit_app||[]).push([[6013],{79986:(e,t,r)=>{r.d(t,{Z:()=>d});r(66845);var n,o=r(50641),i=r(86659),a=r(50669),s=r(1515);const l=(0,r(7865).F4)(n||(n=(0,a.Z)(["\n 50% {\n color: rgba(0, 0, 0, 0);\n }\n"]))),c=(0,s.Z)("span",{target:"edlqvik0"})((e=>{let{includeDot:t,shouldBlink:r,theme:n}=e;return{...t?{"&::before":{opacity:1,content:'"\u2022"',animation:"none",color:n.colors.gray,margin:"0 5px"}}:{},...r?{color:n.colors.red,animationName:"".concat(l),animationDuration:"0.5s",animationIterationCount:5}:{}}}),"");var u=r(40864);const d=e=>{let{dirty:t,value:r,maxLength:n,className:a,type:s="single",inForm:l}=e;const d=[],p=function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];d.push((0,u.jsx)(c,{includeDot:d.length>0,shouldBlink:t,children:e},d.length))};if(t){const e=l?"submit form":"apply";if("multiline"===s){const t=(0,o.Ge)()?"\u2318":"Ctrl";p("Press ".concat(t,"+Enter to ").concat(e))}else"single"===s&&p("Press Enter to ".concat(e))}return n&&("chat"!==s||t)&&p("".concat(r.length,"/").concat(n),t&&r.length>=n),(0,u.jsx)(i.X7,{"data-testid":"InputInstructions",className:a,children:d})}},46013:(e,t,r)=>{r.r(t),r.d(t,{default:()=>x});var n=r(66845),o=r(25621),i=r(25773),a=r(69),s=n.forwardRef((function(e,t){return n.createElement(a.D,(0,i.Z)({iconAttrs:{fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"},iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},e,{ref:t}),n.createElement("rect",{width:24,height:24,fill:"none"}),n.createElement("path",{d:"M3 5.51v3.71c0 .46.31.86.76.97L11 12l-7.24 1.81c-.45.11-.76.51-.76.97v3.71c0 .72.73 1.2 1.39.92l15.42-6.49c.82-.34.82-1.5 0-1.84L4.39 4.58C3.73 4.31 3 4.79 3 5.51z"}))}));s.displayName="Send";var l=r(118),c=r(46927),u=r(79986),d=r(92627),p=r(48266),f=r(1515);const h=(0,f.Z)("div",{target:"e1d2x3se4"})((e=>{var t;let{theme:r,width:n}=e;return{borderRadius:r.radii.lg,display:"flex",backgroundColor:null!==(t=r.colors.widgetBackgroundColor)&&void 0!==t?t:r.colors.secondaryBg,width:"".concat(n,"px")}}),""),y=(0,f.Z)("div",{target:"e1d2x3se3"})((e=>{let{theme:t}=e;return{backgroundColor:t.colors.transparent,position:"relative",flexGrow:1,borderRadius:t.radii.lg,display:"flex",alignItems:"center"}}),""),g=(0,f.Z)("button",{target:"e1d2x3se2"})((e=>{let{theme:t,disabled:r,extended:n}=e;const o=(0,d.Iy)(t),[i,a]=o?[t.colors.gray60,t.colors.gray80]:[t.colors.gray80,t.colors.gray40];return{border:"none",backgroundColor:t.colors.transparent,borderTopRightRadius:n?t.radii.none:t.radii.lg,borderTopLeftRadius:n?t.radii.lg:t.radii.none,borderBottomRightRadius:t.radii.lg,display:"inline-flex",alignItems:"center",justifyContent:"center",lineHeight:1,margin:0,padding:t.spacing.sm,color:r?i:a,pointerEvents:"auto","&:focus":{outline:"none"},":focus":{outline:"none"},"&:focus-visible":{backgroundColor:o?t.colors.gray10:t.colors.gray90},"&:hover":{backgroundColor:t.colors.primary,color:t.colors.white},"&:disabled, &:disabled:hover, &:disabled:active":{backgroundColor:t.colors.transparent,borderColor:t.colors.transparent,color:t.colors.gray}}}),""),b=(0,f.Z)("div",{target:"e1d2x3se1"})((()=>({display:"flex",alignItems:"flex-end",height:"100%",position:"absolute",right:"0px",pointerEvents:"none"})),""),m=(0,f.Z)("div",{target:"e1d2x3se0"})({name:"1lm6gnd",styles:"position:absolute;bottom:0px;right:3rem"});var v=r(40864);const x=function(e){let{width:t,element:r,widgetMgr:i}=e;const a=(0,o.u)(),[f,x]=(0,n.useState)(!1),[w,O]=(0,n.useState)(r.default),[j,C]=(0,n.useState)(0),S=(0,n.useRef)(null),P=(0,n.useRef)({minHeight:0,maxHeight:0}),R=()=>{w&&(i.setStringTriggerValue(r,w,{fromUi:!0}),x(!1),O(""),C(0))};(0,n.useEffect)((()=>{if(r.setValue){r.setValue=!1;const e=r.value||"";O(e),x(""!==e)}}),[r]),(0,n.useEffect)((()=>{if(S.current){const{offsetHeight:e}=S.current;P.current.minHeight=e,P.current.maxHeight=6.5*e}}),[S]);const{disabled:k,placeholder:E,maxChars:I}=r,B=(0,d.Iy)(a),{minHeight:T,maxHeight:F}=P.current,Z=B?a.colors.gray70:a.colors.gray80,z=!!(j>0&&S.current)&&Math.abs(j-T)>1;return(0,v.jsx)(h,{className:"stChatInput","data-testid":"stChatInput",width:t,children:(0,v.jsxs)(y,{children:[(0,v.jsx)(l.Z,{inputRef:S,value:w,placeholder:E,onChange:e=>{const{value:t}=e.target,{maxChars:n}=r;0!==n&&t.length>n||(x(""!==t),O(t),C((()=>{let e=0;const{current:t}=S;if(t){const r=t.placeholder;t.placeholder="",t.style.height="auto",e=t.scrollHeight,t.placeholder=r,t.style.height=""}return e})()))},onKeyDown:e=>{const{metaKey:t,ctrlKey:r,shiftKey:n}=e;(e=>{var t;const{keyCode:r,key:n}=e;return("Enter"===n||13===r||10===r)&&!(!0===(null===(t=e.nativeEvent)||void 0===t?void 0:t.isComposing))})(e)&&!n&&!r&&!t&&(e.preventDefault(),R())},"aria-label":E,disabled:k,rows:1,overrides:{Root:{style:{outline:"none",backgroundColor:a.colors.transparent,borderLeftWidth:"1px",borderRightWidth:"1px",borderTopWidth:"1px",borderBottomWidth:"1px",width:"".concat(t,"px")}},InputContainer:{style:{backgroundColor:a.colors.transparent}},Input:{props:{"data-testid":"stChatInputTextArea"},style:{lineHeight:"1.4",backgroundColor:a.colors.transparent,"::placeholder":{color:Z},height:z?"".concat(j+1,"px"):"auto",maxHeight:F?"".concat(F,"px"):"none",paddingRight:"3rem",paddingLeft:a.spacing.sm,paddingBottom:a.spacing.sm,paddingTop:a.spacing.sm}}}}),t>p.A.hideWidgetDetails&&(0,v.jsx)(m,{children:(0,v.jsx)(u.Z,{dirty:f,value:w,maxLength:I,type:"chat",inForm:!1})}),(0,v.jsx)(b,{children:(0,v.jsx)(g,{onClick:R,disabled:!f||k,extended:z,"data-testid":"stChatInputSubmitButton",children:(0,v.jsx)(c.Z,{content:s,size:"xl",color:"inherit"})})})]})})}},118:(e,t,r)=>{r.d(t,{Z:()=>P});var n=r(66845),o=r(80318),i=r(9656),a=r(38254),s=r(80745),l=r(98479);function c(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function u(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?c(Object(r),!0).forEach((function(t){d(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):c(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function d(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var p=(0,s.zo)("div",(function(e){return u(u({},(0,l.d5)(u(u({$positive:!1},e),{},{$hasIconTrailing:!1}))),{},{width:e.$resize?"fit-content":"100%"})}));p.displayName="StyledTextAreaRoot",p.displayName="StyledTextAreaRoot";var f=(0,s.zo)("div",(function(e){return(0,l.hB)(u({$positive:!1},e))}));f.displayName="StyledTextareaContainer",f.displayName="StyledTextareaContainer";var h=(0,s.zo)("textarea",(function(e){return u(u({},(0,l.Hx)(e)),{},{resize:e.$resize||"none"})}));function y(e){return y="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},y(e)}function g(){return g=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},g.apply(this,arguments)}function b(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==r)return;var n,o,i=[],a=!0,s=!1;try{for(r=r.call(e);!(a=(n=r.next()).done)&&(i.push(n.value),!t||i.length!==t);a=!0);}catch(l){s=!0,o=l}finally{try{a||null==r.return||r.return()}finally{if(s)throw o}}return i}(e,t)||function(e,t){if(!e)return;if("string"===typeof e)return m(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return m(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function m(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function v(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function x(e,t){return x=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},x(e,t)}function w(e){var t=function(){if("undefined"===typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"===typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=j(e);if(t){var o=j(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return function(e,t){if(t&&("object"===y(t)||"function"===typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return O(e)}(this,r)}}function O(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function j(e){return j=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},j(e)}function C(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}h.displayName="StyledTextarea",h.displayName="StyledTextarea";var S=function(e){!function(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&x(e,t)}(c,e);var t,r,s,l=w(c);function c(){var e;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,c);for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];return C(O(e=l.call.apply(l,[this].concat(r))),"state",{isFocused:e.props.autoFocus||!1}),C(O(e),"onFocus",(function(t){e.setState({isFocused:!0}),e.props.onFocus(t)})),C(O(e),"onBlur",(function(t){e.setState({isFocused:!1}),e.props.onBlur(t)})),e}return t=c,(r=[{key:"render",value:function(){var e=this.props.overrides,t=void 0===e?{}:e,r=b((0,o.jb)(t.Root,p),2),s=r[0],l=r[1],c=(0,o.aO)({Input:{component:h},InputContainer:{component:f}},t);return n.createElement(s,g({"data-baseweb":"textarea",$isFocused:this.state.isFocused,$isReadOnly:this.props.readOnly,$disabled:this.props.disabled,$error:this.props.error,$positive:this.props.positive,$required:this.props.required,$resize:this.props.resize},l),n.createElement(i.Z,g({},this.props,{type:a.iB.textarea,overrides:c,onFocus:this.onFocus,onBlur:this.onBlur,resize:this.props.resize})))}}])&&v(t.prototype,r),s&&v(t,s),Object.defineProperty(t,"prototype",{writable:!1}),c}(n.Component);C(S,"defaultProps",{autoFocus:!1,disabled:!1,readOnly:!1,error:!1,name:"",onBlur:function(){},onChange:function(){},onKeyDown:function(){},onKeyPress:function(){},onKeyUp:function(){},onFocus:function(){},overrides:{},placeholder:"",required:!1,rows:3,size:a.NO.default});const P=S}}]);
|
@@ -1 +1 @@
|
|
1
|
-
"use strict";(self.webpackChunk_streamlit_app=self.webpackChunk_streamlit_app||[]).push([[6853],{76853:(e,t,r)=>{r.r(t),r.d(t,{default:()=>x});var n=r(66845),o=r(23175),s=r.n(o),a=r(
|
1
|
+
"use strict";(self.webpackChunk_streamlit_app=self.webpackChunk_streamlit_app||[]).push([[6853],{76853:(e,t,r)=>{r.r(t),r.d(t,{default:()=>x});var n=r(66845),o=r(23175),s=r.n(o),a=r(92627),i=r(21e3),l=r(66694),c=r(1515),d=r(63637),h=r(60484);const p=(0,c.Z)(d.Q,{shouldForwardProp:h.Z,target:"e1se5lgy2"})((e=>{let{theme:t,usingCustomTheme:r}=e;return{fontSize:t.fontSizes.sm,width:"1.375rem",height:"1.375rem",borderWidth:"3px",radius:"4px",justifyContents:"center",padding:t.spacing.none,margin:t.spacing.none,borderColor:t.colors.fadedText10,borderTopColor:r?t.colors.primary:t.colors.blue70,flexGrow:0,flexShrink:0}}),""),m=(0,c.Z)("div",{target:"e1se5lgy1"})((e=>{let{theme:t,width:r,cache:n}=e;return{width:r,...n?{paddingBottom:"1rem",background:"linear-gradient(to bottom, ".concat(t.colors.bgColor," 0%, ").concat(t.colors.bgColor," 80%, transparent 100%)")}:null}}),""),u=(0,c.Z)("div",{target:"e1se5lgy0"})((e=>{let{theme:t}=e;return{display:"flex",gap:t.spacing.sm,alignItems:"center",width:"100%"}}),"");var g=r(40864);const x=function(e){let{width:t,element:r}=e;const{activeTheme:o}=n.useContext(l.E),c=!(0,a.MJ)(o),{cache:d}=r;return(0,g.jsx)(m,{className:s()({stSpinner:!0,cacheSpinner:d}),"data-testid":"stSpinner",width:t,cache:d,children:(0,g.jsxs)(u,{children:[(0,g.jsx)(p,{usingCustomTheme:c}),(0,g.jsx)(i.ZP,{source:r.text,allowHTML:!1})]})})}}}]);
|
@@ -1 +1 @@
|
|
1
|
-
"use strict";(self.webpackChunk_streamlit_app=self.webpackChunk_streamlit_app||[]).push([[7602],{90186:(e,t,s)=>{s.d(t,{$:()=>c,Z:()=>h});var i=s(66845),r=s(25621),o=s(66694),a=s(27466),n=s(38570),l=s(80318),d=s(40864);let c;!function(e){e.EXTRASMALL="xs",e.SMALL="sm",e.MEDIUM="md",e.LARGE="lg",e.EXTRALARGE="xl"}(c||(c={}));const h=function(e){let{value:t,width:s,size:h=c.SMALL,overrides:u}=e;const g=(0,r.u)(),p={xs:g.spacing.twoXS,sm:g.spacing.sm,md:g.spacing.lg,lg:g.spacing.xl,xl:g.spacing.twoXL},{activeTheme:m}=i.useContext(o.E),f=!(0,a.MJ)(m),S={BarContainer:{style:{marginTop:g.spacing.none,marginBottom:g.spacing.none,marginRight:g.spacing.none,marginLeft:g.spacing.none}},Bar:{style:e=>{let{$theme:t}=e;return{width:s?s.toString():void 0,marginTop:g.spacing.none,marginBottom:g.spacing.none,marginRight:g.spacing.none,marginLeft:g.spacing.none,height:p[h],backgroundColor:t.colors.progressbarTrackFill,borderTopLeftRadius:g.spacing.twoXS,borderTopRightRadius:g.spacing.twoXS,borderBottomLeftRadius:g.spacing.twoXS,borderBottomRightRadius:g.spacing.twoXS}}},BarProgress:{style:()=>({backgroundColor:f?g.colors.primary:g.colors.blue70,borderTopLeftRadius:g.spacing.twoXS,borderTopRightRadius:g.spacing.twoXS,borderBottomLeftRadius:g.spacing.twoXS,borderBottomRightRadius:g.spacing.twoXS})}};return(0,d.jsx)(n.Z,{value:t,overrides:(0,l.aO)(S,u)})}},47602:(e,t,s)=>{s.r(t),s.d(t,{default:()=>q});var i,r=s(47869),o=s(23183),a=s(62813),n=s.n(a),l=s(66845),d=s(16295),c=s(46927),h=s(68411),u=s(8879),g=s(98478),p=s(86659),m=s(87814),f=s(23849),S=s(50641),C=s(77367),R=s(90186),x=s(1515),w=s(35704);function b(e,t){switch(e){case i.XSMALL:return{padding:"".concat(t.spacing.twoXS," ").concat(t.spacing.sm),fontSize:t.fontSizes.sm};case i.SMALL:return{padding:"".concat(t.spacing.twoXS," ").concat(t.spacing.md)};case i.LARGE:return{padding:"".concat(t.spacing.md," ").concat(t.spacing.md)};default:return{padding:"".concat(t.spacing.xs," ").concat(t.spacing.md)}}}!function(e){e.XSMALL="xsmall",e.SMALL="small",e.MEDIUM="medium",e.LARGE="large"}(i||(i={}));const F=(0,x.Z)("div",{target:"etz5kuj9"})((()=>({position:"relative",overflow:"hidden",width:"100%",objectFit:"contain"})),""),v=(0,x.Z)("div",{target:"etz5kuj8"})((e=>{let{theme:t,width:s}=e;return{backgroundColor:t.colors.secondaryBg,borderRadius:"".concat(t.radii.lg," ").concat(t.radii.lg," 0 0"),width:"100%",height:9*s/16,display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center"}}),""),I=(0,x.Z)("p",{target:"etz5kuj7"})((e=>{let{theme:t}=e;return{marginTop:t.spacing.sm,textAlign:"center"}}),""),M=(0,x.Z)("img",{target:"etz5kuj6"})((e=>{let{theme:t,opacity:s}=e;return{borderRadius:"".concat(t.radii.lg," ").concat(t.radii.lg," 0 0"),objectFit:"contain",opacity:s}}),""),y=(0,x.Z)("a",{target:"etz5kuj5"})((e=>{let{theme:t}=e;return{color:t.colors.primary,display:"block",textDecoration:"none"}}),""),E=(0,x.Z)("span",{target:"etz5kuj4"})((()=>({display:"flex",alignItems:"center"})),""),T=(0,x.Z)("div",{target:"etz5kuj3"})((e=>{let{theme:t}=e;return{position:"absolute",top:t.spacing.lg,right:t.spacing.lg,zIndex:1,color:t.colors.fadedText40,mixBlendMode:"difference",opacity:.6}}),""),j=(0,x.Z)("div",{target:"etz5kuj1"})((()=>({height:"fit-content",width:"100%",position:"absolute",bottom:0})),""),L=(0,x.Z)("button",{target:"etz5kuj0"})((e=>{let{theme:t}=e;return{position:"relative",display:"inline-flex",flexDirection:"column",alignItems:"center",justifyContent:"center",backgroundColor:t.colors.lightenedBg05,border:"1px solid ".concat(t.colors.fadedText10),borderRadius:"0 0 ".concat(t.radii.lg," ").concat(t.radii.lg),"&:hover":{borderColor:t.colors.primary,color:t.colors.primary},"&:active":{color:t.colors.white,borderColor:t.colors.primary,backgroundColor:t.colors.primary},"&:focus:not(:active)":{borderColor:t.colors.primary,color:t.colors.primary},"&:disabled, &:disabled:hover, &:disabled:active":{color:t.colors.fadedText40},fontWeight:t.fontWeights.normal,padding:"".concat(t.spacing.xs," ").concat(t.spacing.md),margin:0,lineHeight:t.lineHeights.base,color:"inherit",width:"100%",userSelect:"none","&:focus":{outline:"none"},"&:focus-visible":{boxShadow:"0 0 0 0.2rem ".concat((0,w.DZ)(t.colors.primary,.5))},...b(i.MEDIUM,t)}}),"");var U=s(40864);const P=function(e){let{disabled:t,onClick:s,children:i,progress:r}=e;return(0,U.jsxs)(L,{disabled:t||!1,onClick:s||(()=>{}),progress:r||null,"data-testid":"stCameraInputButton",children:[i,r&&(0,U.jsx)(j,{children:(0,U.jsx)(R.Z,{value:r,size:R.$.EXTRASMALL,overrides:{Bar:{style:{borderTopLeftRadius:"0px",borderTopRightRadius:"0px"}},BarProgress:{style:{borderTopLeftRadius:"0px",borderTopRightRadius:"0px"}},BarContainer:{style:{borderTopLeftRadius:"0px",borderTopRightRadius:"0px"}}}})})]})};var k=s(77979),z=s(9003),Z=s(81354),D=s(11765);let O;!function(e){e.USER="user",e.ENVIRONMENT="environment"}(O||(O={}));const X=e=>{let{switchFacingMode:t}=e;return(0,U.jsx)(T,{"data-testid":"stCameraSwitchButton",children:(0,U.jsx)(h.Z,{content:"Switch camera",placement:h.u.TOP_RIGHT,children:(0,U.jsx)(z.ZP,{kind:Z.nW.MINIMAL,onClick:t,children:(0,U.jsx)(c.Z,{content:k.Z,size:"twoXL",color:D.Z.white})})})})};var B=s(3084),_=s(25621),W=s(91706),A=s(48051),V=s.n(A),G=s(84192);let N;!function(e){e.PENDING="pending",e.SUCCESS="success",e.ERROR="error"}(N||(N={}));const H=e=>{let{width:t}=e;return(0,U.jsxs)(v,{width:t,children:[(0,U.jsx)(c.Z,{size:"threeXL",color:D.Z.gray60,content:B.n}),(0,U.jsxs)(I,{children:["This app would like to use your camera.",(0,U.jsx)(y,{href:G.U3,rel:"noopener noreferrer",target:"_blank",children:"Learn how to allow access."})]})]})},$=e=>{let{handleCapture:t,width:s,disabled:i,clearPhotoInProgress:r,setClearPhotoInProgress:o,facingMode:a,setFacingMode:n,testOverride:d}=e;const[c,h]=(0,l.useState)(d||N.PENDING),u=(0,l.useRef)(null),[g,p]=(0,l.useState)(s),m=(0,l.useCallback)((0,S.Ds)(1e3,p),[]);(0,l.useEffect)((()=>{m(s)}),[s,m]);const f=(0,_.u)();return(0,U.jsxs)(F,{width:g,"data-testid":"stWebcamComponent",children:[c===N.SUCCESS||i||r?W.tq&&(0,U.jsx)(X,{switchFacingMode:n}):(0,U.jsx)(H,{width:g}),(0,U.jsx)(v,{"data-testid":"stWebcamStyledBox",hidden:c!==N.SUCCESS&&!i&&!r,width:g,children:!i&&(0,U.jsx)(V(),{audio:!1,ref:u,screenshotFormat:"image/jpeg",screenshotQuality:1,width:g,height:9*g/16,style:{borderRadius:"".concat(f.radii.lg," ").concat(f.radii.lg," 0 0")},onUserMediaError:()=>{h(N.ERROR)},onUserMedia:()=>{h(N.SUCCESS),o(!1)},videoConstraints:{width:{ideal:g},facingMode:a}})}),(0,U.jsx)(P,{onClick:function(){if(null!==u.current){const e=u.current.getScreenshot();t(e)}},disabled:c!==N.SUCCESS||i||r,children:"Take Photo"})]})};class K extends l.PureComponent{constructor(e){super(e),this.localFileIdCounter=1,this.RESTORED_FROM_WIDGET_STRING="RESTORED_FROM_WIDGET",this.formClearHelper=new m.K,this.getProgress=()=>{if(this.state.files.length>0&&"uploading"===this.state.files[this.state.files.length-1].status.type){return this.state.files[this.state.files.length-1].status.progress}},this.setClearPhotoInProgress=e=>{this.setState({clearPhotoInProgress:e})},this.setFacingMode=()=>{this.setState((e=>({facingMode:e.facingMode===O.USER?O.ENVIRONMENT:O.USER})))},this.handleCapture=e=>{if(null===e)return Promise.resolve();this.setState({imgSrc:e,shutter:!0,minShutterEffectPassed:!1});return(t=e,s="camera-input-".concat((new Date).toISOString().replace(/:/g,"_"),".jpg"),fetch(t).then((e=>e.arrayBuffer())).then((e=>new File([e],s,{type:"image/jpeg"})))).then((e=>this.props.uploadClient.fetchFileURLs([e]).then((t=>({file:e,fileUrls:t[0]}))))).then((e=>{let{file:t,fileUrls:s}=e;return this.uploadFile(s,t)})).then((()=>{return e=150,new Promise((t=>setTimeout(t,e)));var e})).then((()=>{this.setState(((t,s)=>({imgSrc:e,shutter:t.shutter,minShutterEffectPassed:!0})))})).catch((e=>{(0,f.H)(e)}));var t,s},this.removeCapture=()=>{0!==this.state.files.length&&(this.state.files.forEach((e=>this.deleteFile(e.id))),this.setState({imgSrc:null,clearPhotoInProgress:!0}))},this.componentDidUpdate=()=>{if("ready"!==this.status)return;const e=this.createWidgetValue(),{element:t,widgetMgr:s}=this.props,i=s.getFileUploaderStateValue(t);n()(e,i)||s.setFileUploaderStateValue(t,e,{fromUi:!0})},this.onFormCleared=()=>{this.setState({files:[]},(()=>{const e=this.createWidgetValue();null!=e&&(this.setState({imgSrc:null}),this.props.widgetMgr.setFileUploaderStateValue(this.props.element,e,{fromUi:!0}))}))},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.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((s=>({files:s.files.map((s=>s.id===e?t:s))})))},this.onUploadComplete=(e,t)=>{this.setState((()=>({shutter:!1})));const s=this.getFile(e);null!=s&&"uploading"===s.status.type&&this.updateFile(s.id,s.setStatus({type:"uploaded",fileId:t.fileId,fileUrls:t}))},this.onUploadProgress=(e,t)=>{const s=this.getFile(t);if(null==s||"uploading"!==s.status.type)return;const i=Math.round(100*e.loaded/e.total);s.status.progress!==i&&this.updateFile(t,s.setStatus({type:"uploading",cancelToken:s.status.cancelToken,progress:i}))},this.reset=()=>{this.setState({files:[],imgSrc:null})},this.uploadFile=(e,t)=>{const s=o.Z.CancelToken.source(),i=new C.R(t.name,t.size,this.nextLocalFileId(),{type:"uploading",cancelToken:s,progress:1});this.addFile(i),this.props.uploadClient.uploadFile(this.props.element,e.uploadUrl,t,(e=>this.onUploadProgress(e,i.id)),s.token).then((()=>this.onUploadComplete(i.id,e))).catch((e=>{o.Z.isCancel(e)||this.updateFile(i.id,i.setStatus({type:"error",errorMessage:e?e.toString():"Unknown error"}))}))},this.state=this.initialValue}get initialValue(){const e={files:[],imgSrc:null,shutter:!1,minShutterEffectPassed:!0,clearPhotoInProgress:!1,facingMode:O.USER},{widgetMgr:t,element:s}=this.props,i=t.getFileUploaderStateValue(s);if(null==i)return e;const{uploadedFileInfo:r}=i;return null==r||0===r.length?e:{files:r.map((e=>{const t=e.name,s=e.size,i=e.fileId,r=e.fileUrls;return new C.R(t,s,this.nextLocalFileId(),{type:"uploaded",fileId:i,fileUrls:r})})),imgSrc:0===r.length?"":this.RESTORED_FROM_WIDGET_STRING,shutter:!1,minShutterEffectPassed:!1,clearPhotoInProgress:!1,facingMode:O.USER}}componentWillUnmount(){this.formClearHelper.disconnect()}get status(){return this.state.files.some((e=>"uploading"===e.status.type))?"updating":"ready"}componentDidMount(){const e=this.createWidgetValue(),{element:t,widgetMgr:s}=this.props;void 0===s.getFileUploaderStateValue(t)&&s.setFileUploaderStateValue(t,e,{fromUi:!1})}createWidgetValue(){const e=this.state.files.filter((e=>"uploaded"===e.status.type)).map((e=>{const{name:t,size:s,status:i}=e;return new d.jM({fileId:i.fileId,fileUrls:i.fileUrls,name:t,size:s})}));return new d.xO({uploadedFileInfo:e})}render(){var e;const{element:t,widgetMgr:s,disabled:i,width:o}=this.props;return this.formClearHelper.manageFormClearListener(s,t.formId,this.onFormCleared),(0,U.jsxs)(F,{width:o,className:"row-widget","data-testid":"stCameraInput",children:[(0,U.jsx)(g.O,{label:t.label,disabled:i,labelVisibility:(0,S.iF)(null===(e=t.labelVisibility)||void 0===e?void 0:e.value),children:t.help&&(0,U.jsx)(p.dT,{children:(0,U.jsx)(u.Z,{content:t.help,placement:h.u.TOP_RIGHT})})}),this.state.imgSrc?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(v,{width:o,children:this.state.imgSrc!==this.RESTORED_FROM_WIDGET_STRING&&(0,U.jsx)(M,{src:this.state.imgSrc,alt:"Snapshot",opacity:this.state.shutter||!this.state.minShutterEffectPassed?"50%":"100%",width:o,height:9*o/16})}),(0,U.jsx)(P,{onClick:this.removeCapture,progress:this.getProgress(),disabled:!!this.getProgress()||i,children:this.getProgress()?"Uploading...":(0,U.jsxs)(E,{children:[(0,U.jsx)(c.Z,{content:r.X,margin:"0 xs 0 0",size:"sm"})," Clear photo"]})})]}):(0,U.jsx)($,{handleCapture:this.handleCapture,width:o,disabled:i,clearPhotoInProgress:this.state.clearPhotoInProgress,setClearPhotoInProgress:this.setClearPhotoInProgress,facingMode:this.state.facingMode,setFacingMode:this.setFacingMode,testOverride:this.props.testOverride})]})}nextLocalFileId(){return this.localFileIdCounter++}}const q=K},77367:(e,t,s)=>{s.d(t,{R:()=>i});class i{setStatus(e){return new i(this.name,this.size,this.id,e)}constructor(e,t,s,i){this.name=void 0,this.size=void 0,this.status=void 0,this.id=void 0,this.name=e,this.size=t,this.id=s,this.status=i}}},87814:(e,t,s)=>{s.d(t,{K:()=>r});var i=s(50641);class r{constructor(){this.formClearListener=void 0,this.lastWidgetMgr=void 0,this.lastFormId=void 0}manageFormClearListener(e,t,s){null!=this.formClearListener&&this.lastWidgetMgr===e&&this.lastFormId===t||(this.disconnect(),(0,i.bM)(t)&&(this.formClearListener=e.addFormClearedListener(t,s),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([[7602],{90186:(e,t,s)=>{s.d(t,{$:()=>c,Z:()=>h});var i=s(66845),r=s(25621),o=s(66694),a=s(92627),n=s(38570),l=s(80318),d=s(40864);let c;!function(e){e.EXTRASMALL="xs",e.SMALL="sm",e.MEDIUM="md",e.LARGE="lg",e.EXTRALARGE="xl"}(c||(c={}));const h=function(e){let{value:t,width:s,size:h=c.SMALL,overrides:u}=e;const g=(0,r.u)(),p={xs:g.spacing.twoXS,sm:g.spacing.sm,md:g.spacing.lg,lg:g.spacing.xl,xl:g.spacing.twoXL},{activeTheme:m}=i.useContext(o.E),f=!(0,a.MJ)(m),S={BarContainer:{style:{marginTop:g.spacing.none,marginBottom:g.spacing.none,marginRight:g.spacing.none,marginLeft:g.spacing.none}},Bar:{style:e=>{let{$theme:t}=e;return{width:s?s.toString():void 0,marginTop:g.spacing.none,marginBottom:g.spacing.none,marginRight:g.spacing.none,marginLeft:g.spacing.none,height:p[h],backgroundColor:t.colors.progressbarTrackFill,borderTopLeftRadius:g.spacing.twoXS,borderTopRightRadius:g.spacing.twoXS,borderBottomLeftRadius:g.spacing.twoXS,borderBottomRightRadius:g.spacing.twoXS}}},BarProgress:{style:()=>({backgroundColor:f?g.colors.primary:g.colors.blue70,borderTopLeftRadius:g.spacing.twoXS,borderTopRightRadius:g.spacing.twoXS,borderBottomLeftRadius:g.spacing.twoXS,borderBottomRightRadius:g.spacing.twoXS})}};return(0,d.jsx)(n.Z,{value:t,overrides:(0,l.aO)(S,u)})}},47602:(e,t,s)=>{s.r(t),s.d(t,{default:()=>q});var i,r=s(47869),o=s(23183),a=s(62813),n=s.n(a),l=s(66845),d=s(16295),c=s(46927),h=s(68411),u=s(8879),g=s(98478),p=s(86659),m=s(87814),f=s(23849),S=s(50641),C=s(77367),R=s(90186),x=s(1515),w=s(35704);function b(e,t){switch(e){case i.XSMALL:return{padding:"".concat(t.spacing.twoXS," ").concat(t.spacing.sm),fontSize:t.fontSizes.sm};case i.SMALL:return{padding:"".concat(t.spacing.twoXS," ").concat(t.spacing.md)};case i.LARGE:return{padding:"".concat(t.spacing.md," ").concat(t.spacing.md)};default:return{padding:"".concat(t.spacing.xs," ").concat(t.spacing.md)}}}!function(e){e.XSMALL="xsmall",e.SMALL="small",e.MEDIUM="medium",e.LARGE="large"}(i||(i={}));const F=(0,x.Z)("div",{target:"etz5kuj9"})((()=>({position:"relative",overflow:"hidden",width:"100%",objectFit:"contain"})),""),v=(0,x.Z)("div",{target:"etz5kuj8"})((e=>{let{theme:t,width:s}=e;return{backgroundColor:t.colors.secondaryBg,borderRadius:"".concat(t.radii.lg," ").concat(t.radii.lg," 0 0"),width:"100%",height:9*s/16,display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center"}}),""),I=(0,x.Z)("p",{target:"etz5kuj7"})((e=>{let{theme:t}=e;return{marginTop:t.spacing.sm,textAlign:"center"}}),""),M=(0,x.Z)("img",{target:"etz5kuj6"})((e=>{let{theme:t,opacity:s}=e;return{borderRadius:"".concat(t.radii.lg," ").concat(t.radii.lg," 0 0"),objectFit:"contain",opacity:s}}),""),y=(0,x.Z)("a",{target:"etz5kuj5"})((e=>{let{theme:t}=e;return{color:t.colors.primary,display:"block",textDecoration:"none"}}),""),E=(0,x.Z)("span",{target:"etz5kuj4"})((()=>({display:"flex",alignItems:"center"})),""),T=(0,x.Z)("div",{target:"etz5kuj3"})((e=>{let{theme:t}=e;return{position:"absolute",top:t.spacing.lg,right:t.spacing.lg,zIndex:1,color:t.colors.fadedText40,mixBlendMode:"difference",opacity:.6}}),""),j=(0,x.Z)("div",{target:"etz5kuj1"})((()=>({height:"fit-content",width:"100%",position:"absolute",bottom:0})),""),L=(0,x.Z)("button",{target:"etz5kuj0"})((e=>{let{theme:t}=e;return{position:"relative",display:"inline-flex",flexDirection:"column",alignItems:"center",justifyContent:"center",backgroundColor:t.colors.lightenedBg05,border:"1px solid ".concat(t.colors.fadedText10),borderRadius:"0 0 ".concat(t.radii.lg," ").concat(t.radii.lg),"&:hover":{borderColor:t.colors.primary,color:t.colors.primary},"&:active":{color:t.colors.white,borderColor:t.colors.primary,backgroundColor:t.colors.primary},"&:focus:not(:active)":{borderColor:t.colors.primary,color:t.colors.primary},"&:disabled, &:disabled:hover, &:disabled:active":{color:t.colors.fadedText40},fontWeight:t.fontWeights.normal,padding:"".concat(t.spacing.xs," ").concat(t.spacing.md),margin:0,lineHeight:t.lineHeights.base,color:"inherit",width:"100%",userSelect:"none","&:focus":{outline:"none"},"&:focus-visible":{boxShadow:"0 0 0 0.2rem ".concat((0,w.DZ)(t.colors.primary,.5))},...b(i.MEDIUM,t)}}),"");var U=s(40864);const P=function(e){let{disabled:t,onClick:s,children:i,progress:r}=e;return(0,U.jsxs)(L,{disabled:t||!1,onClick:s||(()=>{}),progress:r||null,"data-testid":"stCameraInputButton",children:[i,r&&(0,U.jsx)(j,{children:(0,U.jsx)(R.Z,{value:r,size:R.$.EXTRASMALL,overrides:{Bar:{style:{borderTopLeftRadius:"0px",borderTopRightRadius:"0px"}},BarProgress:{style:{borderTopLeftRadius:"0px",borderTopRightRadius:"0px"}},BarContainer:{style:{borderTopLeftRadius:"0px",borderTopRightRadius:"0px"}}}})})]})};var k=s(77979),z=s(9003),Z=s(81354),D=s(11765);let O;!function(e){e.USER="user",e.ENVIRONMENT="environment"}(O||(O={}));const X=e=>{let{switchFacingMode:t}=e;return(0,U.jsx)(T,{"data-testid":"stCameraSwitchButton",children:(0,U.jsx)(h.Z,{content:"Switch camera",placement:h.u.TOP_RIGHT,children:(0,U.jsx)(z.ZP,{kind:Z.nW.MINIMAL,onClick:t,children:(0,U.jsx)(c.Z,{content:k.Z,size:"twoXL",color:D.Z.white})})})})};var B=s(3084),_=s(25621),W=s(91706),A=s(48051),V=s.n(A),G=s(84192);let N;!function(e){e.PENDING="pending",e.SUCCESS="success",e.ERROR="error"}(N||(N={}));const H=e=>{let{width:t}=e;return(0,U.jsxs)(v,{width:t,children:[(0,U.jsx)(c.Z,{size:"threeXL",color:D.Z.gray60,content:B.n}),(0,U.jsxs)(I,{children:["This app would like to use your camera.",(0,U.jsx)(y,{href:G.U3,rel:"noopener noreferrer",target:"_blank",children:"Learn how to allow access."})]})]})},$=e=>{let{handleCapture:t,width:s,disabled:i,clearPhotoInProgress:r,setClearPhotoInProgress:o,facingMode:a,setFacingMode:n,testOverride:d}=e;const[c,h]=(0,l.useState)(d||N.PENDING),u=(0,l.useRef)(null),[g,p]=(0,l.useState)(s),m=(0,l.useCallback)((0,S.Ds)(1e3,p),[]);(0,l.useEffect)((()=>{m(s)}),[s,m]);const f=(0,_.u)();return(0,U.jsxs)(F,{width:g,"data-testid":"stWebcamComponent",children:[c===N.SUCCESS||i||r?W.tq&&(0,U.jsx)(X,{switchFacingMode:n}):(0,U.jsx)(H,{width:g}),(0,U.jsx)(v,{"data-testid":"stWebcamStyledBox",hidden:c!==N.SUCCESS&&!i&&!r,width:g,children:!i&&(0,U.jsx)(V(),{audio:!1,ref:u,screenshotFormat:"image/jpeg",screenshotQuality:1,width:g,height:9*g/16,style:{borderRadius:"".concat(f.radii.lg," ").concat(f.radii.lg," 0 0")},onUserMediaError:()=>{h(N.ERROR)},onUserMedia:()=>{h(N.SUCCESS),o(!1)},videoConstraints:{width:{ideal:g},facingMode:a}})}),(0,U.jsx)(P,{onClick:function(){if(null!==u.current){const e=u.current.getScreenshot();t(e)}},disabled:c!==N.SUCCESS||i||r,children:"Take Photo"})]})};class K extends l.PureComponent{constructor(e){super(e),this.localFileIdCounter=1,this.RESTORED_FROM_WIDGET_STRING="RESTORED_FROM_WIDGET",this.formClearHelper=new m.K,this.getProgress=()=>{if(this.state.files.length>0&&"uploading"===this.state.files[this.state.files.length-1].status.type){return this.state.files[this.state.files.length-1].status.progress}},this.setClearPhotoInProgress=e=>{this.setState({clearPhotoInProgress:e})},this.setFacingMode=()=>{this.setState((e=>({facingMode:e.facingMode===O.USER?O.ENVIRONMENT:O.USER})))},this.handleCapture=e=>{if(null===e)return Promise.resolve();this.setState({imgSrc:e,shutter:!0,minShutterEffectPassed:!1});return(t=e,s="camera-input-".concat((new Date).toISOString().replace(/:/g,"_"),".jpg"),fetch(t).then((e=>e.arrayBuffer())).then((e=>new File([e],s,{type:"image/jpeg"})))).then((e=>this.props.uploadClient.fetchFileURLs([e]).then((t=>({file:e,fileUrls:t[0]}))))).then((e=>{let{file:t,fileUrls:s}=e;return this.uploadFile(s,t)})).then((()=>{return e=150,new Promise((t=>setTimeout(t,e)));var e})).then((()=>{this.setState(((t,s)=>({imgSrc:e,shutter:t.shutter,minShutterEffectPassed:!0})))})).catch((e=>{(0,f.H)(e)}));var t,s},this.removeCapture=()=>{0!==this.state.files.length&&(this.state.files.forEach((e=>this.deleteFile(e.id))),this.setState({imgSrc:null,clearPhotoInProgress:!0}))},this.componentDidUpdate=()=>{if("ready"!==this.status)return;const e=this.createWidgetValue(),{element:t,widgetMgr:s}=this.props,i=s.getFileUploaderStateValue(t);n()(e,i)||s.setFileUploaderStateValue(t,e,{fromUi:!0})},this.onFormCleared=()=>{this.setState({files:[]},(()=>{const e=this.createWidgetValue();null!=e&&(this.setState({imgSrc:null}),this.props.widgetMgr.setFileUploaderStateValue(this.props.element,e,{fromUi:!0}))}))},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.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((s=>({files:s.files.map((s=>s.id===e?t:s))})))},this.onUploadComplete=(e,t)=>{this.setState((()=>({shutter:!1})));const s=this.getFile(e);null!=s&&"uploading"===s.status.type&&this.updateFile(s.id,s.setStatus({type:"uploaded",fileId:t.fileId,fileUrls:t}))},this.onUploadProgress=(e,t)=>{const s=this.getFile(t);if(null==s||"uploading"!==s.status.type)return;const i=Math.round(100*e.loaded/e.total);s.status.progress!==i&&this.updateFile(t,s.setStatus({type:"uploading",cancelToken:s.status.cancelToken,progress:i}))},this.reset=()=>{this.setState({files:[],imgSrc:null})},this.uploadFile=(e,t)=>{const s=o.Z.CancelToken.source(),i=new C.R(t.name,t.size,this.nextLocalFileId(),{type:"uploading",cancelToken:s,progress:1});this.addFile(i),this.props.uploadClient.uploadFile(this.props.element,e.uploadUrl,t,(e=>this.onUploadProgress(e,i.id)),s.token).then((()=>this.onUploadComplete(i.id,e))).catch((e=>{o.Z.isCancel(e)||this.updateFile(i.id,i.setStatus({type:"error",errorMessage:e?e.toString():"Unknown error"}))}))},this.state=this.initialValue}get initialValue(){const e={files:[],imgSrc:null,shutter:!1,minShutterEffectPassed:!0,clearPhotoInProgress:!1,facingMode:O.USER},{widgetMgr:t,element:s}=this.props,i=t.getFileUploaderStateValue(s);if(null==i)return e;const{uploadedFileInfo:r}=i;return null==r||0===r.length?e:{files:r.map((e=>{const t=e.name,s=e.size,i=e.fileId,r=e.fileUrls;return new C.R(t,s,this.nextLocalFileId(),{type:"uploaded",fileId:i,fileUrls:r})})),imgSrc:0===r.length?"":this.RESTORED_FROM_WIDGET_STRING,shutter:!1,minShutterEffectPassed:!1,clearPhotoInProgress:!1,facingMode:O.USER}}componentWillUnmount(){this.formClearHelper.disconnect()}get status(){return this.state.files.some((e=>"uploading"===e.status.type))?"updating":"ready"}componentDidMount(){const e=this.createWidgetValue(),{element:t,widgetMgr:s}=this.props;void 0===s.getFileUploaderStateValue(t)&&s.setFileUploaderStateValue(t,e,{fromUi:!1})}createWidgetValue(){const e=this.state.files.filter((e=>"uploaded"===e.status.type)).map((e=>{const{name:t,size:s,status:i}=e;return new d.jM({fileId:i.fileId,fileUrls:i.fileUrls,name:t,size:s})}));return new d.xO({uploadedFileInfo:e})}render(){var e;const{element:t,widgetMgr:s,disabled:i,width:o}=this.props;return this.formClearHelper.manageFormClearListener(s,t.formId,this.onFormCleared),(0,U.jsxs)(F,{width:o,className:"row-widget","data-testid":"stCameraInput",children:[(0,U.jsx)(g.O,{label:t.label,disabled:i,labelVisibility:(0,S.iF)(null===(e=t.labelVisibility)||void 0===e?void 0:e.value),children:t.help&&(0,U.jsx)(p.dT,{children:(0,U.jsx)(u.Z,{content:t.help,placement:h.u.TOP_RIGHT})})}),this.state.imgSrc?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(v,{width:o,children:this.state.imgSrc!==this.RESTORED_FROM_WIDGET_STRING&&(0,U.jsx)(M,{src:this.state.imgSrc,alt:"Snapshot",opacity:this.state.shutter||!this.state.minShutterEffectPassed?"50%":"100%",width:o,height:9*o/16})}),(0,U.jsx)(P,{onClick:this.removeCapture,progress:this.getProgress(),disabled:!!this.getProgress()||i,children:this.getProgress()?"Uploading...":(0,U.jsxs)(E,{children:[(0,U.jsx)(c.Z,{content:r.X,margin:"0 xs 0 0",size:"sm"})," Clear photo"]})})]}):(0,U.jsx)($,{handleCapture:this.handleCapture,width:o,disabled:i,clearPhotoInProgress:this.state.clearPhotoInProgress,setClearPhotoInProgress:this.setClearPhotoInProgress,facingMode:this.state.facingMode,setFacingMode:this.setFacingMode,testOverride:this.props.testOverride})]})}nextLocalFileId(){return this.localFileIdCounter++}}const q=K},77367:(e,t,s)=>{s.d(t,{R:()=>i});class i{setStatus(e){return new i(this.name,this.size,this.id,e)}constructor(e,t,s,i){this.name=void 0,this.size=void 0,this.status=void 0,this.id=void 0,this.name=e,this.size=t,this.id=s,this.status=i}}},87814:(e,t,s)=>{s.d(t,{K:()=>r});var i=s(50641);class r{constructor(){this.formClearListener=void 0,this.lastWidgetMgr=void 0,this.lastFormId=void 0}manageFormClearListener(e,t,s){null!=this.formClearListener&&this.lastWidgetMgr===e&&this.lastFormId===t||(this.disconnect(),(0,i.bM)(t)&&(this.formClearListener=e.addFormClearedListener(t,s),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}}}}]);
|