streamlit-nightly 1.39.1.dev20241010__py2.py3-none-any.whl → 1.39.1.dev20241011__py2.py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. streamlit/static/asset-manifest.json +13 -14
  2. streamlit/static/index.html +1 -1
  3. streamlit/static/static/js/223.8bd97055.chunk.js +1 -0
  4. streamlit/static/static/js/3224.fb4ce2a4.chunk.js +1 -0
  5. streamlit/static/static/js/4856.03868952.chunk.js +2 -0
  6. streamlit/static/static/js/5849.e92568db.chunk.js +1 -0
  7. streamlit/static/static/js/6073.192808c1.chunk.js +1 -0
  8. streamlit/static/static/js/6141.d2879825.chunk.js +1 -0
  9. streamlit/static/static/js/8148.aed4a6f0.chunk.js +1 -0
  10. streamlit/static/static/js/8237.5de71f48.chunk.js +1 -0
  11. streamlit/static/static/js/{8460.3529d92b.chunk.js → 8460.40cba8ba.chunk.js} +1 -1
  12. streamlit/static/static/js/9923.21b1d895.chunk.js +1 -0
  13. streamlit/static/static/js/9943.d54fcda3.chunk.js +1 -0
  14. streamlit/static/static/js/main.7269acf4.js +28 -0
  15. {streamlit_nightly-1.39.1.dev20241010.dist-info → streamlit_nightly-1.39.1.dev20241011.dist-info}/METADATA +1 -1
  16. {streamlit_nightly-1.39.1.dev20241010.dist-info → streamlit_nightly-1.39.1.dev20241011.dist-info}/RECORD +22 -23
  17. streamlit/static/static/js/1780.3f47c955.chunk.js +0 -1
  18. streamlit/static/static/js/2133.68768c00.chunk.js +0 -1
  19. streamlit/static/static/js/223.7f001ddb.chunk.js +0 -1
  20. streamlit/static/static/js/238.8d3a7d25.chunk.js +0 -1
  21. streamlit/static/static/js/6141.43a8fda3.chunk.js +0 -1
  22. streamlit/static/static/js/7612.3f409b56.chunk.js +0 -2
  23. streamlit/static/static/js/8148.0afeecaa.chunk.js +0 -1
  24. streamlit/static/static/js/8237.b58252d4.chunk.js +0 -1
  25. streamlit/static/static/js/8776.4a234e13.chunk.js +0 -1
  26. streamlit/static/static/js/9923.50362c7d.chunk.js +0 -1
  27. streamlit/static/static/js/9943.29cd4b6c.chunk.js +0 -1
  28. streamlit/static/static/js/main.d13622b4.js +0 -28
  29. /streamlit/static/static/js/{7612.3f409b56.chunk.js.LICENSE.txt → 4856.03868952.chunk.js.LICENSE.txt} +0 -0
  30. /streamlit/static/static/js/{main.d13622b4.js.LICENSE.txt → main.7269acf4.js.LICENSE.txt} +0 -0
  31. {streamlit_nightly-1.39.1.dev20241010.data → streamlit_nightly-1.39.1.dev20241011.data}/scripts/streamlit.cmd +0 -0
  32. {streamlit_nightly-1.39.1.dev20241010.dist-info → streamlit_nightly-1.39.1.dev20241011.dist-info}/WHEEL +0 -0
  33. {streamlit_nightly-1.39.1.dev20241010.dist-info → streamlit_nightly-1.39.1.dev20241011.dist-info}/entry_points.txt +0 -0
  34. {streamlit_nightly-1.39.1.dev20241010.dist-info → streamlit_nightly-1.39.1.dev20241011.dist-info}/top_level.txt +0 -0
@@ -1,28 +1,28 @@
1
1
  {
2
2
  "files": {
3
3
  "main.css": "./static/css/main.5513bd04.css",
4
- "main.js": "./static/js/main.d13622b4.js",
4
+ "main.js": "./static/js/main.7269acf4.js",
5
5
  "static/js/6679.265ca09c.chunk.js": "./static/js/6679.265ca09c.chunk.js",
6
6
  "static/js/9464.7e9a3c0a.chunk.js": "./static/js/9464.7e9a3c0a.chunk.js",
7
7
  "static/js/9077.721329d6.chunk.js": "./static/js/9077.721329d6.chunk.js",
8
8
  "static/js/3391.7aba08a0.chunk.js": "./static/js/3391.7aba08a0.chunk.js",
9
9
  "static/css/9943.d452238e.chunk.css": "./static/css/9943.d452238e.chunk.css",
10
- "static/js/9943.29cd4b6c.chunk.js": "./static/js/9943.29cd4b6c.chunk.js",
11
- "static/js/8460.3529d92b.chunk.js": "./static/js/8460.3529d92b.chunk.js",
10
+ "static/js/9943.d54fcda3.chunk.js": "./static/js/9943.d54fcda3.chunk.js",
11
+ "static/js/8460.40cba8ba.chunk.js": "./static/js/8460.40cba8ba.chunk.js",
12
12
  "static/js/3861.5aea56b8.chunk.js": "./static/js/3861.5aea56b8.chunk.js",
13
13
  "static/js/8642.58110d15.chunk.js": "./static/js/8642.58110d15.chunk.js",
14
- "static/js/223.7f001ddb.chunk.js": "./static/js/223.7f001ddb.chunk.js",
15
- "static/js/8148.0afeecaa.chunk.js": "./static/js/8148.0afeecaa.chunk.js",
14
+ "static/js/223.8bd97055.chunk.js": "./static/js/223.8bd97055.chunk.js",
15
+ "static/js/8148.aed4a6f0.chunk.js": "./static/js/8148.aed4a6f0.chunk.js",
16
16
  "static/js/84.414fa87b.chunk.js": "./static/js/84.414fa87b.chunk.js",
17
- "static/js/9923.50362c7d.chunk.js": "./static/js/9923.50362c7d.chunk.js",
17
+ "static/js/9923.21b1d895.chunk.js": "./static/js/9923.21b1d895.chunk.js",
18
18
  "static/js/583.61ac7fde.chunk.js": "./static/js/583.61ac7fde.chunk.js",
19
19
  "static/js/4827.70332470.chunk.js": "./static/js/4827.70332470.chunk.js",
20
- "static/js/8237.b58252d4.chunk.js": "./static/js/8237.b58252d4.chunk.js",
20
+ "static/js/8237.5de71f48.chunk.js": "./static/js/8237.5de71f48.chunk.js",
21
21
  "static/js/5828.f8572ba4.chunk.js": "./static/js/5828.f8572ba4.chunk.js",
22
- "static/js/1780.3f47c955.chunk.js": "./static/js/1780.3f47c955.chunk.js",
22
+ "static/js/3224.fb4ce2a4.chunk.js": "./static/js/3224.fb4ce2a4.chunk.js",
23
23
  "static/js/9060.1ec8dc2b.chunk.js": "./static/js/9060.1ec8dc2b.chunk.js",
24
24
  "static/js/5625.c56e64cd.chunk.js": "./static/js/5625.c56e64cd.chunk.js",
25
- "static/js/6141.43a8fda3.chunk.js": "./static/js/6141.43a8fda3.chunk.js",
25
+ "static/js/6141.d2879825.chunk.js": "./static/js/6141.d2879825.chunk.js",
26
26
  "static/js/4103.a5610a9d.chunk.js": "./static/js/4103.a5610a9d.chunk.js",
27
27
  "static/js/1086.fba3f8f8.chunk.js": "./static/js/1086.fba3f8f8.chunk.js",
28
28
  "static/js/245.1eea9c21.chunk.js": "./static/js/245.1eea9c21.chunk.js",
@@ -49,21 +49,20 @@
49
49
  "static/js/8648.92079acf.chunk.js": "./static/js/8648.92079acf.chunk.js",
50
50
  "static/js/766.e3700e32.chunk.js": "./static/js/766.e3700e32.chunk.js",
51
51
  "static/js/783.788bb3ab.chunk.js": "./static/js/783.788bb3ab.chunk.js",
52
- "static/js/2133.68768c00.chunk.js": "./static/js/2133.68768c00.chunk.js",
52
+ "static/js/5849.e92568db.chunk.js": "./static/js/5849.e92568db.chunk.js",
53
53
  "static/css/4096.8b8f33d6.chunk.css": "./static/css/4096.8b8f33d6.chunk.css",
54
54
  "static/js/4096.178414b7.chunk.js": "./static/js/4096.178414b7.chunk.js",
55
- "static/js/7612.3f409b56.chunk.js": "./static/js/7612.3f409b56.chunk.js",
55
+ "static/js/4856.03868952.chunk.js": "./static/js/4856.03868952.chunk.js",
56
56
  "static/js/3389.71902a75.chunk.js": "./static/js/3389.71902a75.chunk.js",
57
57
  "static/js/4297.3afbdd03.chunk.js": "./static/js/4297.3afbdd03.chunk.js",
58
58
  "static/js/4942.e4db7877.chunk.js": "./static/js/4942.e4db7877.chunk.js",
59
- "static/js/8776.4a234e13.chunk.js": "./static/js/8776.4a234e13.chunk.js",
59
+ "static/js/6073.192808c1.chunk.js": "./static/js/6073.192808c1.chunk.js",
60
60
  "static/js/2627.2462a014.chunk.js": "./static/js/2627.2462a014.chunk.js",
61
61
  "static/js/5764.5a55e5be.chunk.js": "./static/js/5764.5a55e5be.chunk.js",
62
62
  "static/js/797.36f1bf7d.chunk.js": "./static/js/797.36f1bf7d.chunk.js",
63
63
  "static/js/6198.956025ac.chunk.js": "./static/js/6198.956025ac.chunk.js",
64
64
  "static/js/1674.86aea8e0.chunk.js": "./static/js/1674.86aea8e0.chunk.js",
65
65
  "static/js/7591.b3928443.chunk.js": "./static/js/7591.b3928443.chunk.js",
66
- "static/js/238.8d3a7d25.chunk.js": "./static/js/238.8d3a7d25.chunk.js",
67
66
  "static/media/MaterialSymbols-Rounded.woff2": "./static/media/MaterialSymbols-Rounded.ec07649f7a20048d5730.woff2",
68
67
  "static/media/fireworks.gif": "./static/media/fireworks.0906f02ea43f1018a6d2.gif",
69
68
  "static/media/flake-2.png": "./static/media/flake-2.e3f07d06933dd0e84c24.png",
@@ -154,6 +153,6 @@
154
153
  },
155
154
  "entrypoints": [
156
155
  "static/css/main.5513bd04.css",
157
- "static/js/main.d13622b4.js"
156
+ "static/js/main.7269acf4.js"
158
157
  ]
159
158
  }
@@ -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.d13622b4.js"></script><link href="./static/css/main.5513bd04.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div></body></html>
1
+ <!doctype html><html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width,initial-scale=1,shrink-to-fit=no"/><link rel="shortcut icon" href="./favicon.png"/><link rel="preload" href="./static/media/SourceSansPro-Regular.0d69e5ff5e92ac64a0c9.woff2" as="font" type="font/woff2" crossorigin><link rel="preload" href="./static/media/SourceSansPro-SemiBold.abed79cd0df1827e18cf.woff2" as="font" type="font/woff2" crossorigin><link rel="preload" href="./static/media/SourceSansPro-Bold.118dea98980e20a81ced.woff2" as="font" type="font/woff2" crossorigin><title>Streamlit</title><script>window.prerenderReady=!1</script><script defer="defer" src="./static/js/main.7269acf4.js"></script><link href="./static/css/main.5513bd04.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div></body></html>
@@ -0,0 +1 @@
1
+ "use strict";(self.webpackChunk_streamlit_app=self.webpackChunk_streamlit_app||[]).push([[223],{40223:(e,t,o)=>{o.r(t),o.d(t,{default:()=>Se});var i=o(58878),n=o(86411),r=o(83614),l=o(34679),s=o(93594),a=o(78477),c=o(8151),d=o(68994),h=o(58144),u=o(29669);var g=o(85850),m=o(59323),p=o(4494),f=o(53124),b=o.n(f),v=o(32782),x=o(67253),y=o(1780),C=o(84152),w=o(6240),S=o(90782);const j=e=>{let{error:t,width:o,deltaType:i}=e;return t instanceof k?(0,S.jsx)(w.A,{width:o,name:"No Mapbox token provided",message:(0,S.jsxs)(S.Fragment,{children:[(0,S.jsxs)("p",{children:["To use ",(0,S.jsxs)("code",{children:["st.",i]})," or ",(0,S.jsx)("code",{children:"st.map"})," you need to set up a Mapbox access token."]}),(0,S.jsxs)("p",{children:["To get a token, create an account at"," ",(0,S.jsx)("a",{href:"https://mapbox.com",children:"https://mapbox.com"}),". It's free for moderate usage levels!"]}),(0,S.jsxs)("p",{children:["Once you have a token, just set it using the Streamlit config option ",(0,S.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,S.jsxs)("p",{children:["See"," ",(0,S.jsx)("a",{href:"https://docs.streamlit.io/develop/api-reference/configuration/config.toml",children:"our documentation"})," ","for more info on how to set config options."]})]})}):t instanceof F?(0,S.jsx)(w.A,{width:o,name:"Error fetching Streamlit Mapbox token",message:(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)("p",{children:"This app requires an internet connection."}),(0,S.jsx)("p",{children:"Please check your connection and try again."}),(0,S.jsxs)("p",{children:["If you think this is a bug, please file bug report"," ",(0,S.jsx)("a",{href:"https://github.com/streamlit/streamlit/issues/new/choose",children:"here"}),"."]})]})}):(0,S.jsx)(w.A,{width:o,name:"Error fetching Streamlit Mapbox token",message:t.message})};class k extends Error{}class F extends Error{}const A="https://data.streamlit.io/tokens.json",M="mapbox",T=e=>t=>{class o extends i.PureComponent{constructor(o){super(o),this.context=void 0,this.initMapboxToken=async()=>{try{const e=await v.A.get(A),{[M]:t}=e.data;if(!t)throw new Error(`Missing token ${M}`);this.setState({mapboxToken:t,isFetching:!1})}catch(e){const t=(0,x.$)(e);throw this.setState({mapboxTokenError:t,isFetching:!1}),new F(`${t.message} (${A})`)}},this.render=()=>{const{mapboxToken:o,mapboxTokenError:i,isFetching:n}=this.state,{width:r}=this.props;return i?(0,S.jsx)(j,{width:r,error:i,deltaType:e}):n?(0,S.jsx)(y.E,{element:u.EA.create({style:u.EA.SkeletonStyle.ELEMENT})}):(0,S.jsx)(t,{...this.props,mapboxToken:o,width:r})},this.state={isFetching:!0,mapboxToken:void 0,mapboxTokenError:void 0}}componentDidMount(){const e=this.props.element.mapboxToken||this.context.libConfig.mapboxToken;e?this.setState({mapboxToken:e,isFetching:!1}):this.initMapboxToken()}}return o.displayName=`withMapboxToken(${t.displayName||t.name})`,o.contextType=C.n,b()(o,t)};var E=o(89653);const I=(0,E.A)("div",{target:"e1az0zs51"})((e=>{let{width:t,height:o}=e;return{position:"relative",height:o,width:t}}),""),N=(0,E.A)("div",{target:"e1az0zs50"})((e=>{let{theme:t}=e;return{position:"absolute",right:"2.625rem",top:t.spacing.md,zIndex:t.zIndices.priority,".mapboxgl-ctrl.mapboxgl-ctrl-group":{overflow:"hidden",background:t.colors.bgColor},"button:not(:disabled)":{background:t.colors.bgColor,"& + button":{borderTopColor:t.colors.secondaryBg},"&.mapboxgl-ctrl-icon:hover":{backgroundColor:t.colors.darkenedBgMix25},"& span":{filter:(0,h.iq)(t)?"":"invert(100%)"}}}}),"");var O=o(21640),L=o(71034),$=o.n(L),W=o(32735);var z=o(3101),V=o(71279),_=o(95237),D=o(19507),B=o(89428),P=o(28246),U=o(54340),J=o(66643);const X={classes:{...P,...o(43539),...J,...o(41260),...V.bE},functions:{colorBins:_.A,colorCategories:D.A,colorContinuous:B.A}},q=new U.A({configuration:X});var G=o(39017),K=o(86044),R=o(94514),Z=o(10623),H=o(55296),Q=o(97091),Y=o(25479),ee=o(16249),te=o(46909),oe=o(56605),ie=o(48754),ne=o(16389),re=o(57741),le=o(82111),se=o(40973),ae=o(34632),ce=o(34895),de=o(77277),he=o(39481),ue=o(47605);const ge={[ne.A.layerName]:["getFillColor"],[re.A.layerName]:["getFillColor"],[le.A.layerName]:["getFillColor"],[se.A.layerName]:["getFillColor"],[ae.A.layerName]:["getFillColor"],[ce.A.layerName]:["getFillColor"],[de.A.layerName]:["getColor"],[G.A.layerName]:["getTargetColor","getSourceColor"],[K.A.layerName]:["getFillColor"],[R.A.layerName]:["getFillColor"],[Z.A.layerName]:["getColor"],[H.A.layerName]:["getColor"],[Q.A.layerName]:["getColor"],[Y.A.layerName]:["getColor"],[ee.A.layerName]:["getFillColor"],[te.A.layerName]:["getFillColor","getColor","getLineColor"],[oe.A.layerName]:["getFillColor"],[ie.A.layerName]:["getColor"],[he.A.layerName]:["getColor"],[ue.A.layerName]:["getColor"]},me=e=>{let{isSelected:t,object:o,objectInfo:i,opacity:n,originalFillFunction:r}=e;const l=(e=>{let{object:t,objectInfo:o,originalFillFunction:i}=e;const n="function"===typeof i?i(t,o):i;if(Array.isArray(n))return[n[0]||0,n[1]||0,n[2]||0,n[3]||255];if("string"===typeof n&&n.startsWith("@@=")){const e=q.convert({originalColor:n}).originalColor(t);return[e[0]||0,e[1]||0,e[2]||0,e[3]||255]}return null})({object:o,objectInfo:i,originalFillFunction:r});if(!l)return null;let s=0;return s=t?Math.max("number"===typeof l[3]?l[3]:n,n):Math.min("number"===typeof l[3]?l[3]:n,n),[l[0]||0,l[1]||0,l[2]||0,s]},pe={selection:{indices:{},objects:{}}},fe=(e,t)=>{const o=t.match(/{(.*?)}/g);return o&&o.forEach((o=>{const i=o.substring(1,o.length-1);e.object.hasOwnProperty(i)?t=t.replace(o,e.object[i]):e.object.hasOwnProperty("properties")&&e.object.properties.hasOwnProperty(i)&&(t=t.replace(o,e.object.properties[i]))})),t};function be(e,t){if(!t.id)return pe;const o=e.getElementState(t.id,"selection");return null!==o&&void 0!==o?o:pe}function ve(e,t){if(!t.id)return pe;const o=e.getStringValue(t),i=o?O.A.parse(o):null;return null!==i&&void 0!==i?i:pe}function xe(e,t,o,i){e.id&&t.setStringValue(e,JSON.stringify(o.value),{fromUi:o.fromUi},i)}const ye=e=>{var t;const{height:o,width:n,expanded:r}=(0,m.i)(p.T),{element:l,fragmentId:s,isLightTheme:a,theme:c,widgetMgr:d}=e,{selectionMode:h,tooltip:u,useContainerWidth:g}=l,f=null!==r&&void 0!==r&&r,[b,v]=(0,z._)({element:l,getDefaultState:be,getStateFromWidgetMgr:ve,updateWidgetMgrState:xe,widgetMgr:d,fragmentId:s}),[x,y]=(0,i.useState)({bearing:0,pitch:0,zoom:11}),{height:C,width:w}=(e=>{let{container:t,element:o,heightFallback:n="auto",isFullScreen:r,shouldUseContainerWidth:l,widthFallback:s="auto"}=e;return{width:(0,i.useMemo)((()=>l||r?"100%":o.width||t.width||s),[t.width,o.width,r,l,s]),height:(0,i.useMemo)((()=>r&&t.height?t.height:o.height||t.height||n),[r,o.height,t.height,n])}})({element:l,isFullScreen:f,shouldUseContainerWidth:g,container:{height:o,width:n},heightFallback:(null===(t=x.initialViewState)||void 0===t?void 0:t.height)||500}),[S,j]=(0,i.useState)({}),k=h[0],F=void 0!==k,A=F&&Object.keys(b.selection.indices).length>0,M=(0,i.useMemo)((()=>Object.freeze(O.A.parse(l.json))),[f,a,l.json]),T=(0,i.useMemo)((()=>{const e={...M};if(e.mapStyle||(e.mapStyle=`mapbox://styles/mapbox/${a?"light":"dark"}-v9`),e.layers){const t=Object.values(b.selection.indices).some((e=>null===e||void 0===e?void 0:e.length)),o=e.layers.some((e=>Object.hasOwn(e,"pickable")));e.layers=e.layers.map((e=>{var i,n;if(!e||Array.isArray(e)||!F)return e;o||(e.pickable=!0);const r=`${e.id||null}`,l=(null===b||void 0===b||null===(i=b.selection)||void 0===i||null===(n=i.indices)||void 0===n?void 0:n[r])||[],s=ge[e["@@type"]];if(!s)return e;const a={...e};return s.forEach((o=>{var i;a.updateTriggers={[o]:[...(null===(i=a.updateTriggers)||void 0===i?void 0:i[o])||[],l,t]};const n=!t,r=e[o];if(n||!r)return a;const s=Math.floor(102),d=(0,W.Du)(c.colors.primary),h=[d[0],d[1],d[2],255],u=(0,W.Du)(c.colors.gray20),g=[u[0],u[1],u[2],s];a[o]=(e,t)=>(e=>{let{isSelected:t,object:o,objectInfo:i,originalFillFunction:n,selectedColor:r,selectedOpacity:l=255,unselectedColor:s,unselectedOpacity:a=Math.floor(102)}=e;return t?me({opacity:l,isSelected:!0,object:o,objectInfo:i,originalFillFunction:n})||r:me({opacity:a,isSelected:!1,object:o,objectInfo:i,originalFillFunction:n})||s})({isSelected:l.includes(t.index),object:e,objectInfo:t,originalFillFunction:r,selectedColor:h,unselectedColor:g,selectedOpacity:255,unselectedOpacity:s})})),a}))}return null===e||void 0===e||delete e.views,q.convert(e)}),[b.selection.indices,a,F,M,c.colors.gray20,c.colors.primary]);(0,i.useEffect)((()=>{if(!$()(T.initialViewState,S)){const e=Object.keys(T.initialViewState).reduce(((e,t)=>T.initialViewState[t]===S[t]?e:{...e,[t]:T.initialViewState[t]}),{});y({...x,...e}),j(T.initialViewState)}}),[T.initialViewState,S,x]);const E=(0,i.useCallback)((e=>{if(!e||!e.object||!u)return null;const t=O.A.parse(u);return t.html?t.html=fe(e,t.html):t.text=fe(e,t.text),t}),[u]),I=(0,i.useCallback)((e=>{let{viewState:t}=e;y(t)}),[y]);return{createTooltip:E,data:b,deck:T,hasActiveSelection:A,height:C,isSelectionModeActivated:F,onViewStateChange:I,selectionMode:k,setSelection:v,viewState:x,width:w}};o(93298);(0,a.mk)([l.y,s.B]);const Ce=pe.selection,we=[],Se=T("st.pydeck_chart")((e=>{const{disabled:t,disableFullscreenMode:o,element:l,fragmentId:s,mapboxToken:a,widgetMgr:f}=e,{mapboxToken:b}=l,v=(0,c.u)(),{expanded:x,expand:y,collapse:C}=(0,m.i)(p.T),{createTooltip:w,data:j,deck:k,hasActiveSelection:F,height:A,isSelectionModeActivated:M,onViewStateChange:T,selectionMode:E,setSelection:O,viewState:L,width:$}=ye({element:l,fragmentId:s,isLightTheme:(0,h.iq)(v),theme:v,widgetMgr:f}),[W,z]=(0,i.useState)(!1);(0,i.useEffect)((()=>{z(!0)}),[]);const V=(0,i.useCallback)((e=>{var t;if(void 0===E)return;const{index:o,object:i}=e,n=`${(null===(t=e.layer)||void 0===t?void 0:t.id)||null}`,r=j,l=-1===o,s=(()=>{if(l)return Ce;switch(E){case u.Xw.SelectionMode.SINGLE_OBJECT:var e;return(null===(e=r.selection.indices[n])||void 0===e?void 0:e[0])===o?Ce:{indices:{[`${n}`]:[o]},objects:{[`${n}`]:[i]}};case u.Xw.SelectionMode.MULTI_OBJECT:{const e=new Map(((null===r||void 0===r||null===(t=r.selection)||void 0===t||null===(s=t.indices)||void 0===s?void 0:s[n])||[]).map(((e,t)=>{var o,i,l;return[e,null===(o=r.selection)||void 0===o||null===(i=o.objects)||void 0===i||null===(l=i[n])||void 0===l?void 0:l[t]]})));if(e.has(o)?e.delete(o):e.set(o,i),0===e.size){const{[n]:e,...t}=r.selection.indices,{[n]:o,...i}=r.selection.objects;return{indices:t,objects:i}}return{indices:{...r.selection.indices,[`${n}`]:Array.from(e.keys())},objects:{...r.selection.objects,[`${n}`]:Array.from(e.values())}}}default:throw(e=>{throw new Error(`Reached a branch with non-exhaustive item: ${e}`)})(E),new Error("Invalid selection mode")}var t,s})();JSON.stringify(s)!==JSON.stringify(r.selection)&&O({fromUi:!0,value:{selection:s}})}),[E,j,O]),_=(0,i.useCallback)((()=>{O({value:{selection:Ce},fromUi:!0})}),[O]);return(0,S.jsxs)(I,{className:"stDeckGlJsonChart","data-testid":"stDeckGlJsonChart",width:$,height:A,children:[(0,S.jsx)(g.A,{isFullScreen:x,disableFullscreenMode:o,onExpand:y,onCollapse:C,target:I,locked:!(!F||t)||void 0,children:F&&!t&&(0,S.jsx)(g.K,{label:"Clear selection",onClick:_,icon:d.b})}),(0,S.jsxs)(n.A,{viewState:L,onViewStateChange:T,height:A,width:$,layers:W?k.layers:we,getTooltip:w,ContextProvider:r.wZ.Provider,controller:!0,onClick:M&&!t?V:void 0,children:[(0,S.jsx)(r.b,{height:A,width:$,mapStyle:k.mapStyle&&("string"===typeof k.mapStyle?k.mapStyle:k.mapStyle[0]),mapboxApiAccessToken:b||a}),(0,S.jsx)(N,{children:(0,S.jsx)(r.ov,{"data-testid":"stDeckGlJsonChartZoomButton",showCompass:!1})})]})]})}))},85850:(e,t,o)=>{o.d(t,{K:()=>b,A:()=>v});o(58878);var i=o(8151),n=o(12274),r=o(63186),l=o(34914),s=o(997),a=o(36459),c=o(84720),d=o(64611),h=o(89653),u=o(58144);const g="-2.4rem",m=(0,h.A)("div",{target:"e2wxzia1"})((e=>{let{theme:t,locked:o,target:i}=e;return{padding:`${t.spacing.sm} 0 ${t.spacing.sm} ${t.spacing.sm}`,position:"absolute",top:o?g:"-1rem",right:t.spacing.none,transition:"none",...!o&&{opacity:0,"&:active, &:focus-visible, &:hover":{transition:"opacity 150ms 100ms, top 100ms 100ms",opacity:1,top:g},...i&&{[`${i}:hover &, ${i}:active &, ${i}:focus-visible &`]:{transition:"opacity 150ms 100ms, top 100ms 100ms",opacity:1,top:g}}}}}),""),p=(0,h.A)("div",{target:"e2wxzia0"})((e=>{let{theme:t}=e;return{color:(0,u.iq)(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.default,backgroundColor:t.colors.lightenedBg05,width:"fit-content",zIndex:t.zIndices.sidebar+1}}),"");var f=o(90782);function b(e){let{label:t,show_label:o,icon:n,onClick:r}=e;const h=(0,i.u)(),u=o?t:"";return(0,f.jsx)("div",{"data-testid":"stElementToolbarButton",children:(0,f.jsx)(s.A,{content:(0,f.jsx)(l.Ay,{source:t,allowHTML:!1,style:{fontSize:h.fontSizes.sm}}),placement:s.W.TOP,onMouseEnterDelay:1e3,inline:!0,children:(0,f.jsxs)(a.Ay,{onClick:e=>{r&&r(),e.stopPropagation()},kind:c.KX.ELEMENT_TOOLBAR,"aria-label":t,children:[n&&(0,f.jsx)(d.A,{content:n,size:"md",testid:"stElementToolbarButtonIcon"}),u&&(0,f.jsx)("span",{children:u})]})})})}const v=e=>{let{onExpand:t,onCollapse:o,isFullScreen:i,locked:l,children:s,target:a,disableFullscreenMode:c}=e;return(0,f.jsx)(m,{className:"stElementToolbar","data-testid":"stElementToolbar",locked:l||i,target:a,children:(0,f.jsxs)(p,{children:[s,t&&!c&&!i&&(0,f.jsx)(b,{label:"Fullscreen",icon:n.g,onClick:()=>t()}),o&&!c&&i&&(0,f.jsx)(b,{label:"Close fullscreen",icon:r.Q,onClick:()=>o()})]})})}},34752:(e,t,o)=>{o.d(t,{X:()=>l,o:()=>r});var i=o(58878),n=o(25571);class r{constructor(){this.formClearListener=void 0,this.lastWidgetMgr=void 0,this.lastFormId=void 0}manageFormClearListener(e,t,o){(0,n.se)(this.formClearListener)&&this.lastWidgetMgr===e&&this.lastFormId===t||(this.disconnect(),(0,n._L)(t)&&(this.formClearListener=e.addFormClearedListener(t,o),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}}function l(e){let{element:t,widgetMgr:o,onFormCleared:r}=e;(0,i.useEffect)((()=>{if(!(0,n._L)(t.formId))return;const e=o.addFormClearedListener(t.formId,r);return()=>{e.disconnect()}}),[t,o,r])}},3101:(e,t,o)=>{o.d(t,{_:()=>l,t:()=>s});var i=o(58878),n=o(34752),r=o(25571);function l(e){let{getStateFromWidgetMgr:t,getDefaultState:o,updateWidgetMgrState:l,element:s,widgetMgr:a,fragmentId:c,onFormCleared:d}=e;const[h,u]=(0,i.useState)((()=>{var e;return null!==(e=t(a,s))&&void 0!==e?e:o(a,s)})),[g,m]=(0,i.useState)({value:h,fromUi:!1});(0,i.useEffect)((()=>{(0,r.hX)(g)||(m(null),u(g.value),l(s,a,g,c))}),[g,l,s,a,c]);const p=(0,i.useCallback)((()=>{m({value:o(a,s),fromUi:!0}),null===d||void 0===d||d()}),[m,s,o,a,d]);return(0,n.X)({widgetMgr:a,element:s,onFormCleared:p}),[h,m]}function s(e){let{getStateFromWidgetMgr:t,getDefaultStateFromProto:o,getCurrStateFromProto:n,updateWidgetMgrState:r,element:s,widgetMgr:a,fragmentId:c,onFormCleared:d}=e;const h=(0,i.useCallback)(((e,t)=>o(t)),[o]),[u,g]=l({getStateFromWidgetMgr:t,getDefaultState:h,updateWidgetMgrState:r,element:s,widgetMgr:a,fragmentId:c,onFormCleared:d});return(0,i.useEffect)((()=>{s.setValue&&(s.setValue=!1,g({value:n(s),fromUi:!1}))}),[s,n,g]),[u,g]}}}]);
@@ -0,0 +1 @@
1
+ "use strict";(self.webpackChunk_streamlit_app=self.webpackChunk_streamlit_app||[]).push([[3224],{85850:(e,t,n)=>{n.d(t,{K:()=>b,A:()=>y});n(58878);var r=n(8151),i=n(12274),o=n(63186),a=n(34914),l=n(997),s=n(36459),d=n(84720),c=n(64611),u=n(89653),g=n(58144);const p="-2.4rem",f=(0,u.A)("div",{target:"e2wxzia1"})((e=>{let{theme:t,locked:n,target:r}=e;return{padding:`${t.spacing.sm} 0 ${t.spacing.sm} ${t.spacing.sm}`,position:"absolute",top:n?p:"-1rem",right:t.spacing.none,transition:"none",...!n&&{opacity:0,"&:active, &:focus-visible, &:hover":{transition:"opacity 150ms 100ms, top 100ms 100ms",opacity:1,top:p},...r&&{[`${r}:hover &, ${r}:active &, ${r}:focus-visible &`]:{transition:"opacity 150ms 100ms, top 100ms 100ms",opacity:1,top:p}}}}}),""),h=(0,u.A)("div",{target:"e2wxzia0"})((e=>{let{theme:t}=e;return{color:(0,g.iq)(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.default,backgroundColor:t.colors.lightenedBg05,width:"fit-content",zIndex:t.zIndices.sidebar+1}}),"");var m=n(90782);function b(e){let{label:t,show_label:n,icon:i,onClick:o}=e;const u=(0,r.u)(),g=n?t:"";return(0,m.jsx)("div",{"data-testid":"stElementToolbarButton",children:(0,m.jsx)(l.A,{content:(0,m.jsx)(a.Ay,{source:t,allowHTML:!1,style:{fontSize:u.fontSizes.sm}}),placement:l.W.TOP,onMouseEnterDelay:1e3,inline:!0,children:(0,m.jsxs)(s.Ay,{onClick:e=>{o&&o(),e.stopPropagation()},kind:d.KX.ELEMENT_TOOLBAR,"aria-label":t,children:[i&&(0,m.jsx)(c.A,{content:i,size:"md",testid:"stElementToolbarButtonIcon"}),g&&(0,m.jsx)("span",{children:g})]})})})}const y=e=>{let{onExpand:t,onCollapse:n,isFullScreen:r,locked:a,children:l,target:s,disableFullscreenMode:d}=e;return(0,m.jsx)(f,{className:"stElementToolbar","data-testid":"stElementToolbar",locked:a||r,target:s,children:(0,m.jsxs)(h,{children:[l,t&&!d&&!r&&(0,m.jsx)(b,{label:"Fullscreen",icon:i.g,onClick:()=>t()}),n&&!d&&r&&(0,m.jsx)(b,{label:"Close fullscreen",icon:o.Q,onClick:()=>n()})]})})}},53224:(e,t,n)=>{n.r(t),n.d(t,{default:()=>be});var r=n(58878),i=n(8151),o=n(19613),a=n(56146),l=n(50248),s=n(95241),d=n(71034),c=n.n(d),u=n(34752),g=n(85850),p=n(25571),f=n(58144),h=n(50609),m=n.n(h),b=n(29669),y=n(67253);var v=n(93480),x=n(997),w=n(70474),C=n(35526);const j=e=>{var t;let{widgetMgr:n,id:i,formId:o,key:a,defaultValue:l}=e;(0,r.useEffect)((()=>{const e=n.getElementState(i,a);(0,p.hX)(e)&&(0,p.se)(l)&&n.setElementState(i,a,l)}),[n,i,a,l]);const[s,d]=(0,r.useState)(null!==(t=n.getElementState(i,a))&&void 0!==t?t:l),c=(0,r.useCallback)((e=>{n.setElementState(i,a,e),d(e)}),[n,i,a]),g=(0,r.useMemo)((()=>({formId:o||""})),[o]),f=(0,r.useCallback)((()=>c(l)),[l,c]);return(0,u.X)({element:g,widgetMgr:n,onFormCleared:f}),[s,c]};var k=n(84152),A=n(55562);const I=(e,t)=>{const{libConfig:{enforceDownloadInNewTab:n=!1}}=r.useContext(k.n);return(0,r.useCallback)((()=>{if(!e)return;const r=(0,A.A)({enforceDownloadInNewTab:n,url:e,filename:t});r.style.display="none",document.body.appendChild(r),r.click(),document.body.removeChild(r)}),[e,n,t])};var S=n(89653),U=n(37888);const R=(0,S.A)("div",{target:"e12wn80j15"})(""),E=(0,S.A)("div",{target:"e12wn80j14"})((e=>{let{theme:t}=e;return{height:t.sizes.largestElementHeight,width:"100%",background:t.genericColors.secondaryBg,borderRadius:t.radii.default,marginBottom:t.spacing.twoXS,display:"flex",alignItems:"center",position:"relative",paddingLeft:t.spacing.xs,paddingRight:t.spacing.sm}}),""),L=(0,S.A)("div",{target:"e12wn80j13"})({name:"82a6rk",styles:"flex:1"}),T=(0,S.A)("div",{target:"e12wn80j12"})((e=>{let{show:t}=e;return{display:t?"block":"none"}}),""),F=(0,S.A)("span",{target:"e12wn80j11"})((e=>{let{theme:t,isPlayingOrRecording:n}=e;return{margin:t.spacing.sm,fontFamily:t.fonts.monospace,color:n?t.genericColors.bodyText:t.colors.fadedText60,backgroundColor:t.genericColors.secondaryBg,fontSize:t.fontSizes.sm}}),""),M=(0,S.A)("div",{target:"e12wn80j10"})({name:"1kyw74z",styles:"width:100%;text-align:center;overflow:hidden"}),P=(0,S.A)("span",{target:"e12wn80j9"})((e=>{let{theme:t}=e;return{color:t.colors.bodyText}}),""),z=(0,S.A)("a",{target:"e12wn80j8"})(""),W=(0,S.A)("div",{target:"e12wn80j7"})((e=>{let{theme:t}=e;return{height:t.sizes.largestElementHeight,display:"flex",justifyContent:"center",alignItems:"center"}}),""),B=(0,S.A)("div",{target:"e12wn80j6"})((e=>{let{theme:t}=e;return{height:10,opacity:.2,width:"100%",backgroundImage:`radial-gradient(${t.colors.fadedText10} 40%, transparent 40%)`,backgroundSize:"10px 10px",backgroundRepeat:"repeat"}}),""),X=(0,S.A)("span",{target:"e12wn80j5"})((e=>{let{theme:t}=e;return{"& > button":{color:t.colors.primary,padding:t.spacing.threeXS},"& > button:hover, & > button:focus":{color:t.colors.red}}}),""),O=(0,S.A)("span",{target:"e12wn80j4"})((e=>{let{theme:t}=e;return{"& > button":{padding:t.spacing.threeXS,color:t.colors.fadedText40},"& > button:hover, & > button:focus":{color:t.colors.primary}}}),""),D=(0,S.A)("span",{target:"e12wn80j3"})((e=>{let{theme:t}=e;return{"& > button":{padding:t.spacing.threeXS,color:t.colors.fadedText60},"& > button:hover, & > button:focus":{color:t.colors.bodyText}}}),""),V=(0,S.A)("div",{target:"e12wn80j2"})((e=>{let{theme:t}=e;return{display:"flex",justifyContent:"center",alignItems:"center",flexGrow:0,flexShrink:1,padding:t.spacing.xs,gap:t.spacing.twoXS,marginRight:t.spacing.twoXS}}),""),_=(0,S.A)("div",{target:"e12wn80j1"})((e=>{let{theme:t}=e;return{marginLeft:t.spacing.sm}}),""),N=(0,S.A)(U.x,{target:"e12wn80j0"})((e=>{let{theme:t}=e;return{fontSize:t.fontSizes.sm,width:t.sizes.spinnerSize,height:t.sizes.spinnerSize,borderWidth:t.sizes.spinnerThickness,radius:t.radii.md,justifyContents:"center",padding:t.spacing.none,margin:t.spacing.none,borderColor:t.colors.borderColor,borderTopColor:t.colors.primary,flexGrow:0,flexShrink:0}}),"");var $=n(39095),H=n(90782);const K=()=>(0,H.jsxs)(M,{children:[(0,H.jsx)(P,{children:"This app would like to use your microphone."})," ",(0,H.jsx)(z,{href:$.ML,children:"Learn how to allow access."})]}),G=()=>(0,H.jsx)(W,{children:(0,H.jsx)(B,{})}),q="00:00",Z=e=>new Date(e).toLocaleTimeString(void 0,{minute:"2-digit",second:"2-digit"});var Q=n(96626),Y=n(34783),J=n(37789),ee=n(14757),te=n(88685),ne=n(36459),re=n(84720),ie=n(64611);const oe=e=>{let{onClick:t,disabled:n,ariaLabel:r,iconContent:i}=e;return(0,H.jsx)(ne.Ay,{kind:re.KX.BORDERLESS_ICON,onClick:t,disabled:n,"aria-label":r,fluidWidth:!0,"data-testid":"stAudioInputActionButton",children:(0,H.jsx)(ie.A,{content:i,size:"lg",color:"inherit"})})},ae=e=>{let{disabled:t,stopRecording:n}=e;return(0,H.jsx)(X,{children:(0,H.jsx)(oe,{onClick:n,disabled:t,ariaLabel:"Stop recording",iconContent:Y.X})})},le=e=>{let{disabled:t,isPlaying:n,onClickPlayPause:r}=e;return(0,H.jsx)(D,{children:n?(0,H.jsx)(oe,{onClick:r,disabled:t,ariaLabel:"Pause",iconContent:J.v}):(0,H.jsx)(oe,{onClick:r,disabled:t,ariaLabel:"Play",iconContent:ee.S})})},se=e=>{let{disabled:t,startRecording:n}=e;return(0,H.jsx)(O,{children:(0,H.jsx)(oe,{onClick:n,disabled:t,ariaLabel:"Record",iconContent:Q.G})})},de=e=>{let{onClick:t}=e;return(0,H.jsx)(D,{children:(0,H.jsx)(oe,{disabled:!1,onClick:t,ariaLabel:"Reset",iconContent:te.C})})},ce=e=>{let{disabled:t,isRecording:n,isPlaying:r,isUploading:i,isError:o,recordingUrlExists:a,startRecording:l,stopRecording:s,onClickPlayPause:d,onClear:c}=e;return o?(0,H.jsx)(V,{children:(0,H.jsx)(de,{onClick:c})}):i?(0,H.jsx)(V,{children:(0,H.jsx)(N,{"aria-label":"Uploading"})}):(0,H.jsxs)(V,{children:[n?(0,H.jsx)(ae,{disabled:t,stopRecording:s}):(0,H.jsx)(se,{disabled:t,startRecording:l}),a&&(0,H.jsx)(le,{disabled:t,isPlaying:r,onClickPlayPause:d})]})},ue=(0,r.memo)(ce);var ge=n(84996);function pe(e,t,n){for(let r=0;r<n.length;r++,t+=2){const i=Math.max(-1,Math.min(1,n[r]));e.setInt16(t,i<0?32768*i:32767*i,!0)}}const fe=async function(e){const t=new window.AudioContext,n=await e.arrayBuffer();let r;try{r=await t.decodeAudioData(n)}catch(u){return void(0,ge.vV)(u)}const i=r.numberOfChannels,o=r.sampleRate,a=r.length*i*2+44,l=new ArrayBuffer(a),s=new DataView(l),d={0:{type:"string",value:"RIFF"},4:{type:"uint32",value:36+2*r.length*i},8:{type:"string",value:"WAVE"},12:{type:"string",value:"fmt "},16:{type:"uint32",value:16},20:{type:"uint16",value:1},22:{type:"uint16",value:i},24:{type:"uint32",value:o},28:{type:"uint32",value:o*i*2},32:{type:"uint16",value:2*i},34:{type:"uint16",value:16},36:{type:"string",value:"data"},40:{type:"uint32",value:r.length*i*2}};Object.entries(d).forEach((e=>{let[t,{type:n,value:r}]=e;const i=parseInt(t,10);"string"===n?function(e,t,n){for(let r=0;r<n.length;r++)e.setUint8(t+r,n.charCodeAt(r))}(s,i,r):"uint32"===n?s.setUint32(i,r,!0):"uint16"===n&&s.setUint16(i,r,!0)}));for(let g=0;g<i;g++)pe(s,44+g*r.length*2,r.getChannelData(g));const c=new Uint8Array(l);return new Blob([c],{type:"audio/wav"})},he=()=>(0,H.jsx)(M,{children:(0,H.jsx)(P,{children:"An error has occurred, please try again."})}),me=e=>{var t;let{element:n,uploadClient:d,widgetMgr:h,fragmentId:k,disabled:A}=e;const S=(0,i.u)(),U=(0,C.Z)(S),[M,P]=(0,r.useState)(null),z=r.useRef(null),[W,B]=j({widgetMgr:h,id:n.id,key:"deleteFileUrl",defaultValue:null}),[X,O]=(0,r.useState)(null),[D,V]=(0,r.useState)([]),[N,$]=(0,r.useState)(null),[Q,Y]=j({widgetMgr:h,id:n.id,key:"recordingUrl",defaultValue:null}),[,J]=(0,r.useState)(0),ee=()=>{J((e=>e+1))},[te,ne]=(0,r.useState)(q),[re,ie]=j({widgetMgr:h,id:n.id,formId:n.formId,key:"recordingTime",defaultValue:q}),[oe,ae]=(0,r.useState)(!1),[le,se]=(0,r.useState)(!1),[de,ce]=(0,r.useState)(!1),[ge,pe]=(0,r.useState)(!1),[me,be]=(0,r.useState)(!1),ye=n.id,ve=n.formId,xe=(0,r.useCallback)((async e=>{let t;if(pe(!0),(0,p.se)(ve)&&h.setFormsWithUploadsInProgress(new Set([ve])),t="audio/wav"===e.type?e:await fe(e),!t)return void be(!0);const n=URL.createObjectURL(t),r=new File([t],"audio.wav",{type:t.type});Y(n),(async e=>{let{files:t,uploadClient:n,widgetMgr:r,widgetInfo:i,fragmentId:o}=e,a=[];try{a=await n.fetchFileURLs(t)}catch(c){return{successfulUploads:[],failedUploads:t.map((e=>({file:e,error:(0,y.$)(c)})))}}const l=m()(t,a),s=[],d=[];return await Promise.all(l.map((async e=>{let[t,r]=e;if(!t||!r||!r.uploadUrl||!r.fileId)return{file:t,fileUrl:r,error:new Error("No upload URL found")};try{await n.uploadFile({id:r.fileId,formId:i.formId||""},r.uploadUrl,t),s.push({fileUrl:r,file:t})}catch(c){const n=(0,y.$)(c);d.push({file:t,error:n})}}))),r.setFileUploaderStateValue(i,new b.qX({uploadedFileInfo:s.map((e=>{let{file:t,fileUrl:n}=e;return new b.HY({fileId:n.fileId,fileUrls:n,name:t.name,size:t.size})}))}),{fromUi:!0},o),{successfulUploads:s,failedUploads:d}})({files:[r],uploadClient:d,widgetMgr:h,widgetInfo:{id:ye,formId:ve},fragmentId:k}).then((e=>{let{successfulUploads:t,failedUploads:n}=e;if(n.length>0)return void be(!0);const r=t[0];r&&r.fileUrl.deleteUrl&&B(r.fileUrl.deleteUrl)})).finally((()=>{(0,p.se)(ve)&&h.setFormsWithUploadsInProgress(new Set),pe(!1)}))}),[Y,d,h,ye,ve,k,B]),we=(0,r.useCallback)((e=>{let{updateWidgetManager:t}=e;(0,p.hX)(M)||(0,p.hX)(W)||(Y(null),M.empty(),d.deleteFile(W),ne(q),ie(q),B(null),t&&h.setFileUploaderStateValue(n,{},{fromUi:!0},k),ae(!1),(0,p.se)(Q)&&URL.revokeObjectURL(Q))}),[W,Q,d,M,n,h,k,ie,Y,B]);(0,r.useEffect)((()=>{if((0,p.hX)(ve))return;const e=new u.o;return e.manageFormClearListener(h,ve,(()=>{we({updateWidgetManager:!0})})),()=>e.disconnect()}),[ve,we,h]);const Ce=(0,r.useCallback)((()=>{if(null===z.current)return;const e=o.A.create({container:z.current,waveColor:Q?(0,f.au)(S.colors.fadedText40,S.genericColors.secondaryBg):S.colors.primary,progressColor:S.colors.bodyText,height:(0,p.NE)(S.sizes.largestElementHeight)-8,barWidth:4,barGap:4,barRadius:8,cursorWidth:0,url:null!==Q&&void 0!==Q?Q:void 0});e.on("timeupdate",(e=>{ne(Z(1e3*e))})),e.on("pause",(()=>{ee()}));const t=e.registerPlugin(a.A.create({scrollingWaveform:!1,renderRecordedAudio:!0}));return t.on("record-end",(async e=>{xe(e)})),t.on("record-progress",(e=>{ie(Z(e))})),P(e),O(t),()=>{e&&e.destroy(),t&&t.destroy()}}),[xe]);(0,r.useEffect)((()=>Ce()),[Ce]),(0,r.useEffect)((()=>{c()(U,S)||null===M||void 0===M||M.setOptions({waveColor:Q?(0,f.au)(S.colors.fadedText40,S.genericColors.secondaryBg):S.colors.primary,progressColor:S.colors.bodyText})}),[S,U,Q,M]);const je=(0,r.useCallback)((()=>{M&&(M.playPause(),ae(!0),ee())}),[M]),ke=(0,r.useCallback)((async()=>{let e=N;de||(await navigator.mediaDevices.getUserMedia({audio:!0}).then((()=>a.A.getAvailableAudioDevices().then((t=>{if(V(t),t.length>0){const{deviceId:n}=t[0];$(n),e=n}})))).catch((e=>{se(!0)})),ce(!0)),X&&e&&M&&(M.setOptions({waveColor:S.colors.primary}),Q&&we({updateWidgetManager:!1}),X.startRecording({deviceId:e}).then((()=>{ee()})))}),[N,X,S,M,Q,we,de]),Ae=(0,r.useCallback)((()=>{X&&(X.stopRecording(),null===M||void 0===M||M.setOptions({waveColor:(0,f.au)(S.colors.fadedText40,S.genericColors.secondaryBg)}))}),[X,M,S]),Ie=I(Q,"recording.wav"),Se=Boolean(null===X||void 0===X?void 0:X.isRecording()),Ue=Boolean(null===M||void 0===M?void 0:M.isPlaying()),Re=Se||Ue,Ee=!Se&&!Q&&!le,Le=le||Ee||me,Te=A||le;return(0,H.jsxs)(R,{className:"stAudioInput","data-testid":"stAudioInput",children:[(0,H.jsx)(w.L,{label:n.label,disabled:Te,labelVisibility:(0,p.yv)(null===(t=n.labelVisibility)||void 0===t?void 0:t.value),children:n.help&&(0,H.jsx)(_,{children:(0,H.jsx)(v.A,{content:n.help,placement:x.W.TOP})})}),(0,H.jsxs)(E,{children:[(0,H.jsxs)(g.A,{isFullScreen:!1,disableFullscreenMode:!0,target:E,children:[Q&&(0,H.jsx)(g.K,{label:"Download recording",icon:l.f,onClick:()=>Ie()}),W&&(0,H.jsx)(g.K,{label:"Clear recording",icon:s.e,onClick:()=>we({updateWidgetManager:!0})})]}),(0,H.jsx)(ue,{isRecording:Se,isPlaying:Ue,isUploading:ge,isError:me,recordingUrlExists:Boolean(Q),startRecording:ke,stopRecording:Ae,onClickPlayPause:je,onClear:()=>{we({updateWidgetManager:!1}),be(!1)},disabled:Te}),(0,H.jsxs)(L,{children:[me&&(0,H.jsx)(he,{}),Ee&&(0,H.jsx)(G,{}),le&&(0,H.jsx)(K,{}),(0,H.jsx)(T,{"data-testid":"stAudioInputWaveSurfer",ref:z,show:!Le})]}),(0,H.jsx)(F,{isPlayingOrRecording:Re,"data-testid":"stAudioInputWaveformTimeCode",children:oe?te:re})]})]})},be=(0,r.memo)(me)},34752:(e,t,n)=>{n.d(t,{X:()=>a,o:()=>o});var r=n(58878),i=n(25571);class o{constructor(){this.formClearListener=void 0,this.lastWidgetMgr=void 0,this.lastFormId=void 0}manageFormClearListener(e,t,n){(0,i.se)(this.formClearListener)&&this.lastWidgetMgr===e&&this.lastFormId===t||(this.disconnect(),(0,i._L)(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}}function a(e){let{element:t,widgetMgr:n,onFormCleared:o}=e;(0,r.useEffect)((()=>{if(!(0,i._L)(t.formId))return;const e=n.addFormClearedListener(t.formId,o);return()=>{e.disconnect()}}),[t,n,o])}},35526:(e,t,n)=>{n.d(t,{Z:()=>i});var r=n(58878);const i=e=>{const t=(0,r.useRef)();return(0,r.useEffect)((()=>{t.current=e}),[e]),t.current}},55562:(e,t,n)=>{n.d(t,{A:()=>r});const r=e=>{let{enforceDownloadInNewTab:t,url:n,filename:r}=e;const i=document.createElement("a");return i.setAttribute("href",n),t?i.setAttribute("target","_blank"):i.setAttribute("target","_self"),i.setAttribute("download",r),i}}}]);