@stlite/desktop 0.43.1 → 0.45.0

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 (81) hide show
  1. package/bin/dump_artifacts.js +1 -1
  2. package/build/asset-manifest.json +41 -39
  3. package/build/index.html +1 -1
  4. package/build/pyodide/pyodide-lock.json +3768 -0
  5. package/build/pyodide/pyodide.asm.js +3 -3
  6. package/build/pyodide/pyodide.asm.wasm +0 -0
  7. package/build/pyodide/pyodide.js +12 -1
  8. package/build/pyodide/python_stdlib.zip +0 -0
  9. package/build/static/js/1122.422f58fc.chunk.js +1 -0
  10. package/build/static/js/{144.2477d27a.chunk.js → 144.046792d9.chunk.js} +1 -1
  11. package/build/static/js/{1729.528431ca.chunk.js → 1729.d59ed152.chunk.js} +1 -1
  12. package/build/static/js/{1740.32a0c10e.chunk.js → 1740.2c71a97a.chunk.js} +1 -1
  13. package/build/static/js/{1839.a1fce0e6.chunk.js → 1839.0d0dcac8.chunk.js} +1 -1
  14. package/build/static/js/2372.844b5190.chunk.js +2 -0
  15. package/build/static/js/2372.844b5190.chunk.js.LICENSE.txt +10 -0
  16. package/build/static/js/2753.c27b6faa.chunk.js +1 -0
  17. package/build/static/js/2873.f5c04f3b.chunk.js +1 -0
  18. package/build/static/js/3208.55e0b2fa.chunk.js +1 -0
  19. package/build/static/js/{4021.16f5498a.chunk.js → 4021.ec2e87b0.chunk.js} +1 -1
  20. package/build/static/js/4482.a9238ad0.chunk.js +1 -0
  21. package/build/static/js/4494.6bb6fb20.chunk.js +1 -0
  22. package/build/static/js/4694.aa16aaee.chunk.js +1 -0
  23. package/build/static/js/4721.2185bda3.chunk.js +1 -0
  24. package/build/static/js/{4724.366489f9.chunk.js → 4724.374578aa.chunk.js} +1 -1
  25. package/build/static/js/4785.76a05d79.chunk.js +1 -0
  26. package/build/static/js/4831.391fe620.chunk.js +1 -0
  27. package/build/static/js/5299.beb80829.chunk.js +1 -0
  28. package/build/static/js/6093.209cd165.chunk.js +1 -0
  29. package/build/static/js/6134.b9e5b2db.chunk.js +1 -0
  30. package/build/static/js/6802.df955c77.chunk.js +1 -0
  31. package/build/static/js/698.116a166b.chunk.js +1 -0
  32. package/build/static/js/7125.afecc159.chunk.js +1 -0
  33. package/build/static/js/{7332.cb5400eb.chunk.js → 7332.a13f15a5.chunk.js} +1 -1
  34. package/build/static/js/7579.ea965a43.chunk.js +1 -0
  35. package/build/static/js/7696.c9589682.chunk.js +1 -0
  36. package/build/static/js/8050.029f3dc8.chunk.js +1 -0
  37. package/build/static/js/8097.4837946f.chunk.js +2 -0
  38. package/build/static/js/8186.2f2e42e5.chunk.js +2 -0
  39. package/build/static/js/8186.2f2e42e5.chunk.js.LICENSE.txt +135 -0
  40. package/build/static/js/8850.6abc7336.chunk.js +1 -0
  41. package/build/static/js/{9166.d35e76c1.chunk.js → 9166.f234f6b4.chunk.js} +2 -2
  42. package/build/static/js/9311.7c7348b0.chunk.js +1 -0
  43. package/build/static/js/{5703.a68ecfdc.chunk.js → 9449.a2c361bb.chunk.js} +2 -2
  44. package/build/static/js/9699.df050cd6.chunk.js +1 -0
  45. package/build/static/js/9813.1821ef79.chunk.js +1 -0
  46. package/build/static/js/main.c3db14b2.js +28 -0
  47. package/build/static/js/{main.94addb49.js.LICENSE.txt → main.c3db14b2.js.LICENSE.txt} +0 -20
  48. package/package.json +7 -7
  49. package/build/pyodide/repodata.json +0 -1
  50. package/build/static/css/7895.c24b25fa.chunk.css +0 -1
  51. package/build/static/js/1619.c039c65c.chunk.js +0 -1
  52. package/build/static/js/1687.a144d952.chunk.js +0 -1
  53. package/build/static/js/2873.cf145dcb.chunk.js +0 -1
  54. package/build/static/js/3185.d317b162.chunk.js +0 -1
  55. package/build/static/js/4232.b0bbe2e6.chunk.js +0 -2
  56. package/build/static/js/4232.b0bbe2e6.chunk.js.LICENSE.txt +0 -52
  57. package/build/static/js/4482.2f210b65.chunk.js +0 -1
  58. package/build/static/js/4494.c6ab91c6.chunk.js +0 -1
  59. package/build/static/js/4694.7e63f0ef.chunk.js +0 -1
  60. package/build/static/js/4785.3ac653c2.chunk.js +0 -1
  61. package/build/static/js/4831.3170175f.chunk.js +0 -1
  62. package/build/static/js/5037.03a99abb.chunk.js +0 -1
  63. package/build/static/js/5299.ad735cb8.chunk.js +0 -1
  64. package/build/static/js/5361.bc476229.chunk.js +0 -2
  65. package/build/static/js/6134.5e3e3f58.chunk.js +0 -1
  66. package/build/static/js/6802.ffb6887c.chunk.js +0 -1
  67. package/build/static/js/698.7dce549b.chunk.js +0 -1
  68. package/build/static/js/7125.21833215.chunk.js +0 -1
  69. package/build/static/js/7579.7b9cc9ee.chunk.js +0 -1
  70. package/build/static/js/7652.f436cbbf.chunk.js +0 -1
  71. package/build/static/js/7696.406d4ef7.chunk.js +0 -1
  72. package/build/static/js/7895.198c568c.chunk.js +0 -1
  73. package/build/static/js/9311.f444417e.chunk.js +0 -1
  74. package/build/static/js/9813.c894655a.chunk.js +0 -1
  75. package/build/static/js/main.94addb49.js +0 -28
  76. /package/build/static/css/{7652.c24b25fa.chunk.css → 8050.c24b25fa.chunk.css} +0 -0
  77. /package/build/static/css/{5703.1edfa457.chunk.css → 9449.1edfa457.chunk.css} +0 -0
  78. /package/build/static/css/{1619.7ce51b75.chunk.css → 9699.7ce51b75.chunk.css} +0 -0
  79. /package/build/static/js/{5361.bc476229.chunk.js.LICENSE.txt → 8097.4837946f.chunk.js.LICENSE.txt} +0 -0
  80. /package/build/static/js/{9166.d35e76c1.chunk.js.LICENSE.txt → 9166.f234f6b4.chunk.js.LICENSE.txt} +0 -0
  81. /package/build/static/js/{5703.a68ecfdc.chunk.js.LICENSE.txt → 9449.a2c361bb.chunk.js.LICENSE.txt} +0 -0
@@ -1 +0,0 @@
1
- "use strict";(globalThis.webpackChunk_stlite_desktop=globalThis.webpackChunk_stlite_desktop||[]).push([[6134],{26134:(e,t,r)=>{r.r(t),r.d(t,{default:()=>l});var s=r(5057),n=r(60913),a=r(19954),i=r(96266);const c=528;function l(e){let{element:t,width:r,endpoints:l}=e;const o=(0,s.useRef)(null),{type:d,url:u,startTime:m}=t,h=(0,a.O0)(u);(0,s.useEffect)((()=>{o.current&&(o.current.currentTime=m)}),[m]),(0,s.useEffect)((()=>{const e=o.current,r=()=>{e&&(e.currentTime=t.startTime)};return e&&e.addEventListener("loadedmetadata",r),()=>{e&&e.removeEventListener("loadedmetadata",r)}}),[t]);const f=e=>{const{startTime:r}=t;return r?"".concat(e,"?start=").concat(r):e};if(d===n.nk.Type.YOUTUBE_IFRAME){const e=0!==r?.75*r:c;return(0,i.jsx)("iframe",{title:h,src:f(h),width:r,height:e,frameBorder:"0",allow:"autoplay; encrypted-media",allowFullScreen:!0})}return(0,i.jsx)("video",{ref:o,controls:!0,src:l.buildMediaURL(h),className:"stVideo",style:{width:r,height:0===r?c:void 0}})}}}]);
@@ -1 +0,0 @@
1
- (globalThis.webpackChunk_stlite_desktop=globalThis.webpackChunk_stlite_desktop||[]).push([[6802],{70318:(t,e,h)=>{"use strict";h.r(e),h.d(e,{default:()=>d});var i=h(5057),a=h(30669),c=h(46928),r=h(70714),n=h(70800);const o=(0,h(82160).Z)("div",{target:"e1uym6o70"})((t=>{let{theme:e}=t;return{"& *":{fontFamily:e.genericFonts.bodyFont,fontSize:"9.6px"},"& svg":{maxWidth:"100%"}}}),"");var s=h(96266);c.graphviz;const d=(0,n.Z)((function(t){let{width:e,element:h,height:n}=t;const d="graphviz-chart-".concat(h.elementId);let g=0,l=0;const p=()=>{let t=l,i=g;return n?(t=e,i=n):h.useContainerWidth&&(t=e),{chartWidth:t,chartHeight:i}},u=()=>{try{const t=(0,c.graphviz)("#".concat(d)).zoom(!1).fit(!0).scale(1).renderDot(h.spec).on("end",(()=>{const t=(0,a.Ys)("#".concat(d," > svg")).node();t&&(g=t.getBBox().height,l=t.getBBox().width)})),{chartHeight:e,chartWidth:i}=p();e>0&&t.height(e),i>0&&t.width(i)}catch(t){(0,r.H)(t)}};(0,i.useEffect)((()=>{u()}));const v=p(),m=v.chartWidth?v.chartWidth:e,f=v.chartHeight?v.chartHeight:n;return(0,s.jsx)(o,{className:"graphviz stGraphVizChart",id:d,style:{width:m,height:f}})}))},63778:()=>{},32725:()=>{},14966:()=>{}}]);
@@ -1 +0,0 @@
1
- "use strict";(globalThis.webpackChunk_stlite_desktop=globalThis.webpackChunk_stlite_desktop||[]).push([[698],{69212:(e,t,s)=>{s.d(t,{$:()=>c,Z:()=>h});var i=s(5057),r=s(47206),o=s(31808),n=s(17966),a=s(16449),l=s(80099),d=s(96266);let c=function(e){return e.EXTRASMALL="xs",e.SMALL="sm",e.MEDIUM="md",e.LARGE="lg",e.EXTRALARGE="xl",e}({});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,n.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)(a.Z,{value:t,overrides:(0,l.aO)(S,u)})}},30698:(e,t,s)=>{s.r(t),s.d(t,{default:()=>J});var i=s(30967),r=s(10458),o=s.n(r),n=s(65873),a=s.n(n),l=s(5057),d=s(60913),c=s(73401),h=s(98790),u=s(21034),g=s(38944),p=s(93905),m=s(52955),f=s(70714),S=s(50120),R=s(61914),C=s(69212),x=s(82160),b=s(59990),w=function(e){return e.XSMALL="xsmall",e.SMALL="small",e.MEDIUM="medium",e.LARGE="large",e}(w||{});function F(e,t){switch(e){case w.XSMALL:return{padding:"".concat(t.spacing.twoXS," ").concat(t.spacing.sm),fontSize:t.fontSizes.sm};case w.SMALL:return{padding:"".concat(t.spacing.twoXS," ").concat(t.spacing.md)};case w.LARGE:return{padding:"".concat(t.spacing.md," ").concat(t.spacing.md)};default:return{padding:"".concat(t.spacing.xs," ").concat(t.spacing.md)}}}const I=(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"}}),""),M=(0,x.Z)("p",{target:"etz5kuj7"})((e=>{let{theme:t}=e;return{marginTop:t.spacing.sm,textAlign:"center"}}),""),E=(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}}),""),T=(0,x.Z)("a",{target:"etz5kuj5"})((e=>{let{theme:t}=e;return{color:t.colors.primary,display:"block",textDecoration:"none"}}),""),y=(0,x.Z)("span",{target:"etz5kuj4"})((()=>({display:"flex",alignItems:"center"})),""),j=(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}}),""),L=(0,x.Z)("div",{target:"etz5kuj1"})((()=>({height:"fit-content",width:"100%",position:"absolute",bottom:0})),""),P=(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,b.DZ)(t.colors.primary,.5))},...F(w.MEDIUM,t)}}),"");var U=s(96266);const k=function(e){let{disabled:t,onClick:s,children:i,progress:r}=e;return(0,U.jsxs)(P,{disabled:t||!1,onClick:s||(()=>{}),progress:r||null,"data-testid":"stCameraInputButton",children:[i,r&&(0,U.jsx)(L,{children:(0,U.jsx)(C.Z,{value:r,size:C.$.EXTRASMALL,overrides:{Bar:{style:{borderTopLeftRadius:"0px",borderTopRightRadius:"0px"}},BarProgress:{style:{borderTopLeftRadius:"0px",borderTopRightRadius:"0px"}},BarContainer:{style:{borderTopLeftRadius:"0px",borderTopRightRadius:"0px"}}}})})]})};var z=s(96457),Z=s(38830),D=s(44088),X=s(44176);let _=function(e){return e.USER="user",e.ENVIRONMENT="environment",e}({});const O=e=>{let{switchFacingMode:t}=e;return(0,U.jsx)(j,{children:(0,U.jsx)(h.Z,{content:"Switch camera",placement:h.u.TOP_RIGHT,children:(0,U.jsx)(Z.ZP,{kind:D.nW.MINIMAL,onClick:t,children:(0,U.jsx)(c.Z,{content:z.Z,size:"twoXL",color:X.Z.white})})})})};var A=s(85585),B=s(47206),G=s(11226),N=s(74947),W=s.n(N),V=s(11103);let H=function(e){return e.PENDING="pending",e.SUCCESS="success",e.ERROR="error",e}({});const $=e=>{let{width:t}=e;return(0,U.jsxs)(v,{width:t,children:[(0,U.jsx)(c.Z,{size:"threeXL",color:X.Z.gray60,content:A.n}),(0,U.jsxs)(M,{children:["This app would like to use your camera.",(0,U.jsx)(T,{href:V.U3,rel:"noopener noreferrer",target:"_blank",children:"Learn how to allow access."})]})]})},q=e=>{let{handleCapture:t,width:s,disabled:i,clearPhotoInProgress:r,setClearPhotoInProgress:o,facingMode:n,setFacingMode:a}=e;const[d,c]=(0,l.useState)(H.PENDING),h=(0,l.useRef)(null),[u,g]=(0,l.useState)(s),p=(0,l.useCallback)((0,S.Ds)(1e3,g),[]);(0,l.useEffect)((()=>{p(s)}),[s,p]);const m=(0,B.u)();return(0,U.jsxs)(I,{width:u,children:[d===H.SUCCESS||i||r?G.tq&&(0,U.jsx)(O,{switchFacingMode:a}):(0,U.jsx)($,{width:u}),(0,U.jsx)(v,{hidden:d!==H.SUCCESS&&!i&&!r,width:u,children:!i&&(0,U.jsx)(W(),{audio:!1,ref:h,screenshotFormat:"image/jpeg",screenshotQuality:1,width:u,height:9*u/16,style:{borderRadius:"".concat(m.radii.lg," ").concat(m.radii.lg," 0 0")},onUserMediaError:()=>{c(H.ERROR)},onUserMedia:()=>{c(H.SUCCESS),o(!1)},videoConstraints:{width:{ideal:u},facingMode:n}})}),(0,U.jsx)(k,{onClick:function(){if(null!==h.current){const e=h.current.getScreenshot();t(e)}},disabled:d!==H.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===_.USER?_.ENVIRONMENT:_.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();if(void 0===e)return;const{element:t,widgetMgr:s}=this.props,i=s.getFileUploaderStateValue(t);a().isEqual(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().CancelToken.source(),i=new R.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().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:_.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 R.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:_.USER}}componentWillUnmount(){this.formClearHelper.disconnect()}get status(){return this.state.files.some((e=>"uploading"===e.status.type))?"updating":"ready"}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:r,width:o}=this.props;return this.formClearHelper.manageFormClearListener(s,t.formId,this.onFormCleared),(0,U.jsxs)(I,{width:o,className:"row-widget","data-testid":"stCameraInput",children:[(0,U.jsx)(g.O,{label:t.label,disabled:r,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)(E,{src:this.state.imgSrc,alt:"Snapshot",opacity:this.state.shutter||!this.state.minShutterEffectPassed?"50%":"100%",width:o,height:9*o/16})}),(0,U.jsx)(k,{onClick:this.removeCapture,progress:this.getProgress(),disabled:!!this.getProgress()||r,children:this.getProgress()?"Uploading...":(0,U.jsxs)(y,{children:[(0,U.jsx)(c.Z,{content:i.X,margin:"0 xs 0 0",size:"sm"})," Clear photo"]})})]}):(0,U.jsx)(q,{handleCapture:this.handleCapture,width:o,disabled:r,clearPhotoInProgress:this.state.clearPhotoInProgress,setClearPhotoInProgress:this.setClearPhotoInProgress,facingMode:this.state.facingMode,setFacingMode:this.setFacingMode})]})}nextLocalFileId(){return this.localFileIdCounter++}}const J=K},61914:(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}}},52955:(e,t,s)=>{s.d(t,{K:()=>r});var i=s(50120);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 +0,0 @@
1
- "use strict";(globalThis.webpackChunk_stlite_desktop=globalThis.webpackChunk_stlite_desktop||[]).push([[7125],{69212:(e,t,i)=>{i.d(t,{$:()=>c,Z:()=>p});var s=i(5057),n=i(47206),l=i(31808),r=i(17966),a=i(16449),o=i(80099),d=i(96266);let c=function(e){return e.EXTRASMALL="xs",e.SMALL="sm",e.MEDIUM="md",e.LARGE="lg",e.EXTRALARGE="xl",e}({});const p=function(e){let{value:t,width:i,size:p=c.SMALL,overrides:g}=e;const h=(0,n.u)(),u={xs:h.spacing.twoXS,sm:h.spacing.sm,md:h.spacing.lg,lg:h.spacing.xl,xl:h.spacing.twoXL},{activeTheme:m}=s.useContext(l.E),f=!(0,r.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[p],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)(a.Z,{value:t,overrides:(0,o.aO)(x,g)})}},61914:(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}}},97125:(e,t,i)=>{i.r(t),i.d(t,{default:()=>ge});var s=i(10458),n=i.n(s),l=i(65873),r=i.n(l),a=i(5057),o=i(60913),d=i(52955),c=i(50120);let p=function(e){return e.Gigabyte="gb",e.Megabyte="mb",e.Kilobyte="kb",e.Byte="b",e}({});const g=(0,c.rA)()?1024:1e3,h=[p.Gigabyte,p.Megabyte,p.Kilobyte,p.Byte],u=function(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;if(t||(t=p.Byte),i<0&&(i=0),e<0)throw new Error("Size must be greater than or equal to 0");const s=h.indexOf(t);return s&&e>g/2?u(e/g,h[s-1],i):"".concat(e.toFixed(i)).concat(t.toUpperCase())};var m=i(38944),f=i(93905),x=i(21034),w=i(98790),b=i(49525),y=i(38830),S=i(44088),F=i(82160);const v=(0,F.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}}),""),j=(0,F.Z)("div",{target:"e1b2p2ww14"})((()=>({marginRight:"auto",alignItems:"center",display:"flex"})),""),I=(0,F.Z)("span",{target:"e1b2p2ww13"})((e=>{let{theme:t}=e;return{color:t.colors.darkenedBgMix100,marginRight:t.spacing.lg}}),""),z=(0,F.Z)("span",{target:"e1b2p2ww12"})((e=>{let{theme:t}=e;return{marginBottom:t.spacing.twoXS}}),""),L=(0,F.Z)("div",{target:"e1b2p2ww11"})({name:"1fttcpj",styles:"display:flex;flex-direction:column"}),M=(0,F.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,F.Z)("ul",{target:"e1b2p2ww9"})((()=>({listStyleType:"none",marginBottom:0})),""),B=(0,F.Z)("li",{target:"e1b2p2ww8"})((e=>{let{theme:t}=e;return{margin:t.spacing.none,padding:t.spacing.none}}),""),U=(0,F.Z)("div",{target:"e1b2p2ww7"})((e=>{let{theme:t}=e;return{display:"flex",alignItems:"baseline",flex:1,paddingLeft:t.spacing.lg,overflow:"hidden"}}),""),R=(0,F.Z)("div",{target:"e1b2p2ww6"})((e=>{let{theme:t}=e;return{marginRight:t.spacing.sm,marginBottom:t.spacing.twoXS,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}}),""),Z=(0,F.Z)("div",{target:"e1b2p2ww5"})((e=>{let{theme:t}=e;return{display:"flex",alignItems:"center",marginBottom:t.spacing.twoXS}}),""),k=(0,F.Z)("span",{target:"e1b2p2ww4"})((e=>{let{theme:t}=e;return{marginRight:t.spacing.twoXS}}),""),T=(0,F.Z)("div",{target:"e1b2p2ww3"})((e=>{let{theme:t}=e;return{display:"flex",padding:t.spacing.twoXS,color:t.colors.darkenedBgMix100}}),""),X=(0,F.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"}}),""),D=(0,F.Z)("span",{target:"e1b2p2ww1"})({name:"0",styles:""}),E=e=>({[v]:{display:"flex",flexDirection:"column",alignItems:"flex-start"},[j]:{marginBottom:e.spacing.lg},[I]:{display:"none"},[M]:{paddingRight:e.spacing.lg},[Z]:{maxWidth:"inherit",flex:1,alignItems:"flex-start",marginBottom:e.spacing.sm},[R]:{width:e.sizes.full},[U]:{flexDirection:"column"},[X]:{height:"auto",whiteSpace:"initial"},[D]:{display:"none"},[B]:{margin:e.spacing.none,padding:e.spacing.none}}),P=(0,F.Z)("div",{target:"e1b2p2ww0"})((e=>{let{theme:t}=e;return t.inSidebar?E(t):{["@media (max-width: ".concat(t.breakpoints.sm,")")]:E(t)}}),"");var A=i(44071),N=i(73401),W=i(67600),V=i(96266);const O=e=>{let{multiple:t,acceptedExtensions:i,maxSizeBytes:s}=e;return(0,V.jsxs)(j,{children:[(0,V.jsx)(I,{children:(0,V.jsx)(N.Z,{content:A.n,size:"threeXL"})}),(0,V.jsxs)(L,{children:[(0,V.jsxs)(z,{children:["Drag and drop file",t?"s":""," here"]}),(0,V.jsxs)(W.x,{children:["Limit ".concat(u(s,p.Byte,0)," per file"),i.length?" \u2022 ".concat(i.join(", ").replace(/\./g,"").toUpperCase()):null]})]})]})},H=e=>{let{onDrop:t,multiple:i,acceptedExtensions:s,maxSizeBytes:n,disabled:l,label:r}=e;return(0,V.jsx)(b.ZP,{onDrop:t,multiple:i,accept:s.length?s:void 0,maxSize:n,disabled:l,useFsAccessApi:!1,children:e=>{let{getRootProps:t,getInputProps:a}=e;return(0,V.jsxs)(v,{...t(),"data-testid":"stFileUploadDropzone",isDisabled:l,"aria-label":r,children:[(0,V.jsx)("input",{"data-testid":"stDropzoneInput",...a()}),(0,V.jsx)(O,{multiple:i,acceptedExtensions:s,maxSizeBytes:n}),(0,V.jsx)(y.ZP,{kind:S.nW.SECONDARY,disabled:l,size:S.V5.SMALL,children:"Browse files"})]})}})};var _=i(56129),G=i.n(_),K=i(75427),$=i(5642);const q=(0,F.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}}),""),J=(0,F.Z)("div",{target:"e16k0npc0"})((e=>{let{theme:t}=e;return{display:"flex",alignItems:"center",justifyContent:"center",color:t.colors.fadedText40}}),""),Y=e=>{let{className:t,currentPage:i,totalPages:s,onNext:n,onPrevious:l}=e;return(0,V.jsxs)(q,{className:t,children:[(0,V.jsx)(W.x,{children:"Showing page ".concat(i," of ").concat(s)}),(0,V.jsxs)(J,{children:[(0,V.jsx)(y.ZP,{onClick:l,kind:S.nW.MINIMAL,children:(0,V.jsx)(N.Z,{content:K.s,size:"xl"})}),(0,V.jsx)(y.ZP,{onClick:n,kind:S.nW.MINIMAL,children:(0,V.jsx)(N.Z,{content:$._,size:"xl"})})]})]})};var Q=i(15717);const ee=(e,t)=>Math.ceil(e.length/t),te=e=>G()((t=>{let{pageSize:i,items:s,resetOnAdd:n,...l}=t;const[r,o]=(0,a.useState)(0),[d,c]=(0,a.useState)(ee(s,i)),p=(0,Q.D)(s);(0,a.useEffect)((()=>{p&&p.length!==s.length&&c(ee(s,i)),p&&p.length<s.length?n&&o(0):r+1>=d&&o(d-1)}),[s,r,i,p,n,d]);const g=s.slice(r*i,r*i+i);return(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(e,{items:g,...l}),s.length>i?(0,V.jsx)(Y,{className:"streamlit-paginator",pageSize:i,totalPages:d,currentPage:r+1,onNext:()=>{o(Math.min(r+1,d-1))},onPrevious:()=>{o(Math.max(0,r-1))}}):null]})}),e);var ie=i(15766),se=i(31906),ne=i(13324),le=i(69212);const re=e=>{let{fileInfo:t}=e;return"uploading"===t.status.type?(0,V.jsx)(le.Z,{value:t.status.progress,size:le.$.SMALL,overrides:{Bar:{style:{marginLeft:0,marginTop:"4px"}}}}):"error"===t.status.type?(0,V.jsxs)(X,{children:[(0,V.jsx)(k,{"data-testid":"stUploadedFileErrorMessage",children:t.status.errorMessage}),(0,V.jsx)(D,{children:(0,V.jsx)(N.Z,{content:ie.j,size:"lg"})})]}):"uploaded"===t.status.type?(0,V.jsx)(W.x,{children:u(t.size,p.Byte)}):null},ae=e=>{let{fileInfo:t,onDelete:i}=e;return(0,V.jsxs)(Z,{className:"uploadedFile",children:[(0,V.jsx)(T,{children:(0,V.jsx)(N.Z,{content:se.h,size:"twoXL"})}),(0,V.jsxs)(U,{className:"uploadedFileData",children:[(0,V.jsx)(R,{className:"uploadedFileName",title:t.name,children:t.name}),(0,V.jsx)(re,{fileInfo:t})]}),(0,V.jsx)("div",{"data-testid":"fileDeleteBtn",children:(0,V.jsx)(y.ZP,{onClick:()=>i(t.id),kind:S.nW.MINIMAL,children:(0,V.jsx)(N.Z,{content:ne.U,size:"lg"})})})]})},oe=te((e=>{let{items:t,onDelete:i}=e;return(0,V.jsx)(C,{children:t.map((e=>(0,V.jsx)(B,{children:(0,V.jsx)(ae,{fileInfo:e,onDelete:i})},e.id)))})})),de=e=>(0,V.jsx)(M,{children:(0,V.jsx)(oe,{...e})});var ce=i(61914);class pe extends a.PureComponent{constructor(e){super(e),this.formClearHelper=new d.K,this.localFileIdCounter=1,this.componentDidUpdate=()=>{if("ready"!==this.status)return;const e=this.createWidgetValue();if(void 0===e)return;const{element:t,widgetMgr:i}=this.props,s=i.getFileUploaderStateValue(t);r().isEqual(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().zip(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=n().CancelToken.source(),s=new ce.R(t.name,t.size,this.nextLocalFileId(),{type:"uploading",cancelToken:i,progress:1});this.addFile(s),this.props.uploadClient.uploadFile(this.props.element,e.uploadUrl,t,(e=>this.onUploadProgress(e,s.id)),i.token).then((()=>this.onUploadComplete(s.id,e))).catch((e=>{n().isCancel(e)||this.updateFile(s.id,s.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(u(this.maxUploadSizeInBytes,p.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:n}=s;return null==n||0===n.length?e:{files:n.map((e=>{const t=e.name,i=e.size,s=e.fileId,n=e.fileUrls;return new ce.R(t,i,this.nextLocalFileId(),{type:"uploaded",fileId:s,fileUrls:n})}))}}componentWillUnmount(){this.formClearHelper.disconnect()}get maxUploadSizeInBytes(){return((e,t,i)=>{if(e<0)throw Error("Size must be 0 or greater");const s=h.findIndex((e=>e===t)),n=h.findIndex((e=>e===i));if(-1===s||-1===n)throw Error("Unexpected byte unit provided");if(s===n)return e;const l=Math.abs(s-n),r=g**l;return s>n?e/r:e*r})(this.props.element.maxUploadSizeMb,p.Megabyte,p.Byte)}get status(){return this.state.files.some((e=>"uploading"===e.status.type))?"updating":"ready"}createWidgetValue(){const e=this.state.files.filter((e=>"uploaded"===e.status.type)).map((e=>{const{name:t,size:i,status:s}=e,{fileId:n,fileUrls:l}=s;return new o.jM({fileId:n,fileUrls:l,name:t,size:i})}));return new o.xO({uploadedFileInfo:e})}render(){var e;const{files:t}=this.state,{element:i,disabled:s,widgetMgr:n}=this.props,l=i.type;this.formClearHelper.manageFormClearListener(n,i.formId,this.onFormCleared);const r=t.slice().reverse();return(0,V.jsxs)(P,{"data-testid":"stFileUploader",children:[(0,V.jsx)(m.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,V.jsx)(f.dT,{children:(0,V.jsx)(x.Z,{content:i.help,placement:w.u.TOP_RIGHT})})}),(0,V.jsx)(H,{onDrop:this.dropHandler,multiple:i.multipleFiles,acceptedExtensions:l,maxSizeBytes:this.maxUploadSizeInBytes,label:i.label,disabled:s}),r.length>0&&(0,V.jsx)(de,{items:r,pageSize:3,onDelete:this.deleteFile,resetOnAdd:!0})]})}nextLocalFileId(){return this.localFileIdCounter++}}const ge=pe},52955:(e,t,i)=>{i.d(t,{K:()=>n});var s=i(50120);class n{constructor(){this.formClearListener=void 0,this.lastWidgetMgr=void 0,this.lastFormId=void 0}manageFormClearListener(e,t,i){null!=this.formClearListener&&this.lastWidgetMgr===e&&this.lastFormId===t||(this.disconnect(),(0,s.bM)(t)&&(this.formClearListener=e.addFormClearedListener(t,i),this.lastWidgetMgr=e,this.lastFormId=t))}disconnect(){var e;null===(e=this.formClearListener)||void 0===e||e.disconnect(),this.formClearListener=void 0,this.lastWidgetMgr=void 0,this.lastFormId=void 0}}}}]);
@@ -1 +0,0 @@
1
- "use strict";(globalThis.webpackChunk_stlite_desktop=globalThis.webpackChunk_stlite_desktop||[]).push([[7579],{97579:(e,t,s)=>{s.r(t),s.d(t,{default:()=>u});var n=s(5057),o=s(47206),r=s(17966),i=s(46403),l=s(31808),a=s(82160),c=s(70765),g=s(69194);const d=(0,a.Z)(c.Q,{shouldForwardProp:g.Z,target:"e1se5lgy1"})((e=>{let{theme:t,$usingCustomTheme:s}=e;return{marginTop:t.spacing.none,marginBottom:t.spacing.none,marginRight:t.spacing.none,marginLeft:t.spacing.none,borderColor:t.colors.fadedText10,borderTopColor:s?t.colors.primary:t.colors.blue70,flexGrow:0,flexShrink:0}}),""),h=(0,a.Z)("div",{target:"e1se5lgy0"})((e=>{let{theme:t}=e;return{display:"flex",gap:t.spacing.lg,alignItems:"center",width:"100%"}}),"");var p=s(96266);const u=function(e){let{width:t,element:s}=e;const a=(0,o.u)(),{activeTheme:c}=n.useContext(l.E),g=!(0,r.MJ)(c),u={width:t};return(0,p.jsx)("div",{className:"stSpinner","data-testid":"stSpinner",style:u,children:(0,p.jsxs)(h,{children:[(0,p.jsx)(d,{$size:a.iconSizes.twoXL,$usingCustomTheme:g}),(0,p.jsx)(i.ZP,{source:s.text,allowHTML:!1})]})})}}}]);
@@ -1 +0,0 @@
1
- "use strict";(globalThis.webpackChunk_stlite_desktop=globalThis.webpackChunk_stlite_desktop||[]).push([[7652],{97652:(t,e,o)=>{o.r(e),o.d(e,{default:()=>F});var n=o(5057),i=o(47206),a=o(5361),s=o(1110),r=o(79220),l=o(70714),d=o(70800),c=o(64327),h=o(28048),g=(o(31905),o(7226),o(65873)),u=o(17966);function m(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,u.Xy)(e),titleFontStyle:"normal",labelFontSize:e.fontSizes.twoSmPx,labelFontWeight:e.fontWeights.normal,labelColor:(0,u.Xy)(e),labelFontStyle:"normal"},axis:{labelFontSize:e.fontSizes.twoSmPx,labelFontWeight:e.fontWeights.normal,labelColor:(0,u.Xy)(e),labelFontStyle:"normal",titleFontWeight:e.fontWeights.normal,titleFontSize:e.fontSizes.smPx,titleColor:(0,u.Xy)(e),titleFontStyle:"normal",ticks:!1,gridColor:(0,u.ny)(e),domain:!1,domainWidth:1,domainColor:(0,u.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,u.Xy)(e),titleFontSize:e.fontSizes.smPx,titleFontWeight:e.fontWeights.normal,titleFontStyle:"normal",titleColor:(0,u.Xy)(e),titlePadding:5,labelPadding:e.spacing.lgPx,columnPadding:e.spacing.smPx,rowPadding:e.spacing.twoXSPx,padding:7,symbolStrokeWidth:4},range:{category:(0,u.iY)(e),diverging:(0,u.ru)(e),ramp:(0,u.Gy)(e),heatmap:(0,u.Gy)(e)},view:{columns:1,strokeWidth:0,stroke:"transparent",continuousHeight:350,continuousWidth:400},concat:{columns:1},facet:{columns:1},mark:{tooltip:!0,...(0,u.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?(0,g.mergeWith)({},o,t,((t,e)=>(0,g.isArray)(e)?e:void 0)):o}const f=(0,o(82160).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 p=o(96266);const b={DATAFRAME_INDEX:"(index)"},y="source",w=new Set([h.GI.DatetimeIndex,h.GI.Float64Index,h.GI.Int64Index,h.GI.RangeIndex,h.GI.UInt64Index]);class v extends n.PureComponent{constructor(){super(...arguments),this.vegaView=void 0,this.vegaFinalizer=void 0,this.defaultDataName=y,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;const{element:e,theme:o}=this.props,n=JSON.parse(e.spec),{useContainerWidth:i}=e;if("streamlit"===e.vegaLiteTheme?n.config=m(n.config,o):"streamlit"===(null===(t=n.usermeta)||void 0===t||null===(t=t.embedOptions)||void 0===t?void 0:t.theme)?(n.config=m(n.config,o),n.usermeta.embedOptions.theme=void 0):n.config=function(t,e){const{colors:o,fontSizes:n,genericFonts:i}=e,a={labelFont:i.bodyFont,titleFont:i.bodyFont,labelFontSize:n.twoSmPx,titleFontSize:n.twoSmPx},s={background:o.bgColor,axis:{labelColor:o.bodyText,titleColor:o.bodyText,gridColor:(0,u.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,u.ny)(e),continuousHeight:350,continuousWidth:400},mark:{tooltip:!0}};return t?(0,g.merge)({},s,t):s}(n.config,o),this.props.height?(n.width=this.props.width,n.height=this.props.height):i&&(n.width=this.props.width),n.padding||(n.padding={}),null==n.padding.bottom&&(n.padding.bottom=20),n.datasets)throw new Error("Datasets should not be passed as part of the spec");return n}}async componentDidMount(){try{await this.createView()}catch(t){const e=(0,c.b)(t);this.setState({error:e})}}componentWillUnmount(){this.finalizeView()}async componentDidUpdate(t){const{element:e,theme:o}=t,{element:n,theme:i}=this.props,a=e.spec,{spec:s}=n;if(!this.vegaView||a!==s||o!==i||t.width!==this.props.width||t.height!==this.props.height||t.element.vegaLiteTheme!==this.props.element.vegaLiteTheme){(0,l.ji)("Vega spec changed.");try{await this.createView()}catch(u){const t=(0,c.b)(u);this.setState({error:t})}return}const r=e.data,{data:d}=n;(r||d)&&this.updateData(this.defaultDataName,r,d);const h=x(e)||{},g=x(n)||{};for(const[l,c]of Object.entries(g)){const t=l||this.defaultDataName,e=h[t];this.updateData(t,e,c)}for(const l of Object.keys(h))g.hasOwnProperty(l)||l===this.defaultDataName||this.updateData(l,null,null);this.vegaView.resize().runAsync()}updateData(t,e,o){if(!this.vegaView)throw new Error("Chart has not been drawn yet");if(!o||0===o.data.numRows){return void(this.vegaView._runtime.data.hasOwnProperty(t)&&this.vegaView.remove(t,s.truthy))}if(!e||0===e.data.numRows)return void this.vegaView.insert(t,S(o));const{dataRows:n,dataColumns:i}=e.dimensions,{dataRows:a,dataColumns:r}=o.dimensions;if(function(t,e,o,n,i,a){if(o!==a)return!1;if(e>=i)return!1;if(0===e)return!1;const s=a-1,r=e-1;if(t.getDataValue(0,s)!==n.getDataValue(0,s)||t.getDataValue(r,s)!==n.getDataValue(r,s))return!1;return!0}(e,n,i,o,a,r))n<a&&this.vegaView.insert(t,S(o,n));else{const e=s.changeset().remove(s.truthy).insert(S(o));this.vegaView.change(t,e),(0,l.ji)("Had to clear the ".concat(t," dataset before inserting data through Vega view."))}}async createView(){if((0,l.ji)("Creating a new Vega view."),!this.element)throw Error("Element missing.");this.finalizeView();const t=this.props.element,e=this.generateSpec(),o={ast:!0,expr:r.N,tooltip:{disableDefaultStyle:!0},defaultStyle:""},{vgSpec:n,view:i,finalize:s}=await(0,a.ZP)(this.element,e,o);this.vegaView=i,this.vegaFinalizer=s;const d=function(t){const e=x(t);if(null==e)return null;const o={};for(const[n,i]of Object.entries(e))o[n]=S(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=y);const h=function(t){const e=t.data;if(!e||0===e.data.numRows)return null;return S(e)}(t);if(h&&i.insert(this.defaultDataName,h),d)for(const[a,r]of Object.entries(d))i.insert(a,r);await i.runAsync(),this.vegaView.resize().runAsync()}render(){if(this.state.error)throw this.state.error;return(0,p.jsx)(f,{"data-testid":"stArrowVegaLiteChart",ref:t=>{this.element=t}})}}function x(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 S(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if(t.isEmpty())return[];const o=[],{dataRows:n,dataColumns:i}=t.dimensions,a=h.fu.getTypeName(t.types.index[0]),s=w.has(a);for(let r=e;r<n;r++){const e={};if(s){const o=t.getIndexValue(r,0);e[b.DATAFRAME_INDEX]="bigint"===typeof o?Number(o):o}for(let o=0;o<i;o++){const n=t.getDataValue(r,o);e[t.columns[0][o]]="bigint"===typeof n?Number(n):n}o.push(e)}return o}const F=(0,i.b)((0,d.Z)(v))},31905:()=>{},7226:()=>{}}]);
@@ -1 +0,0 @@
1
- "use strict";(globalThis.webpackChunk_stlite_desktop=globalThis.webpackChunk_stlite_desktop||[]).push([[7696],{52955:(e,t,i)=>{i.d(t,{K:()=>o});var s=i(50120);class o{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}}},87696:(e,t,i)=>{i.r(t),i.d(t,{default:()=>w});var s=i(5057),o=i(65873),n=i(55790),r=i(47206),a=i(59500),l=i(52955),d=i(60913),h=i(50120),m=i(88084),u=i.n(m),c=i(38944),g=i(93905),p=i(21034),f=i(98790),b=i(82160),v=i(59990);const T=(0,b.Z)("div",{target:"ew7r33m3"})((e=>{let{disabled:t,theme:i}=e;return{alignItems:"center",backgroundColor:t?i.colors.gray:i.colors.primary,borderTopLeftRadius:"100%",borderTopRightRadius:"100%",borderBottomLeftRadius:"100%",borderBottomRightRadius:"100%",borderTopStyle:"none",borderBottomStyle:"none",borderRightStyle:"none",borderLeftStyle:"none",boxShadow:"none",display:"flex",height:i.radii.xl,justifyContent:"center",width:i.radii.xl,":focus":{outline:"none"},":focus-visible":{boxShadow:"0 0 0 0.2rem ".concat((0,v.DZ)(i.colors.primary,.5))}}}),""),y=(0,b.Z)("div",{target:"ew7r33m2"})((e=>{let{disabled:t,theme:i}=e;return{fontFamily:i.genericFonts.codeFont,fontSize:i.fontSizes.sm,paddingBottom:i.spacing.twoThirdsSmFont,color:t?i.colors.gray:i.colors.primary,top:"-22px",position:"absolute",whiteSpace:"nowrap",backgroundColor:i.colors.transparent,lineHeight:i.lineHeights.base,fontWeight:"normal"}}),""),R=(0,b.Z)("div",{target:"ew7r33m1"})((e=>{let{theme:t}=e;return{paddingBottom:t.spacing.none,paddingLeft:t.spacing.none,paddingRight:t.spacing.none,paddingTop:t.spacing.twoThirdsSmFont,justifyContent:"space-between",alignItems:"center",display:"flex"}}),""),V=(0,b.Z)("div",{target:"ew7r33m0"})((e=>{let{disabled:t,theme:i}=e;return{lineHeight:i.lineHeights.base,fontWeight:"normal",fontSize:i.fontSizes.sm,fontFamily:i.genericFonts.codeFont,color:t?i.colors.fadedText40:"inherit"}}),"");var x=i(96266);class C extends s.PureComponent{constructor(e){super(e),this.formClearHelper=new l.K,this.state=void 0,this.sliderRef=s.createRef(),this.thumbRef=[],this.thumbValueRef=[],this.commitWidgetValueDebounced=void 0,this.commitWidgetValue=e=>{this.props.widgetMgr.setDoubleArrayValue(this.props.element,this.state.value,e)},this.onFormCleared=()=>{this.setState(((e,t)=>({value:t.element.default})),(()=>this.commitWidgetValue({fromUi:!0})))},this.handleChange=e=>{let{value:t}=e;this.setState({value:t},(()=>this.commitWidgetValueDebounced({fromUi:!0})))},this.renderThumb=s.forwardRef(((e,t)=>{var i;const{$value:n,$thumbIndex:r}=e,a=r||0;this.thumbRef[a]=t,(i=this.thumbValueRef)[a]||(i[a]=s.createRef());const l=n?this.formatValue(n[r]):"",d=(0,o.pick)(e,["role","style","aria-valuemax","aria-valuemin","aria-valuenow","tabIndex","onKeyUp","onKeyDown","onMouseEnter","onMouseLeave","draggable"]),h={};return(this.props.element.options.length>0||this.isDateTimeType())&&(h["aria-valuetext"]=l),(0,x.jsx)(T,{...d,disabled:!0===e.$disabled,ref:this.thumbRef[a],"aria-valuetext":l,"aria-label":this.props.element.label,children:(0,x.jsx)(y,{className:"StyledThumbValue","data-testid":"stThumbValue",disabled:!0===e.$disabled,ref:this.thumbValueRef[a],children:l})})})),this.renderTickBar=()=>{const{disabled:e,element:t}=this.props,{max:i,min:s}=t;return(0,x.jsxs)(R,{"data-testid":"stTickBar",children:[(0,x.jsx)(V,{disabled:e,"data-testid":"stTickBarMin",children:this.formatValue(s)}),(0,x.jsx)(V,{disabled:e,"data-testid":"stTickBarMax",children:this.formatValue(i)})]})},this.commitWidgetValueDebounced=(0,h.Ds)(200,this.commitWidgetValue.bind(this)),this.state={value:this.initialValue}}get initialValue(){const e=this.props.widgetMgr.getDoubleArrayValue(this.props.element);return void 0!==e?e:this.props.element.default}componentDidMount(){setTimeout((()=>{this.thumbValueAlignment()}),0),this.props.element.setValue?this.updateFromProtobuf():this.commitWidgetValue({fromUi:!1})}componentDidUpdate(){this.maybeUpdateFromProtobuf()}componentWillUnmount(){this.formClearHelper.disconnect()}maybeUpdateFromProtobuf(){const{setValue:e}=this.props.element;e&&this.updateFromProtobuf()}updateFromProtobuf(){const{value:e}=this.props.element;this.props.element.setValue=!1,this.setState({value:e},(()=>{this.commitWidgetValue({fromUi:!1})}))}get value(){const{min:e,max:t}=this.props.element,{value:i}=this.state;let s=i[0],o=i.length>1?i[1]:i[0];return s>o&&(s=o),s<e&&(s=e),s>t&&(s=t),o<e&&(o=e),o>t&&(o=t),i.length>1?[s,o]:[s]}isDateTimeType(){const{dataType:e}=this.props.element;return e===d.iR.DataType.DATETIME||e===d.iR.DataType.DATE||e===d.iR.DataType.TIME}formatValue(e){const{format:t,options:i}=this.props.element;return this.isDateTimeType()?u().utc(e/1e3).format(t):i.length>0?(0,a.sprintf)(t,i[e]):(0,a.sprintf)(t,e)}alignValueOnThumb(e,t,i){if(e&&t&&i){const s=e.getBoundingClientRect(),o=t.getBoundingClientRect(),n=i.getBoundingClientRect(),r=o.left+o.width/2,a=r-n.width/2<s.left,l=r+n.width/2>s.right;i.style.left=a?"0":"",i.style.right=l?"0":""}}thumbValueAlignment(){var e,t,i,s;const o=this.sliderRef.current,n=null===(e=this.thumbRef[0])||void 0===e?void 0:e.current,r=null===(t=this.thumbRef[1])||void 0===t?void 0:t.current,a=null===(i=this.thumbValueRef[0])||void 0===i?void 0:i.current,l=null===(s=this.thumbValueRef[1])||void 0===s?void 0:s.current;if(this.alignValueOnThumb(o,n,a),this.alignValueOnThumb(o,r,l),o&&n&&r&&a&&l){const e=o.getBoundingClientRect(),t=n.getBoundingClientRect(),i=r.getBoundingClientRect(),s=a.getBoundingClientRect(),d=l.getBoundingClientRect();if(s.right+16>d.left){d.left-16-s.width>e.left?a.style.right="".concat(d.width+16-(i.right-t.right),"px"):l.style.left="".concat(s.width+16-(i.left-t.left),"px")}}}render(){var e;const{disabled:t,element:i,theme:s,width:o,widgetMgr:r}=this.props,{colors:a,fonts:l,fontSizes:d,spacing:m}=s,u={width:o};return this.formClearHelper.manageFormClearListener(r,i.formId,this.onFormCleared),this.thumbValueAlignment(),(0,x.jsxs)("div",{ref:this.sliderRef,className:"stSlider",style:u,children:[(0,x.jsx)(c.O,{label:i.label,disabled:t,labelVisibility:(0,h.iF)(null===(e=i.labelVisibility)||void 0===e?void 0:e.value),children:i.help&&(0,x.jsx)(g.dT,{children:(0,x.jsx)(p.Z,{content:i.help,placement:f.u.TOP_RIGHT})})}),(0,x.jsx)(n.Z,{min:i.min,max:i.max,step:i.step,value:this.value,onChange:this.handleChange,disabled:t,overrides:{Root:{style:{paddingTop:m.twoThirdsSmFont}},Thumb:this.renderThumb,Tick:{style:{fontFamily:l.monospace,fontSize:d.sm}},Track:{style:{backgroundColor:"none !important",paddingBottom:0,paddingLeft:0,paddingRight:0,paddingTop:m.twoThirdsSmFont}},InnerTrack:{style:e=>{let{$disabled:t}=e;return{height:"4px",...t?{background:a.darkenedBgMix25}:{}}}},TickBar:this.renderTickBar}})]})}}const w=(0,r.b)(C)}}]);
@@ -1 +0,0 @@
1
- "use strict";(globalThis.webpackChunk_stlite_desktop=globalThis.webpackChunk_stlite_desktop||[]).push([[7895],{67895:(t,e,i)=>{i.r(e),i.d(e,{default:()=>V});var a=i(5057),n=i(47206),s=i(40807),o=i.n(s),r=i(1110),h=i(5361),d=i(79220),l=i(70714),c=i(70800),u=i(22335),g=i(64327);i(31905),i(7226);const f=(0,i(82160).Z)("div",{target:"ebiq7ng0"})((t=>{let{theme:e}=t;return{"&.vega-embed":{".vega-actions":{zIndex:e.zIndices.popupMenu},summary:{height:"auto",zIndex:e.zIndices.menuButton}}}}),"");var p=i(96266);const m={DATAFRAME_INDEX:"(index)"},w="source",b=new Set(["datetimeIndex","float_64Index","int_64Index","rangeIndex","timedeltaIndex","uint_64Index"]);class v extends a.PureComponent{constructor(){super(...arguments),this.vegaView=void 0,this.vegaFinalizer=void 0,this.defaultDataName=w,this.element=null,this.state={error:void 0},this.finalizeView=()=>{this.vegaFinalizer&&this.vegaFinalizer(),this.vegaFinalizer=void 0,this.vegaView=void 0},this.generateSpec=()=>{const{element:t,theme:e}=this.props,i=JSON.parse(t.get("spec")),a=JSON.parse(t.get("useContainerWidth"));if(i.config=function(t,e){const{colors:i,fontSizes:a,genericFonts:n}=e,s={labelFont:n.bodyFont,titleFont:n.bodyFont,labelFontSize:a.twoSmPx,titleFontSize:a.twoSmPx},r={background:i.bgColor,axis:{labelColor:i.bodyText,titleColor:i.bodyText,gridColor:i.fadedText10,...s},legend:{labelColor:i.bodyText,titleColor:i.bodyText,...s},title:{color:i.bodyText,subtitleColor:i.bodyText,...s},header:{labelColor:i.bodyText},view:{continuousHeight:300,continuousWidth:400}};if(!t)return r;return o()({},r,t)}(i.config,e),this.props.height?(i.width=this.props.width-38,i.height=this.props.height):a&&(i.width=this.props.width-38),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,g.b)(t);this.setState({error:e})}}componentWillUnmount(){this.finalizeView()}async componentDidUpdate(t){const{element:e,theme:i}=t,{element:a,theme:n}=this.props,s=e.get("spec"),o=a.get("spec");if(!this.vegaView||s!==o||i!==n||t.width!==this.props.width||t.height!==this.props.height){(0,l.ji)("Vega spec changed.");try{await this.createView()}catch(u){const t=(0,g.b)(u);this.setState({error:t})}return}const r=e.get("data"),h=a.get("data");(r||h)&&this.updateData(this.defaultDataName,r,h);const d=y(e)||{},c=y(a)||{};for(const[l,g]of Object.entries(c)){const t=l||this.defaultDataName,e=d[t];this.updateData(t,e,g)}for(const l of Object.keys(d))c.hasOwnProperty(l)||l===this.defaultDataName||this.updateData(l,null,null);this.vegaView.resize().runAsync()}updateData(t,e,i){if(!this.vegaView)throw new Error("Chart has not been drawn yet");if(!i||!i.get("data")){return void(this.vegaView._runtime.data.hasOwnProperty(t)&&this.vegaView.remove(t,r.truthy))}if(!e||!e.get("data"))return void this.vegaView.insert(t,x(i));const[a,n]=(0,u.oo)(e.get("data")),[s,o]=(0,u.oo)(i.get("data"));if(function(t,e,i,a,n,s){if(i!==s)return!1;if(e>=n)return!1;if(0===e)return!1;const o=t.get("data"),r=a.get("data"),h=s-1,d=e-1;if((0,u.Fm)(o,h,0)!==(0,u.Fm)(r,h,0)||(0,u.Fm)(o,h,d)!==(0,u.Fm)(r,h,d))return!1;return!0}(e,a,n,i,s,o))a<s&&this.vegaView.insert(t,x(i,a));else{const e=r.changeset().remove(r.truthy).insert(x(i));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(),i={ast:!0,expr:d.N,tooltip:{disableDefaultStyle:!0},defaultStyle:""},{vgSpec:a,view:n,finalize:s}=await(0,h.ZP)(this.element,e,i);this.vegaView=n,this.vegaFinalizer=s;const o=function(t){const e=y(t);if(null==e)return null;const i={};for(const[a,n]of Object.entries(e))i[a]=x(n);return i}(t),r=o?Object.keys(o):[];if(1===r.length){const[t]=r;this.defaultDataName=t}else 0===r.length&&a.data&&(this.defaultDataName=w);const c=function(t){const e=t.get("data");if(!e)return null;return x(e)}(t);if(c&&n.insert(this.defaultDataName,c),o)for(const[h,d]of Object.entries(o))n.insert(h,d);await n.runAsync(),this.vegaView.resize().runAsync()}render(){if(this.state.error)throw this.state.error;return(0,p.jsx)(f,{"data-testid":"stVegaLiteChart",ref:t=>{this.element=t}})}}function y(t){if(!t.get("datasets")||t.get("datasets").isEmpty())return null;const e={};return t.get("datasets").forEach((t=>{if(!t)return;const i=t.get("hasName")?t.get("name"):null;e[i]=t.get("data")})),e}function x(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if(!t.get("data"))return[];if(!t.get("index"))return[];if(!t.get("columns"))return[];const i=[],[a,n]=(0,u.oo)(t.get("data")),s=t.get("index").get("type"),o=b.has(s);for(let r=e;r<a;r++){const e={};o&&(e[m.DATAFRAME_INDEX]=(0,u.l$)(t.get("index"),0,r));for(let i=0;i<n;i++)e[(0,u.l$)(t.get("columns"),0,i)]=(0,u.Fm)(t.get("data"),i,r);i.push(e)}return i}const V=(0,n.b)((0,c.Z)(v))},31905:()=>{},7226:()=>{}}]);
@@ -1 +0,0 @@
1
- "use strict";(globalThis.webpackChunk_stlite_desktop=globalThis.webpackChunk_stlite_desktop||[]).push([[9311],{9311:(t,e,l)=>{l.r(e),l.d(e,{default:()=>o});var s=l(73746),i=(l(5057),l(96266));function o(t){let{element:e,width:l}=t;const o=e.hasWidth?e.width:l;let r,c;e.scrolling?(r="auto",c={}):(r="no",c={overflow:"hidden"});const h=n(e.src),d=null!=h?void 0:n(e.srcdoc);return(0,i.jsx)("iframe",{allow:s.p,style:c,src:h,srcDoc:d,width:o,height:e.height,scrolling:r,sandbox:s.T,title:"st.iframe"})}function n(t){return null==t||""===t?void 0:t}}}]);
@@ -1 +0,0 @@
1
- (globalThis.webpackChunk_stlite_desktop=globalThis.webpackChunk_stlite_desktop||[]).push([[9813],{52955:(e,t,r)=>{"use strict";r.d(t,{K:()=>i});var s=r(50120);class i{constructor(){this.formClearListener=void 0,this.lastWidgetMgr=void 0,this.lastFormId=void 0}manageFormClearListener(e,t,r){null!=this.formClearListener&&this.lastWidgetMgr===e&&this.lastFormId===t||(this.disconnect(),(0,s.bM)(t)&&(this.formClearListener=e.addFormClearedListener(t,r),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}}},49813:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>w});var s=r(5057),i=r(11226),o=r(78164),n=r.n(o),l=r(47206),a=r(52955),d=r(81607),u=r(94861),p=r(87118),h=r(38944),c=r(93905);const m=(0,r(82160).Z)("div",{target:"e6zijwc0"})((e=>{let{theme:t}=e;return{"span[aria-disabled='true']":{background:t.colors.fadedText05}}}),"");var g=r(21034),v=r(98790),f=r(39552),b=r(92703),x=r(50120),S=r(96266);class y extends s.PureComponent{constructor(){super(...arguments),this.formClearHelper=new a.K,this.state={value:this.initialValue},this.commitWidgetValue=e=>{this.props.widgetMgr.setIntArrayValue(this.props.element,this.state.value,e)},this.onFormCleared=()=>{this.setState(((e,t)=>({value:t.element.default})),(()=>this.commitWidgetValue({fromUi:!0})))},this.onChange=e=>{this.props.element.maxSelections&&"select"===e.type&&this.state.value.length>=this.props.element.maxSelections||this.setState(this.generateNewState(e),(()=>{this.commitWidgetValue({fromUi:!0})}))},this.filterOptions=(e,t)=>{if(this.overMaxSelections())return[];const r=e.filter((e=>!this.state.value.includes(Number(e.value))));return(0,b.HX)(r,t)}}overMaxSelections(){return this.props.element.maxSelections>0&&this.state.value.length>=this.props.element.maxSelections}getNoResultsMsg(){const{maxSelections:e}=this.props.element,{value:t}=this.state;if(0===e)return"No results";if(t.length===e){const t=1!==e?"options":"option";return"You can only select up to ".concat(e," ").concat(t,". Remove an option first.")}return"No results"}get initialValue(){const e=this.props.widgetMgr.getIntArrayValue(this.props.element);return void 0!==e?e:this.props.element.default}componentDidMount(){this.props.element.setValue?this.updateFromProtobuf():this.commitWidgetValue({fromUi:!1})}componentDidUpdate(){this.maybeUpdateFromProtobuf()}componentWillUnmount(){this.formClearHelper.disconnect()}maybeUpdateFromProtobuf(){const{setValue:e}=this.props.element;e&&this.updateFromProtobuf()}updateFromProtobuf(){const{value:e}=this.props.element;this.props.element.setValue=!1,this.setState({value:e},(()=>{this.commitWidgetValue({fromUi:!1})}))}get valueFromState(){return this.state.value.map((e=>{const t=this.props.element.options[e];return{value:e.toString(),label:t}}))}generateNewState(e){const t=()=>{var t;const r=null===(t=e.option)||void 0===t?void 0:t.value;return parseInt(r,10)};switch(e.type){case"remove":return{value:n()(this.state.value,t())};case"clear":return{value:[]};case"select":return{value:this.state.value.concat([t()])};default:throw new Error("State transition is unknown: ".concat(e.type))}}render(){var e;const{element:t,theme:r,width:s,widgetMgr:o}=this.props,n={width:s},{options:l}=t,a=0===l.length||this.props.disabled,b=0===l.length?"No options to select.":t.placeholder,y=l.map(((e,t)=>({label:e,value:t.toString()})));this.formClearHelper.manageFormClearListener(o,t.formId,this.onFormCleared);const w=l.length>10;return(0,S.jsxs)("div",{className:"row-widget stMultiSelect","data-testid":"stMultiSelect",style:n,children:[(0,S.jsx)(h.O,{label:t.label,disabled:a,labelVisibility:(0,x.iF)(null===(e=t.labelVisibility)||void 0===e?void 0:e.value),children:t.help&&(0,S.jsx)(c.dT,{children:(0,S.jsx)(g.Z,{content:t.help,placement:v.u.TOP_RIGHT})})}),(0,S.jsx)(m,{children:(0,S.jsx)(u.Z,{options:y,labelKey:"label",valueKey:"value","aria-label":t.label,placeholder:b,type:p.wD.select,multi:!0,onChange:this.onChange,value:this.valueFromState,disabled:a,size:"compact",noResultsMsg:this.getNoResultsMsg(),filterOptions:this.filterOptions,closeOnSelect:!1,overrides:{SelectArrow:{component:d.Z,props:{overrides:{Svg:{style:()=>({width:r.iconSizes.xl,height:r.iconSizes.xl})}}}},IconsContainer:{style:()=>({paddingRight:r.spacing.sm})},ControlContainer:{style:{borderLeftWidth:"1px",borderRightWidth:"1px",borderTopWidth:"1px",borderBottomWidth:"1px"}},Placeholder:{style:()=>({flex:"inherit"})},ValueContainer:{style:()=>({minHeight:"38.4px",paddingLeft:r.spacing.sm,paddingTop:0,paddingBottom:0,paddingRight:0})},ClearIcon:{props:{overrides:{Svg:{style:{color:r.colors.darkGray,transform:"scale(1.5)",width:r.spacing.twoXL,":hover":{fill:r.colors.bodyText}}}}}},SearchIcon:{style:{color:r.colors.darkGray}},Tag:{props:{overrides:{Root:{style:{borderTopLeftRadius:r.radii.md,borderTopRightRadius:r.radii.md,borderBottomRightRadius:r.radii.md,borderBottomLeftRadius:r.radii.md,fontSize:r.fontSizes.sm,paddingLeft:r.spacing.sm,marginLeft:0,marginRight:r.spacing.sm,height:"28px"}},Action:{style:{paddingLeft:0}},ActionIcon:{props:{overrides:{Svg:{style:{width:"10px",height:"10px"}}}}},Text:{style:{fontSize:r.fontSizes.md}}}}},MultiValue:{props:{overrides:{Root:{style:{fontSize:r.fontSizes.sm}}}}},Input:{props:{readOnly:i.tq&&!1===w?"readonly":null}},Dropdown:{component:f.Z}}})})]})}}const w=(0,l.b)(y)},97247:(e,t,r)=>{var s=r(54305);e.exports=function(e,t){return!!(null==e?0:e.length)&&s(e,t,0)>-1}},89479:e=>{e.exports=function(e,t,r){for(var s=-1,i=null==e?0:e.length;++s<i;)if(r(t,e[s]))return!0;return!1}},3895:(e,t,r)=>{var s=r(98323),i=r(97247),o=r(89479),n=r(73470),l=r(74631),a=r(51565);e.exports=function(e,t,r,d){var u=-1,p=i,h=!0,c=e.length,m=[],g=t.length;if(!c)return m;r&&(t=n(t,l(r))),d?(p=o,h=!1):t.length>=200&&(p=a,h=!1,t=new s(t));e:for(;++u<c;){var v=e[u],f=null==r?v:r(v);if(v=d||0!==v?v:0,h&&f===f){for(var b=g;b--;)if(t[b]===f)continue e;m.push(v)}else p(t,f,d)||m.push(v)}return m}},60238:e=>{e.exports=function(e,t,r,s){for(var i=e.length,o=r+(s?1:-1);s?o--:++o<i;)if(t(e[o],o,e))return o;return-1}},54305:(e,t,r)=>{var s=r(60238),i=r(24981),o=r(23481);e.exports=function(e,t,r){return t===t?o(e,t,r):s(e,i,r)}},24981:e=>{e.exports=function(e){return e!==e}},23481:e=>{e.exports=function(e,t,r){for(var s=r-1,i=e.length;++s<i;)if(e[s]===t)return s;return-1}},78164:(e,t,r)=>{var s=r(3895),i=r(86456),o=r(7244),n=i((function(e,t){return o(e)?s(e,t):[]}));e.exports=n}}]);