@stlite/desktop 0.32.0 → 0.34.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.
- package/bin/dump_artifacts.js +5 -4
- package/build/asset-manifest.json +43 -42
- package/build/electron/main.js +13 -0
- package/build/electron/preload.js +1 -0
- package/build/index.html +1 -1
- package/build/static/js/1318.57c335d2.chunk.js +1 -0
- package/build/static/js/{142.85e6074f.chunk.js → 142.2b0ffa81.chunk.js} +1 -1
- package/build/static/js/172.599dcb6e.chunk.js +5 -0
- package/build/static/js/2327.b8572a38.chunk.js +1 -0
- package/build/static/js/2775.c1ed54fa.chunk.js +5 -0
- package/build/static/js/291.aa03bc71.chunk.js +1 -0
- package/build/static/js/3580.e292972c.chunk.js +1 -0
- package/build/static/js/3603.c075eadf.chunk.js +2 -0
- package/build/static/js/3603.c075eadf.chunk.js.LICENSE.txt +135 -0
- package/build/static/js/3744.93bd4bad.chunk.js +2 -0
- package/build/static/js/4140.edb6c36a.chunk.js +1 -0
- package/build/static/js/4141.a101e33c.chunk.js +9 -0
- package/build/static/js/5093.304fcb1e.chunk.js +1 -0
- package/build/static/js/5099.c240313c.chunk.js +1 -0
- package/build/static/js/5177.3eb35171.chunk.js +2 -0
- package/build/static/js/5241.0326c97c.chunk.js +1 -0
- package/build/static/js/5440.c723be7c.chunk.js +1 -0
- package/build/static/js/5617.6141af30.chunk.js +1 -0
- package/build/static/js/{9735.0e70600f.chunk.js → 6557.fd2f35c8.chunk.js} +1 -1
- package/build/static/js/{6422.c2900a88.chunk.js → 6683.aab9fa01.chunk.js} +1 -1
- package/build/static/js/{7842.a98fbb15.chunk.js → 6756.2cb6963c.chunk.js} +1 -1
- package/build/static/js/{6242.5e6f91ac.chunk.js → 6862.886eab8e.chunk.js} +1 -1
- package/build/static/js/6913.094a45e2.chunk.js +17 -0
- package/build/static/js/6939.c09d92c1.chunk.js +1 -0
- package/build/static/js/{7073.5619981b.chunk.js → 7073.376b9d76.chunk.js} +1 -1
- package/build/static/js/787.30ab7f34.chunk.js +1 -0
- package/build/static/js/792.45efff32.chunk.js +1 -0
- package/build/static/js/8035.dc118cc9.chunk.js +1 -0
- package/build/static/js/{6097.56c4b02a.chunk.js → 8295.c3cd87de.chunk.js} +1 -1
- package/build/static/js/8418.aed275df.chunk.js +1 -0
- package/build/static/js/8486.e56533d6.chunk.js +1 -0
- package/build/static/js/865.5abdcdc2.chunk.js +1 -0
- package/build/static/js/9004.6a66722a.chunk.js +1 -0
- package/build/static/js/9042.a6fcbc74.chunk.js +5 -0
- package/build/static/js/9107.b49ea9ea.chunk.js +5 -0
- package/build/static/js/9130.8e10440e.chunk.js +1 -0
- package/build/static/js/9166.1a468fb9.chunk.js +2 -0
- package/build/static/js/{5678.729bced9.chunk.js → 9382.c417d448.chunk.js} +1 -1
- package/build/static/js/9615.82cf4bfb.chunk.js +1 -0
- package/build/static/js/{8355.b110abc9.chunk.js → 9915.fe11690a.chunk.js} +1 -1
- package/build/static/js/main.1313208f.js +28 -0
- package/package.json +5 -4
- package/build/static/js/1367.9dcea0bc.chunk.js +0 -9
- package/build/static/js/2116.fd3de825.chunk.js +0 -1
- package/build/static/js/2458.cfb63c88.chunk.js +0 -1
- package/build/static/js/2523.4761d79a.chunk.js +0 -5
- package/build/static/js/2632.de1769ff.chunk.js +0 -1
- package/build/static/js/277.d9ceff66.chunk.js +0 -1
- package/build/static/js/3376.d5aaecc4.chunk.js +0 -1
- package/build/static/js/3392.5ed3420d.chunk.js +0 -1
- package/build/static/js/3977.24eb5fb8.chunk.js +0 -1
- package/build/static/js/4210.945a5966.chunk.js +0 -1
- package/build/static/js/4514.7931bd64.chunk.js +0 -5
- package/build/static/js/464.7c22f33c.chunk.js +0 -1
- package/build/static/js/5070.1d0d565e.chunk.js +0 -1
- package/build/static/js/5608.b4074ab9.chunk.js +0 -1
- package/build/static/js/5752.d5d30939.chunk.js +0 -1
- package/build/static/js/5865.90a40692.chunk.js +0 -17
- package/build/static/js/6223.4bb0039e.chunk.js +0 -2
- package/build/static/js/6668.8cb69721.chunk.js +0 -2
- package/build/static/js/7496.0f941cac.chunk.js +0 -1
- package/build/static/js/761.ca3883de.chunk.js +0 -1
- package/build/static/js/7698.00f5ff0b.chunk.js +0 -1
- package/build/static/js/7858.e4a6aa6d.chunk.js +0 -5
- package/build/static/js/7937.4b1be66e.chunk.js +0 -1
- package/build/static/js/8461.85faefa1.chunk.js +0 -1
- package/build/static/js/8565.f27e3917.chunk.js +0 -1
- package/build/static/js/8910.e6dda87e.chunk.js +0 -2
- package/build/static/js/91.f23bbeac.chunk.js +0 -1
- package/build/static/js/9462.81f9c52a.chunk.js +0 -1
- package/build/static/js/9551.c45b17cf.chunk.js +0 -1
- package/build/static/js/main.e1e5cd43.js +0 -28
- /package/build/static/css/{3376.60b7ada4.chunk.css → 5099.60b7ada4.chunk.css} +0 -0
- /package/build/static/js/{6668.8cb69721.chunk.js.LICENSE.txt → 3744.93bd4bad.chunk.js.LICENSE.txt} +0 -0
- /package/build/static/js/{6223.4bb0039e.chunk.js.LICENSE.txt → 5177.3eb35171.chunk.js.LICENSE.txt} +0 -0
- /package/build/static/js/{8910.e6dda87e.chunk.js.LICENSE.txt → 9166.1a468fb9.chunk.js.LICENSE.txt} +0 -0
- /package/build/static/js/{main.e1e5cd43.js.LICENSE.txt → main.1313208f.js.LICENSE.txt} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";(globalThis.webpackChunk_stlite_desktop=globalThis.webpackChunk_stlite_desktop||[]).push([[5241],{83201:(e,t,s)=>{s.d(t,{$:()=>c,Z:()=>h});var i=s(5057),r=s(31476),o=s(23878),a=s(16449),n=s(80099),l=s(35450),d=s(96266);let c;!function(e){e.EXTRASMALL="xs",e.SMALL="sm",e.MEDIUM="md",e.LARGE="lg",e.EXTRALARGE="xl"}(c||(c={}));const h=function({value:e,width:t,size:s=c.SMALL,overrides:h}){const g=(0,r.u)(),u={xs:g.spacing.twoXS,sm:g.spacing.sm,md:g.spacing.lg,lg:g.spacing.xl,xl:g.spacing.twoXL},{activeTheme:p}=i.useContext(l.E),m=!(0,o.MJ)(p),f={BarContainer:{style:{marginTop:g.spacing.none,marginBottom:g.spacing.none,marginRight:g.spacing.none,marginLeft:g.spacing.none}},Bar:{style:({$theme:e})=>({width:t?t.toString():void 0,marginTop:g.spacing.none,marginBottom:g.spacing.none,marginRight:g.spacing.none,marginLeft:g.spacing.none,height:u[s],backgroundColor:e.colors.progressbarTrackFill,borderTopLeftRadius:g.spacing.twoXS,borderTopRightRadius:g.spacing.twoXS,borderBottomLeftRadius:g.spacing.twoXS,borderBottomRightRadius:g.spacing.twoXS})},BarProgress:{style:()=>({backgroundColor:m?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:e,overrides:(0,n.aO)(f,h)})}},15241:(e,t,s)=>{s.r(t),s.d(t,{default:()=>q});var i,r=s(30967),o=s(10458),a=s.n(o),n=s(65873),l=s.n(n),d=s(5057),c=s(98927),h=s(87509),g=s(89401),u=s(4337),p=s(18950),m=s(98209),f=s(95870),S=s(46434),w=s(90747),x=s(83201),R=s(45490),b=s(59990);function F(e,t){switch(e){case i.XSMALL:return{padding:`${t.spacing.twoXS} ${t.spacing.sm}`,fontSize:t.fontSizes.sm};case i.SMALL:return{padding:`${t.spacing.twoXS} ${t.spacing.md}`};case i.LARGE:return{padding:`${t.spacing.md} ${t.spacing.md}`};default:return{padding:`${t.spacing.xs} ${t.spacing.md}`}}}!function(e){e.XSMALL="xsmall",e.SMALL="small",e.MEDIUM="medium",e.LARGE="large"}(i||(i={}));const C=(0,R.Z)("div",{target:"e11drzth9"})((()=>({position:"relative",overflow:"hidden",width:"100%",objectFit:"contain"})),""),I=(0,R.Z)("div",{target:"e11drzth8"})((({theme:e,width:t})=>({backgroundColor:e.colors.secondaryBg,borderRadius:`${e.radii.lg} ${e.radii.lg} 0 0`,width:"100%",height:9*t/16,display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center"})),""),v=(0,R.Z)("p",{target:"e11drzth7"})((({theme:e})=>({marginTop:e.spacing.sm,textAlign:"center"})),""),E=(0,R.Z)("img",{target:"e11drzth6"})((({theme:e,opacity:t})=>({borderRadius:`${e.radii.lg} ${e.radii.lg} 0 0`,objectFit:"contain",opacity:t})),""),P=(0,R.Z)("a",{target:"e11drzth5"})((({theme:e})=>({color:e.colors.primary,display:"block",textDecoration:"none"})),""),T=(0,R.Z)("span",{target:"e11drzth4"})((()=>({display:"flex",alignItems:"center"})),""),M=(0,R.Z)("div",{target:"e11drzth3"})((({theme:e})=>({position:"absolute",top:e.spacing.lg,right:e.spacing.lg,zIndex:1,color:e.colors.fadedText40,mixBlendMode:"difference",opacity:.6})),""),y=(0,R.Z)("div",{target:"e11drzth1"})((()=>({height:"fit-content",width:"100%",position:"absolute",bottom:0})),""),L=(0,R.Z)("button",{target:"e11drzth0"})((({theme:e})=>({position:"relative",display:"inline-flex",flexDirection:"column",alignItems:"center",justifyContent:"center",backgroundColor:e.colors.lightenedBg05,border:`1px solid ${e.colors.fadedText10}`,borderRadius:`0 0 ${e.radii.lg} ${e.radii.lg}`,"&:hover":{borderColor:e.colors.primary,color:e.colors.primary},"&:active":{color:e.colors.white,borderColor:e.colors.primary,backgroundColor:e.colors.primary},"&:focus:not(:active)":{borderColor:e.colors.primary,color:e.colors.primary},"&:disabled, &:disabled:hover, &:disabled:active":{color:e.colors.fadedText40},fontWeight:e.fontWeights.normal,padding:`${e.spacing.xs} ${e.spacing.md}`,margin:0,lineHeight:e.lineHeights.base,color:"inherit",width:"100%",userSelect:"none","&:focus":{outline:"none"},"&:focus-visible":{boxShadow:`0 0 0 0.2rem ${(0,b.DZ)(e.colors.primary,.5)}`},...F(i.MEDIUM,e)})),"");var j=s(96266);const U=function({disabled:e,onClick:t,children:s,progress:i}){return(0,j.jsxs)(L,{disabled:e||!1,onClick:t||(()=>{}),progress:i||null,"data-testid":"stCameraInputButton",children:[s,i&&(0,j.jsx)(y,{children:(0,j.jsx)(x.Z,{value:i,size:x.$.EXTRASMALL,overrides:{Bar:{style:{borderTopLeftRadius:"0px",borderTopRightRadius:"0px"}},BarProgress:{style:{borderTopLeftRadius:"0px",borderTopRightRadius:"0px"}},BarContainer:{style:{borderTopLeftRadius:"0px",borderTopRightRadius:"0px"}}}})})]})};var k=s(96457),z=s(46401),$=s(22131);let Z;!function(e){e.USER="user",e.ENVIRONMENT="environment"}(Z||(Z={}));const D=({switchFacingMode:e})=>(0,j.jsx)(M,{children:(0,j.jsx)(g.ZP,{content:"Switch camera",placement:g.ug.TOP_RIGHT,children:(0,j.jsx)(z.ZP,{kind:z.nW.MINIMAL,onClick:e,children:(0,j.jsx)(h.ZP,{content:k.Z,size:"twoXL",color:$.Z.white})})})});var X=s(85585),O=s(31476),_=s(11226),A=s(74947),B=s.n(A),N=s(61921);let G;!function(e){e.PENDING="pending",e.SUCCESS="success",e.ERROR="error"}(G||(G={}));const V=({width:e})=>(0,j.jsxs)(I,{width:e,children:[(0,j.jsx)(h.ZP,{size:"threeXL",color:$.Z.gray60,content:X.n}),(0,j.jsxs)(v,{children:["This app would like to use your camera.",(0,j.jsx)(P,{href:N.U3,rel:"noopener noreferrer",target:"_blank",children:"Learn how to allow access."})]})]}),W=({handleCapture:e,width:t,disabled:s,clearPhotoInProgress:i,setClearPhotoInProgress:r,facingMode:o,setFacingMode:a})=>{const[n,l]=(0,d.useState)(G.PENDING),c=(0,d.useRef)(null),[h,g]=(0,d.useState)(t),u=(0,d.useCallback)((0,S.Ds)(1e3,g),[]);(0,d.useEffect)((()=>{u(t)}),[t,u]);const p=(0,O.u)();return(0,j.jsxs)(C,{width:h,children:[n===G.SUCCESS||s||i?_.tq&&(0,j.jsx)(D,{switchFacingMode:a}):(0,j.jsx)(V,{width:h}),(0,j.jsx)(I,{hidden:n!==G.SUCCESS&&!s&&!i,width:h,children:!s&&(0,j.jsx)(B(),{audio:!1,ref:c,screenshotFormat:"image/jpeg",screenshotQuality:1,width:h,height:9*h/16,style:{borderRadius:`${p.radii.lg} ${p.radii.lg} 0 0`},onUserMediaError:()=>{l(G.ERROR)},onUserMedia:()=>{l(G.SUCCESS),r(!1)},videoConstraints:{width:{ideal:h},facingMode:o}})}),(0,j.jsx)(U,{onClick:function(){if(null!==c.current){const t=c.current.getScreenshot();e(t)}},disabled:n!==G.SUCCESS||s||i,children:"Take Photo"})]})};class H extends d.PureComponent{constructor(e){super(e),this.localFileIdCounter=1,this.RESTORED_FROM_WIDGET_STRING="RESTORED_FROM_WIDGET",this.formClearHelper=new m.Kz,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===Z.USER?Z.ENVIRONMENT:Z.USER})))},this.handleCapture=e=>{if(null===e)return Promise.resolve();this.setState({imgSrc:e,shutter:!0,minShutterEffectPassed:!1});var t,s;return(t=e,s=`camera-input-${(new Date).toISOString().replace(/:/g,"_")}.jpg`,fetch(t).then((e=>e.arrayBuffer())).then((e=>new File([e],s,{type:"image/jpeg"})))).then((e=>this.uploadFile(e))).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)}))},this.removeCapture=()=>{0!==this.state.files.length&&(this.state.files.forEach((e=>this.deleteFile(e.id))),this.setState({imgSrc:null,clearPhotoInProgress:!0}))},this.componentDidUpdate=e=>{const{element:t,widgetMgr:s}=this.props;if(e.disabled!==this.props.disabled&&this.props.disabled)return this.reset(),void s.setFileUploaderStateValue(t,new c.xO,{fromUi:!1});if("ready"!==this.status)return;const i=this.createWidgetValue();if(void 0===i)return;const r=s.getFileUploaderStateValue(t);l().isEqual(i,r)||s.setFileUploaderStateValue(t,i,{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(),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((e=>({newestServerFileId:Math.max(e.newestServerFileId,t),shutter:!1})));const s=this.getFile(e);null!=s&&"uploading"===s.status.type&&this.updateFile(s.id,s.setStatus({type:"uploaded",serverFileId: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=>{const t=a().CancelToken.source(),s=new w.R(e.name,e.size,this.nextLocalFileId(),{type:"uploading",cancelToken:t,progress:1});this.addFile(s),this.props.uploadClient.uploadFile(this.props.element,e,(e=>this.onUploadProgress(e,s.id)),t.token).then((e=>this.onUploadComplete(s.id,e))).catch((e=>{a().isCancel(e)||this.updateFile(s.id,s.setStatus({type:"error",errorMessage:e?e.toString():"Unknown error"}))}))},this.state=this.initialValue}get initialValue(){const e={files:[],newestServerFileId:0,imgSrc:null,shutter:!1,minShutterEffectPassed:!0,clearPhotoInProgress:!1,facingMode:Z.USER},{widgetMgr:t,element:s}=this.props,i=t.getFileUploaderStateValue(s);if(null==i)return e;const{maxFileId:r,uploadedFileInfo:o}=i;return null==r||0===r||null==o?e:{files:o.map((e=>{const t=e.name,s=e.size,i=e.id;return new w.R(t,s,this.nextLocalFileId(),{type:"uploaded",serverFileId:i})})),newestServerFileId:Number(r),imgSrc:0===o.length?"":this.RESTORED_FROM_WIDGET_STRING,shutter:!1,minShutterEffectPassed:!1,clearPhotoInProgress:!1,facingMode:Z.USER}}componentWillUnmount(){this.formClearHelper.disconnect()}get status(){return this.state.files.some((e=>"uploading"===e.status.type))?"updating":"ready"}createWidgetValue(){if(0===this.state.newestServerFileId)return;const e=this.state.files.filter((e=>"uploaded"===e.status.type)).map((e=>{const{name:t,size:s,status:i}=e;return new c.jM({id:i.serverFileId,name:t,size:s})}));return new c.xO({maxFileId:this.state.newestServerFileId,uploadedFileInfo:e})}render(){var e;const{element:t,widgetMgr:s,disabled:i,width:o}=this.props;return this.formClearHelper.manageFormClearListener(s,t.formId,this.onFormCleared),(0,j.jsxs)(C,{width:o,className:"row-widget","data-testid":"stCameraInput",children:[(0,j.jsx)(p.ON,{label:t.label,disabled:i,labelVisibility:(0,S.iF)(null===(e=t.labelVisibility)||void 0===e?void 0:e.value),children:t.help&&(0,j.jsx)(p.dT,{children:(0,j.jsx)(u.ZP,{content:t.help,placement:g.ug.TOP_RIGHT})})}),this.state.imgSrc?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(I,{width:o,children:this.state.imgSrc!==this.RESTORED_FROM_WIDGET_STRING&&(0,j.jsx)(E,{src:this.state.imgSrc,alt:"Snapshot",opacity:this.state.shutter||!this.state.minShutterEffectPassed?"50%":"100%",width:o,height:9*o/16})}),(0,j.jsx)(U,{onClick:this.removeCapture,progress:this.getProgress(),disabled:!!this.getProgress()||i,children:this.getProgress()?"Uploading...":(0,j.jsxs)(T,{children:[(0,j.jsx)(h.ZP,{content:r.X,margin:"0 xs 0 0",size:"sm"})," Clear photo"]})})]}):(0,j.jsx)(W,{handleCapture:this.handleCapture,width:o,disabled:i,clearPhotoInProgress:this.state.clearPhotoInProgress,setClearPhotoInProgress:this.setClearPhotoInProgress,facingMode:this.state.facingMode,setFacingMode:this.setFacingMode})]})}nextLocalFileId(){return this.localFileIdCounter++}}const q=H},90747:(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}}}}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(globalThis.webpackChunk_stlite_desktop=globalThis.webpackChunk_stlite_desktop||[]).push([[5440],{85440:(e,t,o)=>{"use strict";o.r(t),o.d(t,{default:()=>y});var r=o(5057),s=o(11226),i=o(78164),n=o.n(i),l=o(31476),a=o(98209),p=o(81607),u=o(94861),d=o(87118),h=o(18950);const c=(0,o(45490).Z)("div",{target:"e10apx9u0"})((({theme:e})=>({"span[aria-disabled='true']":{background:e.colors.fadedText05}})),"");var m=o(4337),g=o(89401),f=o(88707),v=o(98184),b=o(46434),x=o(96266);class S extends r.PureComponent{constructor(...e){super(...e),this.formClearHelper=new a.Kz,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 o=e.filter((e=>!this.state.value.includes(Number(e.value))));return(0,v.H)(o,t)}}overMaxSelections(){return this.props.element.maxSelections>0&&this.state.value.length>=this.props.element.maxSelections}getNoResultsMsg(){if(0===this.props.element.maxSelections)return"No results";const e=1!==this.props.element.maxSelections?"options":"option";return`You can only select up to ${this.props.element.maxSelections} ${e}. Remove an option first.`}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 o=null===(t=e.option)||void 0===t?void 0:t.value;return parseInt(o,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: ${e.type}`)}}render(){var e;const{element:t,theme:o,width:r,widgetMgr:i}=this.props,n={width:r},{options:l}=t,a=0===l.length||this.props.disabled,v=0===l.length?"No options to select.":"Choose an option",S=l.map(((e,t)=>({label:e,value:t.toString()})));this.formClearHelper.manageFormClearListener(i,t.formId,this.onFormCleared);const y=l.length>10;return(0,x.jsxs)("div",{className:"row-widget stMultiSelect",style:n,children:[(0,x.jsx)(h.ON,{label:t.label,disabled:a,labelVisibility:(0,b.iF)(null===(e=t.labelVisibility)||void 0===e?void 0:e.value),children:t.help&&(0,x.jsx)(h.dT,{children:(0,x.jsx)(m.ZP,{content:t.help,placement:g.ug.TOP_RIGHT})})}),(0,x.jsx)(c,{children:(0,x.jsx)(u.Z,{options:S,labelKey:"label",valueKey:"value","aria-label":t.label,placeholder:v,type:d.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:p.Z,props:{overrides:{Svg:{style:()=>({width:o.iconSizes.xl,height:o.iconSizes.xl})}}}},IconsContainer:{style:()=>({paddingRight:o.spacing.sm})},ControlContainer:{style:{borderLeftWidth:"1px",borderRightWidth:"1px",borderTopWidth:"1px",borderBottomWidth:"1px"}},Placeholder:{style:()=>({flex:"inherit"})},ValueContainer:{style:()=>({minHeight:"38.4px",paddingLeft:o.spacing.sm,paddingTop:0,paddingBottom:0,paddingRight:0})},ClearIcon:{props:{overrides:{Svg:{style:{color:o.colors.darkGray,transform:"scale(1.5)",width:o.spacing.twoXL,":hover":{fill:o.colors.bodyText}}}}}},SearchIcon:{style:{color:o.colors.darkGray}},Tag:{props:{overrides:{Root:{style:{borderTopLeftRadius:o.radii.md,borderTopRightRadius:o.radii.md,borderBottomRightRadius:o.radii.md,borderBottomLeftRadius:o.radii.md,fontSize:o.fontSizes.sm,paddingLeft:o.spacing.sm,marginLeft:0,marginRight:o.spacing.sm,height:"28px"}},Action:{style:{paddingLeft:0}},ActionIcon:{props:{overrides:{Svg:{style:{width:"10px",height:"10px"}}}}},Text:{style:{fontSize:o.fontSizes.md}}}}},MultiValue:{props:{overrides:{Root:{style:{fontSize:o.fontSizes.sm}}}}},Input:{props:{readOnly:s.tq&&!1===y?"readonly":null}},Dropdown:{component:f.s}}})})]})}}const y=(0,l.b)(S)},97247:(e,t,o)=>{var r=o(54305);e.exports=function(e,t){return!!(null==e?0:e.length)&&r(e,t,0)>-1}},89479:e=>{e.exports=function(e,t,o){for(var r=-1,s=null==e?0:e.length;++r<s;)if(o(t,e[r]))return!0;return!1}},3895:(e,t,o)=>{var r=o(98323),s=o(97247),i=o(89479),n=o(73470),l=o(74631),a=o(51565),p=200;e.exports=function(e,t,o,u){var d=-1,h=s,c=!0,m=e.length,g=[],f=t.length;if(!m)return g;o&&(t=n(t,l(o))),u?(h=i,c=!1):t.length>=p&&(h=a,c=!1,t=new r(t));e:for(;++d<m;){var v=e[d],b=null==o?v:o(v);if(v=u||0!==v?v:0,c&&b===b){for(var x=f;x--;)if(t[x]===b)continue e;g.push(v)}else h(t,b,u)||g.push(v)}return g}},60238:e=>{e.exports=function(e,t,o,r){for(var s=e.length,i=o+(r?1:-1);r?i--:++i<s;)if(t(e[i],i,e))return i;return-1}},54305:(e,t,o)=>{var r=o(60238),s=o(24981),i=o(23481);e.exports=function(e,t,o){return t===t?i(e,t,o):r(e,s,o)}},24981:e=>{e.exports=function(e){return e!==e}},23481:e=>{e.exports=function(e,t,o){for(var r=o-1,s=e.length;++r<s;)if(e[r]===t)return r;return-1}},78164:(e,t,o)=>{var r=o(3895),s=o(86456),i=o(7244),n=s((function(e,t){return i(e)?r(e,t):[]}));e.exports=n}}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";(globalThis.webpackChunk_stlite_desktop=globalThis.webpackChunk_stlite_desktop||[]).push([[5617],{75617:(e,t,o)=>{o.r(t),o.d(t,{default:()=>H});var n=o(5057),r=o(53812),i=o(82601),l=o(55927);let d;!function(e){e.ASCENDING="ascending",e.DESCENDING="descending"}(d||(d={}));var s=o(45490);const a=(0,s.Z)("div",{target:"e1xdbg9g8"})((({width:e,theme:t})=>({width:e,border:`1px solid ${t.colors.fadedText05}`,boxSizing:"content-box","& .table-top-right":{overflow:"hidden !important",paddingRight:"6px"},"& .table-bottom-left":{overflow:"hidden !important",paddingBottom:"6px"},"& .table-bottom-right":{overflow:"overlay !important"},"& .table-bottom-right:focus-visible":{outline:"none"},"& .table-bottom-right:focus":{outline:"none"}})),""),c=(0,s.Z)("div",{target:"e1xdbg9g7"})((({theme:e})=>({padding:`${e.spacing.twoXS} ${e.spacing.xs}`,borderBottom:`1px solid ${e.colors.fadedText05}`,borderRight:`1px solid ${e.colors.fadedText05}`,fontSize:e.fontSizes.md,fontFamily:e.genericFonts.bodyFont,lineHeight:e.lineHeights.table,display:"flex",alignItems:"center",justifyContent:"flex-start"})),""),h=e=>({color:e.colors.fadedText60,borderBottom:`1px solid ${e.colors.fadedText05}`,borderRight:`1px solid ${e.colors.fadedText05}`,zIndex:1}),m=e=>({overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis",lineHeight:e.lineHeights.table}),u=(0,s.Z)(c,{target:"e1xdbg9g6"})((({theme:e})=>h(e)),""),g=(0,s.Z)(c,{target:"e1xdbg9g5"})((({theme:e})=>({userSelect:"none",...h(e),...m(e)})),""),f=(0,s.Z)(c,{target:"e1xdbg9g4"})((({theme:e})=>({userSelect:"none",...h(e),...m(e)})),""),x=(0,s.Z)(c,{target:"e1xdbg9g3"})((({theme:e})=>m(e)),""),w=(0,s.Z)("div",{target:"e1xdbg9g2"})((({verticalLocator:e,horizontalLocator:t,width:o,height:n})=>({position:"absolute",[e]:"0px",[t]:"0px",width:o,height:n})),""),p=(0,s.Z)("div",{target:"e1xdbg9g1"})((({theme:e})=>({fontFamily:e.genericFonts.codeFont,color:e.colors.fadedText60,fontStyle:"italic",fontSize:e.fontSizes.md,textAlign:"center"})),""),b=(0,s.Z)("span",{target:"e1xdbg9g0"})((({theme:e})=>({color:e.colors.fadedText05,verticalAlign:"top"})),"");var C=o(76850),y=o(95870);const v=!("undefined"===typeof window||!window.document||!window.document.createElement);let S;function N(e){if((!S&&0!==S||e)&&v){const e=document.createElement("div");e.style.position="absolute",e.style.top="-9999px",e.style.width="50px",e.style.height="50px",e.style.overflow="scroll",document.body.appendChild(e),S=e.offsetWidth-e.clientWidth,document.body.removeChild(e)}return S}var I=o(3888);const D=10,E=2*I.CH.smPx,R=25,G=200,k=400,A=(e,t,o,n)=>{const{headerRows:r,headerCols:i,dataRows:d,cols:s,rows:a}=(0,l.kG)(o),c=E*r,h=t-2-N(),m=function(e,t,o,n,r,i){const l=R,d=e>2?G:k,s=({index:e})=>{const o=e,r=8*10/10,d=14+D,s=100;let a=l;for(let l=0;l<Math.min(t,s);l++){let e=-1;e=l<n?l:t>s?Math.floor(Math.random()*t):l;const{contents:c}=i(o,e),h=(c?c.length:0)*r+d;h>a&&(a=h)}return a};let a=[];const c=Array.from(Array(e),((e,t)=>s({index:t}))),h=c.reduce(((e,t)=>e+t),0),m=r-h,u=e=>e.filter((e=>e>d));if(m<0)a=c.map((e=>e>d?d:e));else{const e=u(c),t=m/e.length;a=c.map(((o,n)=>n in e.keys()?o+t:o))}let g=a.reduce(((e,t)=>e+t),0);if(g>r*(2/3)&&g<r){const t=(r-g)/e;a=a.map((e=>e+t)),g=a.reduce(((e,t)=>e+t),0)}const f=Math.min(g,r),x=({index:e})=>a[e],w=a.slice(0,o).reduce(((e,t)=>e+t));return{elementWidth:f,columnWidth:x,headerWidth:w}}(s,a,i,r,h,n);let{elementWidth:u,columnWidth:g,headerWidth:f}=m;if(0===d&&u<60){u=60,f=60;let e=0;for(let t=0;t<s;t++)e+=g({index:t});e<60&&(g=()=>60/s)}const x=a*E,w=(e||300)-2;e=Math.min(x,w);return u+=x>w?N():0,{rowHeight:E,headerHeight:c,border:2,columnWidth:g,headerWidth:f,elementWidth:u,height:e}},T={corner:u,"col-header":g,"row-header":f,data:x};var W=o(31478),z=o(95421),Z=n.forwardRef((function(e,t){return n.createElement(z.D,(0,W.Z)({iconAttrs:{fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"},iconVerticalAlign:"middle",iconViewBox:"0 0 8 8"},e,{ref:t}),n.createElement("path",{d:"M4 1L0 5l1.5 1.5L4 4l2.5 2.5L8 5 4 1z"}))}));Z.displayName="ChevronTop";var $=n.forwardRef((function(e,t){return n.createElement(z.D,(0,W.Z)({iconAttrs:{fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"},iconVerticalAlign:"middle",iconViewBox:"0 0 8 8"},e,{ref:t}),n.createElement("path",{d:"M1.5 1L0 2.5l4 4 4-4L6.5 1 4 3.5 1.5 1z"}))}));$.displayName="ChevronBottom";var j=o(87509),B=o(96266);function L({CellType:e,columnIndex:t,contents:o,rowIndex:n,sortedByUser:r,style:i,columnSortDirection:l,headerClickedCallback:s}){let a,c,h,m=o;const u=l===d.DESCENDING;null!=s&&0===n&&(a=()=>s(t),c="button",h=0,m=null==l?`Sort by column "${o}"`:`Sorted by column "${o}" (${u?"descending":"ascending"})`);const g=0===n?function(e){switch(e){case d.ASCENDING:return(0,B.jsx)(b,{"data-testid":"sortIcon",children:(0,B.jsx)(j.ZP,{content:Z,size:"xs",margin:"0 0 0 twoXS"})});case d.DESCENDING:return(0,B.jsx)(b,{"data-testid":"sortIcon",children:(0,B.jsx)(j.ZP,{content:$,size:"xs",margin:"0 0 0 twoXS"})});default:return null}}(l):void 0;return(0,B.jsxs)(e,{style:i,onClick:a,role:c,tabIndex:h,title:m,"data-testid":e.displayName,"data-test-sort-direction":l,children:[o,r?g:""]})}const H=(0,i.Z)((function({element:e,height:t,width:o}){const i=n.useRef(null),[s,c]=(0,n.useState)(!1),[h,m]=(0,n.useState)(0),[u,g]=(0,n.useState)(d.ASCENDING),[,f]=(0,l.oo)(e.get("data")),{headerRows:x,headerCols:b,dataRows:v,cols:S,rows:N}=(0,l.kG)(e),I=e=>{let t=d.ASCENDING;h===e&&(t=u===d.ASCENDING?d.DESCENDING:d.ASCENDING),m(e),g(t),c(!0)},D=(t=>{const{headerCols:o,dataRows:n}=(0,l.kG)(e),r=u!==d.DESCENDING;if(h<o||h-o>=t){const e=new Array(n);for(let t=0;t<n;t+=1)e[t]=r?t:n-(t+1);return e}return(0,l.X_)(e,h-o,r)})(f),E=function({element:e,headerRows:t,sortedDataRowIndices:o}){return(n,r)=>{if(null!=o&&r>=t){const e=r-t;e>=0&&e<o.length?(r=o[e],r+=t):(0,y.KE)(`Bad sortedDataRowIndices (rowIndex=${r}, headerRows=${t}, sortedDataRowIndices.length=${o.length}`)}const{contents:i,styles:d,type:s}=(0,l.me)(e,n,r);return{Component:T[s],styles:d,contents:(0,C.H7)(i)}}}({element:e,headerRows:x,sortedDataRowIndices:D}),R=function(e){return({columnIndex:t,key:o,rowIndex:n,style:r})=>{const{Component:i,styles:l,contents:d}=e(t,n),a=0===n?I:void 0,c=t===h?u:void 0,m={...r,...l,borderBottom:n===v?"none":void 0,borderRight:t===S-b?"none":void 0};return(0,B.jsx)(L,{CellType:i,columnIndex:t,rowIndex:n,style:m,contents:d,sortedByUser:s,columnSortDirection:c,headerClickedCallback:a},o)}}(E),{rowHeight:G,headerHeight:k,border:W,height:z,elementWidth:Z,columnWidth:$,headerWidth:j}=A(t,o,e,E);return setTimeout((()=>{null!=i.current&&i.current.recomputeGridSize()}),0),(0,n.useEffect)((()=>{h-b>=f&&(m(0),g(d.ASCENDING),c(!1))}),[h,b,f]),(0,B.jsxs)(a,{width:Z,className:"stDataFrame",children:[(0,B.jsx)(r.yR,{cellRenderer:R,fixedColumnCount:b,fixedRowCount:x,columnWidth:$,columnCount:S,enableFixedColumnScroll:!1,enableFixedRowScroll:!1,height:z,rowHeight:G,rowCount:N,width:Z,classNameBottomLeftGrid:"table-bottom-left",classNameBottomRightGrid:"table-bottom-right",classNameTopRightGrid:"table-top-right",ref:i}),(0,B.jsx)(w,{verticalLocator:"top",horizontalLocator:"right",width:W,height:k}),(0,B.jsx)(w,{verticalLocator:"bottom",horizontalLocator:"left",width:j,height:W}),0===v?(0,B.jsx)(p,{children:"empty"}):null]})}))}}]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";(globalThis.webpackChunk_stlite_desktop=globalThis.webpackChunk_stlite_desktop||[]).push([[
|
|
1
|
+
"use strict";(globalThis.webpackChunk_stlite_desktop=globalThis.webpackChunk_stlite_desktop||[]).push([[6557],{86557:(l,e,o)=>{o.r(e),o.d(e,{default:()=>b});var r=o(5057),t=o(31476),c=o(82601),a=o(66679),i=o(65873),n=o(23878),p=o(11787),s=o(95870);function f(l,e,o){return l=function(l,e){return(l=(l=(l=(l=(l=(l=(l=(l=l.replaceAll("#000032",(0,n.By)(e))).replaceAll("#000033",(0,n.He)(e))).replaceAll("#000034",(0,n.Iy)(e)?e.colors.blue80:e.colors.blue40)).replaceAll("#000035",(0,n.ny)(e))).replaceAll("#000036",(0,n.Xy)(e))).replaceAll("#000037",(0,n.yq)(e))).replaceAll("#000038",e.colors.bgColor)).replaceAll("#000039",e.colors.fadedText05)).replaceAll("#000040",e.colors.bgMix)}(l,e),l=function(l,e,o){const r="#000001",t="#000002",c="#000003",a="#000004",i="#000005",p="#000006",s="#000007",f="#000008",y="#000009",d="#000010";if("streamlit"===o){const o=(0,n.iY)(e);l=(l=(l=(l=(l=(l=(l=(l=(l=(l=l.replaceAll(r,o[0])).replaceAll(t,o[1])).replaceAll(c,o[2])).replaceAll(a,o[3])).replaceAll(i,o[4])).replaceAll(p,o[5])).replaceAll(s,o[6])).replaceAll(f,o[7])).replaceAll(y,o[8])).replaceAll(d,o[9])}else l=(l=(l=(l=(l=(l=(l=(l=(l=(l=l.replaceAll(r,"#636efa")).replaceAll(t,"#EF553B")).replaceAll(c,"#00cc96")).replaceAll(a,"#ab63fa")).replaceAll(i,"#FFA15A")).replaceAll(p,"#19d3f3")).replaceAll(s,"#FF6692")).replaceAll(f,"#B6E880")).replaceAll(y,"#FF97FF")).replaceAll(d,"#FECB52");return l}(l,e,o),l=function(l,e,o){const r="#000011",t="#000012",c="#000013",a="#000014",i="#000015",p="#000016",s="#000017",f="#000018",y="#000019",d="#000020";if("streamlit"===o){const o=(0,n.Gy)(e);l=(l=(l=(l=(l=(l=(l=(l=(l=(l=l.replaceAll(r,o[0])).replaceAll(t,o[1])).replaceAll(c,o[2])).replaceAll(a,o[3])).replaceAll(i,o[4])).replaceAll(p,o[5])).replaceAll(s,o[6])).replaceAll(f,o[7])).replaceAll(y,o[8])).replaceAll(d,o[9])}else l=(l=(l=(l=(l=(l=(l=(l=(l=(l=l.replaceAll(r,"#0d0887")).replaceAll(t,"#46039f")).replaceAll(c,"#7201a8")).replaceAll(a,"#9c179e")).replaceAll(i,"#bd3786")).replaceAll(p,"#d8576b")).replaceAll(s,"#ed7953")).replaceAll(f,"#fb9f3a")).replaceAll(y,"#fdca26")).replaceAll(d,"#f0f921");return l}(l,e,o),l=function(l,e,o){const r="#000021",t="#000022",c="#000023",a="#000024",i="#000025",p="#000026",s="#000027",f="#000028",y="#000029",d="#000030",A="#000031";if("streamlit"===o){const o=(0,n.ru)(e);l=(l=(l=(l=(l=(l=(l=(l=(l=(l=(l=l.replaceAll(r,o[0])).replaceAll(t,o[1])).replaceAll(c,o[2])).replaceAll(a,o[3])).replaceAll(i,o[4])).replaceAll(p,o[5])).replaceAll(s,o[6])).replaceAll(f,o[7])).replaceAll(y,o[8])).replaceAll(d,o[9])).replaceAll(A,o[10])}else l=(l=(l=(l=(l=(l=(l=(l=(l=(l=(l=l.replaceAll(r,"#8e0152")).replaceAll(t,"#c51b7d")).replaceAll(c,"#de77ae")).replaceAll(a,"#f1b6da")).replaceAll(i,"#fde0ef")).replaceAll(p,"#f7f7f7")).replaceAll(s,"#e6f5d0")).replaceAll(f,"#b8e186")).replaceAll(y,"#7fbc41")).replaceAll(d,"#4d9221")).replaceAll(A,"#276419");return l}(l,e,o),l}function y(l,e){try{!function(l,e){const{genericFonts:o,colors:r,fontSizes:t}=e,c={font:{color:(0,n.Xy)(e),family:o.bodyFont,size:t.twoSmPx},title:{color:r.headingColor,subtitleColor:r.bodyText,font:{family:o.headingFont,size:t.mdPx,color:r.headingColor},pad:{l:e.spacing.twoXSPx},xanchor:"left",x:0},legend:{title:{font:{size:t.twoSmPx,color:(0,n.Xy)(e)},side:"top"},valign:"top",bordercolor:r.transparent,borderwidth:e.spacing.nonePx,font:{size:t.twoSmPx,color:(0,n.yq)(e)}},paper_bgcolor:r.bgColor,plot_bgcolor:r.bgColor,yaxis:{ticklabelposition:"outside",zerolinecolor:(0,n.ny)(e),title:{font:{color:(0,n.Xy)(e),size:t.smPx},standoff:e.spacing.twoXLPx},tickcolor:(0,n.ny)(e),tickfont:{color:(0,n.Xy)(e),size:t.twoSmPx},gridcolor:(0,n.ny)(e),minor:{gridcolor:(0,n.ny)(e)},automargin:!0},xaxis:{zerolinecolor:(0,n.ny)(e),gridcolor:(0,n.ny)(e),showgrid:!1,tickfont:{color:(0,n.Xy)(e),size:t.twoSmPx},tickcolor:(0,n.ny)(e),title:{font:{color:(0,n.Xy)(e),size:t.smPx},standoff:e.spacing.xlPx},minor:{gridcolor:(0,n.ny)(e)},zeroline:!1,automargin:!0,rangeselector:{bgcolor:r.bgColor,bordercolor:(0,n.ny)(e),borderwidth:1,x:0}},margin:{pad:e.spacing.smPx,r:e.spacing.nonePx,l:e.spacing.nonePx},hoverlabel:{bgcolor:r.bgColor,bordercolor:r.fadedText10,font:{color:(0,n.Xy)(e),family:o.bodyFont,size:t.twoSmPx}},coloraxis:{colorbar:{thickness:16,xpad:e.spacing.twoXLPx,ticklabelposition:"outside",outlinecolor:r.transparent,outlinewidth:8,len:.75,y:.5745,title:{font:{color:(0,n.Xy)(e),size:t.smPx}},tickfont:{color:(0,n.Xy)(e),size:t.twoSmPx}}},ternary:{gridcolor:(0,n.Xy)(e),bgcolor:r.bgColor,title:{font:{family:o.bodyFont,size:t.smPx}},color:(0,n.Xy)(e),aaxis:{gridcolor:(0,n.Xy)(e),linecolor:(0,n.Xy)(e),tickfont:{family:o.bodyFont,size:t.twoSmPx}},baxis:{linecolor:(0,n.Xy)(e),gridcolor:(0,n.Xy)(e),tickfont:{family:o.bodyFont,size:t.twoSmPx}},caxis:{linecolor:(0,n.Xy)(e),gridcolor:(0,n.Xy)(e),tickfont:{family:o.bodyFont,size:t.twoSmPx}}}};(0,i.merge)(l,c)}(l.layout.template.layout,e)}catch(o){const l=(0,p.b)(o);(0,s.H)(l)}"title"in l.layout&&(l.layout.title=(0,i.merge)(l.layout.title,{text:`<b>${l.layout.title.text}</b>`}))}var d=o(96266);const A=450;function u(l){return!!l}function g({element:l,width:e,height:o}){const c=l.figure,i=(0,t.u)(),n=(0,r.useCallback)((()=>{const r=JSON.parse(f(c.spec,i,l.theme)),t=r.layout.height,a=r.layout.width;return u(o)?(r.layout.width=e,r.layout.height=o):l.useContainerWidth?r.layout.width=e:(r.layout.width=a,r.layout.height=t),"streamlit"===l.theme?y(r,i):r.layout=function(l,e){const{colors:o,genericFonts:r}=e,t={font:{color:o.bodyText,family:r.bodyFont},paper_bgcolor:o.bgColor,plot_bgcolor:o.secondaryBg};return{...l,font:{...t.font,...l.font},paper_bgcolor:l.paper_bgcolor||t.paper_bgcolor,plot_bgcolor:l.plot_bgcolor||t.plot_bgcolor}}(r.layout,i),r}),[l.theme,l.useContainerWidth,c.spec,o,i,e]),[p,s]=(0,r.useState)(JSON.parse(c.config)),[A,g]=(0,r.useState)(n());(0,r.useLayoutEffect)((()=>{s(JSON.parse(c.config)),g(n())}),[l,i,o,e,c.config,n]);const{data:b,layout:h,frames:m}=A;return(0,d.jsx)(a.Z,{className:"stPlotlyChart",data:b,layout:h,config:p,frames:m},u(o)?"fullscreen":"original")}const b=(0,c.Z)((function({width:l,element:e,height:o}){switch(e.chart){case"url":return function({url:l,width:e,height:o}){const r=o||A;return(0,d.jsx)("iframe",{title:"Plotly",src:l,style:{width:e,height:r}})}({url:e.url,height:o,width:l});case"figure":return(0,d.jsx)(g,{width:l,element:e,height:o});default:throw new Error(`Unrecognized PlotlyChart type: ${e.chart}`)}}))}}]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";(globalThis.webpackChunk_stlite_desktop=globalThis.webpackChunk_stlite_desktop||[]).push([[
|
|
1
|
+
"use strict";(globalThis.webpackChunk_stlite_desktop=globalThis.webpackChunk_stlite_desktop||[]).push([[6683],{86683:(e,t,s)=>{s.r(t),s.d(t,{default:()=>v});var i=s(5057),o=s(9187),a=s.n(o),r=s(31476),n=s(80865),l=s(9191),d=s(73830),p=s(98209),m=s(18950),h=s(4337),u=s(89401),g=s(46434),c=s(96266);const f="YYYY/MM/DD";function b(e){return e.map((e=>new Date(e)))}class y extends i.PureComponent{constructor(...e){super(...e),this.formClearHelper=new p.Kz,this.state={values:this.initialValue,isRange:this.props.element.isRange,isEmpty:!1},this.commitWidgetValue=e=>{this.props.widgetMgr.setStringArrayValue(this.props.element,this.state.values.map((e=>a()(e).format(f))),e)},this.onFormCleared=()=>{const e=b(this.props.element.default);this.setState({values:e},(()=>this.commitWidgetValue({fromUi:!0})))},this.handleChange=({date:e})=>{if(null===e||void 0===e)return void this.setState({values:[],isEmpty:!0});const t=[];Array.isArray(e)?e.forEach((e=>{e&&t.push(e)})):t.push(e),this.setState({values:t,isEmpty:!t},(()=>{this.state.isEmpty||this.commitWidgetValue({fromUi:!0})}))},this.handleClose=()=>{const{isEmpty:e}=this.state;e&&this.setState(((e,t)=>({values:b(t.element.default),isEmpty:!b(t.element.default)})),(()=>{this.commitWidgetValue({fromUi:!0})}))},this.getMaxDate=()=>{const{element:e}=this.props,t=e.max;return t&&t.length>0?a()(t,f).toDate():void 0}}get initialValue(){const e=this.props.widgetMgr.getStringArrayValue(this.props.element);return b(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({values:e.map((e=>new Date(e)))},(()=>{this.commitWidgetValue({fromUi:!1})}))}render(){var e;const{width:t,element:s,disabled:i,theme:o,widgetMgr:r}=this.props,{values:p,isRange:b}=this.state,{colors:y,fontSizes:v,lineHeights:C}=o,x={width:t},V=a()(s.min,f).toDate(),D=this.getMaxDate();return this.formClearHelper.manageFormClearListener(r,s.formId,this.onFormCleared),(0,c.jsxs)("div",{className:"stDateInput",style:x,children:[(0,c.jsx)(m.ON,{label:s.label,disabled:i,labelVisibility:(0,g.iF)(null===(e=s.labelVisibility)||void 0===e?void 0:e.value),children:s.help&&(0,c.jsx)(m.dT,{children:(0,c.jsx)(h.ZP,{content:s.help,placement:u.ug.TOP_RIGHT})})}),(0,c.jsx)(n.Z,{density:l.pw.high,formatString:"yyyy/MM/dd",disabled:i,onChange:this.handleChange,onClose:this.handleClose,overrides:{Popover:{props:{placement:d.r4.bottomLeft,overrides:{Body:{style:{border:`1px solid ${y.fadedText10}`}}}}},CalendarContainer:{style:{fontSize:v.sm,paddingRight:o.spacing.sm,paddingLeft:o.spacing.sm,paddingBottom:o.spacing.sm,paddingTop:o.spacing.sm}},Week:{style:{fontSize:v.sm}},Day:{style:({$pseudoHighlighted:e,$pseudoSelected:t,$selected:s,$isHovered:i})=>({fontSize:v.sm,lineHeight:C.base,"::before":{backgroundColor:s||t||e||i?`${y.secondaryBg} !important`:y.transparent},"::after":{borderColor:y.transparent}})},PrevButton:{style:()=>({display:"flex",alignItems:"center",justifyContent:"center",":active":{backgroundColor:y.transparent},":focus":{backgroundColor:y.transparent,outline:0}})},NextButton:{style:{display:"flex",alignItems:"center",justifyContent:"center",":active":{backgroundColor:y.transparent},":focus":{backgroundColor:y.transparent,outline:0}}},Input:{props:{maskChar:null,overrides:{Root:{style:{borderLeftWidth:"1px",borderRightWidth:"1px",borderTopWidth:"1px",borderBottomWidth:"1px"}},Input:{style:{paddingRight:".5rem",paddingLeft:".5rem",paddingBottom:".5rem",paddingTop:".5rem"}}}}}},value:p,minDate:V,maxDate:D,range:b})]})}}const v=(0,r.b)(y)}}]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";(globalThis.webpackChunk_stlite_desktop=globalThis.webpackChunk_stlite_desktop||[]).push([[7842],{37842:(e,t,r)=>{r.r(t),r.d(t,{default:()=>I});var n,a=r(65850),o=r(5057);function u(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"===typeof Object.getOwnPropertySymbols){var a=0;for(n=Object.getOwnPropertySymbols(e);a<n.length;a++)t.indexOf(n[a])<0&&Object.prototype.propertyIsEnumerable.call(e,n[a])&&(r[n[a]]=e[n[a]])}return r}function i(){}function l(e){return!!(e||"").match(/\d/)}function s(e){return null===e||void 0===e}function c(e){return"number"===typeof e&&isNaN(e)}function f(e){return e.replace(/[-[\]/{}()*+?.\\^$|]/g,"\\$&")}function v(e,t){void 0===t&&(t=!0);var r="-"===e[0],n=r&&t,a=(e=e.replace("-","")).split(".");return{beforeDecimal:a[0],afterDecimal:a[1]||"",hasNegation:r,addNegation:n}}function d(e,t,r){for(var n="",a=r?"0":"",o=0;o<=t-1;o++)n+=e[o]||a;return n}function g(e,t){return Array(t+1).join(e)}function m(e){var t=e+"",r="-"===t[0]?"-":"";r&&(t=t.substring(1));var n=t.split(/[eE]/g),a=n[0],o=n[1];if(!(o=Number(o)))return r+a;var u=1+o,i=(a=a.replace(".","")).length;return u<0?a="0."+g("0",Math.abs(u))+a:u>=i?a+=g("0",u-i):a=(a.substring(0,u)||"0")+"."+a.substring(u),r+a}function p(e,t,r){if(-1!==["","-"].indexOf(e))return e;var n=(-1!==e.indexOf(".")||r)&&t,a=v(e),o=a.beforeDecimal,u=a.afterDecimal,i=a.hasNegation,l=parseFloat("0."+(u||"0")),s=(u.length<=t?"0."+u:l.toFixed(t)).split(".");return""+(i?"-":"")+o.split("").reverse().reduce((function(e,t,r){return e.length>r?(Number(e[0])+Number(t)).toString()+e.substring(1,e.length):t+e}),s[0])+(n?".":"")+d(s[1]||"",t,r)}function h(e,t){if(e.value=e.value,null!==e){if(e.createTextRange){var r=e.createTextRange();return r.move("character",t),r.select(),!0}return e.selectionStart||0===e.selectionStart?(e.focus(),e.setSelectionRange(t,t),!0):(e.focus(),!1)}}function S(e){return Math.max(e.selectionStart,e.selectionEnd)}function b(e){return{from:{start:0,end:0},to:{start:0,end:e.length},lastValue:""}}function y(e,t,r,n){var a,o,u,i=e.length;if(a=t,o=0,u=i,t=Math.min(Math.max(a,o),u),"left"===n){for(;t>=0&&!r[t];)t--;-1===t&&(t=r.indexOf(!0))}else{for(;t<=i&&!r[t];)t++;t>i&&(t=r.lastIndexOf(!0))}return-1===t&&(t=i),t}function w(e){for(var t=Array.from({length:e.length+1}).map((function(){return!0})),r=0,n=t.length;r<n;r++)t[r]=Boolean(l(e[r])||l(e[r-1]));return t}function x(e,t,r,n,a,u){void 0===u&&(u=i);var l=(0,o.useRef)(),f=function(e){var t=(0,o.useRef)(e);t.current=e;var r=(0,o.useRef)((function(){for(var e=[],r=arguments.length;r--;)e[r]=arguments[r];return t.current.apply(t,e)}));return r.current}((function(e){var t,o;return s(e)||c(e)?(o="",t=""):"number"===typeof e||r?(o="number"===typeof e?m(e):e,t=n(o)):(o=a(e,void 0),t=e),{formattedValue:t,numAsString:o}})),v=(0,o.useState)((function(){return f(t)})),d=v[0],g=v[1];return(0,o.useMemo)((function(){s(e)?l.current=void 0:(l.current=f(e),g(l.current))}),[e,f]),[d,function(e,t){g({formattedValue:e.formattedValue,numAsString:e.value}),u(e,t)}]}function V(e){return e.replace(/[^0-9]/g,"")}function D(e){return e}function O(e){var t=e.type;void 0===t&&(t="text");var r=e.displayType;void 0===r&&(r="input");var a=e.customInput,s=e.renderText,c=e.getInputRef,f=e.format;void 0===f&&(f=D);var v=e.removeFormatting;void 0===v&&(v=V);var d=e.defaultValue,g=e.valueIsNumericString,m=e.onValueChange,p=e.isAllowed,b=e.onChange;void 0===b&&(b=i);var O=e.onKeyDown;void 0===O&&(O=i);var C=e.onMouseUp;void 0===C&&(C=i);var N=e.onFocus;void 0===N&&(N=i);var T=e.onBlur;void 0===T&&(T=i);var E=e.value,R=e.getCaretBoundary;void 0===R&&(R=w);var A=e.isValidInputCharacter;void 0===A&&(A=l);var B=u(e,["type","displayType","customInput","renderText","getInputRef","format","removeFormatting","defaultValue","valueIsNumericString","onValueChange","isAllowed","onChange","onKeyDown","onMouseUp","onFocus","onBlur","value","getCaretBoundary","isValidInputCharacter"]),I=x(E,d,Boolean(g),f,v,m),j=I[0],k=j.formattedValue,F=j.numAsString,M=I[1],P=(0,o.useRef)();(0,o.useEffect)((function(){var e=f(F);if(void 0===P.current||e!==P.current){var t=U.current,r=v(e,void 0);H({formattedValue:e,numAsString:r,input:t,setCaretPosition:!0,source:n.props,event:void 0})}}));var K=(0,o.useState)(!1),L=K[0],W=K[1],U=(0,o.useRef)(null),_=(0,o.useRef)({setCaretTimeout:null,focusTimeout:null});(0,o.useEffect)((function(){return W(!0),function(){clearTimeout(_.current.setCaretTimeout),clearTimeout(_.current.focusTimeout)}}),[]);var G=f,$=function(e,t){var r=parseFloat(t);return{formattedValue:e,value:t,floatValue:isNaN(r)?void 0:r}},z=function(e,t,r){h(e,t),_.current.setCaretTimeout=setTimeout((function(){e.value===r&&h(e,t)}),0)},Z=function(e,t,r){return y(e,t,R(e),r)},q=function(e,t,r){var n=R(t),a=function(e,t,r,n,a,o){var u=a.findIndex((function(e){return e})),i=e.slice(0,u);t||r.startsWith(i)||(r=i+r,n+=i.length);for(var l=r.length,s=e.length,c={},f=new Array(l),v=0;v<l;v++){f[v]=-1;for(var d=0,g=s;d<g;d++)if(r[v]===e[d]&&!0!==c[d]){f[v]=d,c[d]=!0;break}}for(var m=n;m<l&&(-1===f[m]||!o(r[m]));)m++;var p=m===l||-1===f[m]?s:f[m];for(m=n-1;m>0&&-1===f[m];)m--;var h=-1===m||-1===f[m]?0:f[m]+1;return h>p?p:n-h<p-n?h:p}(t,k,e,r,n,A);return a=y(t,a,n)},H=function(e){var t=e.formattedValue;void 0===t&&(t="");var r=e.input,n=e.setCaretPosition;void 0===n&&(n=!0);var a=e.source,o=e.event,u=e.numAsString,i=e.caretPos;if(r){if(void 0===i&&n){var l=e.inputValue||r.value,s=S(r);r.value=t,i=q(l,t,s)}r.value=t,n&&void 0!==i&&z(r,i,t)}t!==k&&function(e,t){P.current=e.formattedValue,M(e,t)}($(t,u),{event:o,source:a})},J=!L||"undefined"===typeof navigator||navigator.platform&&/iPhone|iPod/.test(navigator.platform)?void 0:"numeric",Q=Object.assign({inputMode:J},B,{type:t,value:k,onChange:function(e){var t=function(e,t,r){var n=function(e,t){for(var r=0,n=0,a=e.length,o=t.length;e[r]===t[r]&&r<a;)r++;for(;e[a-1-n]===t[o-1-n]&&o-n>r&&a-n>r;)n++;return{from:{start:r,end:a-n},to:{start:r,end:o-n}}}(k,e),a=Object.assign(Object.assign({},n),{lastValue:k}),o=v(e,a),u=G(o);if(o=v(u,void 0),p&&!p($(u,o))){var i=t.target,l=S(i),s=q(e,k,l);return z(i,s,k),!1}return H({formattedValue:u,numAsString:o,inputValue:e,event:t,source:r,setCaretPosition:!0,input:t.target}),!0}(e.target.value,e,n.event);t&&b(e)},onKeyDown:function(e){var t,r=e.target,n=e.key,a=r.selectionStart,o=r.selectionEnd,u=r.value;if(void 0===u&&(u=""),"ArrowLeft"===n||"Backspace"===n?t=Math.max(a-1,0):"ArrowRight"===n?t=Math.min(a+1,u.length):"Delete"===n&&(t=a),void 0!==t&&a===o){var i=t;if("ArrowLeft"===n||"ArrowRight"===n)i=Z(u,t,"ArrowLeft"===n?"left":"right");else"Delete"!==n||A(u[t])?"Backspace"!==n||A(u[t])||(i=Z(u,t,"left")):i=Z(u,t,"right");i!==t&&z(r,i,u),e.isUnitTestRun&&z(r,i,u),O(e)}else O(e)},onMouseUp:function(e){var t=e.target,r=t.selectionStart,n=t.selectionEnd,a=t.value;if(void 0===a&&(a=""),r===n){var o=Z(a,r);o!==r&&z(t,o,a)}C(e)},onFocus:function(e){e.persist&&e.persist();var t=e.target;U.current=t,_.current.focusTimeout=setTimeout((function(){var r=t.selectionStart,n=t.selectionEnd,a=t.value;void 0===a&&(a="");var o=Z(a,r);o===r||0===r&&n===a.length||z(t,o,a),N(e)}),0)},onBlur:function(e){U.current=null,clearTimeout(_.current.focusTimeout),clearTimeout(_.current.setCaretTimeout),T(e)}});if("text"===r)return s?o.createElement(o.Fragment,null,s(k,B)||null):o.createElement("span",Object.assign({},B,{ref:c}),k);if(a){var X=a;return o.createElement(X,Object.assign({},Q,{ref:c}))}return o.createElement("input",Object.assign({},Q,{ref:c}))}function C(e,t){var r=t.decimalScale,n=t.fixedDecimalScale,a=t.prefix;void 0===a&&(a="");var o=t.suffix;void 0===o&&(o="");var u=t.allowNegative;void 0===u&&(u=!0);var i=t.thousandsGroupStyle;if(void 0===i&&(i="thousand"),""===e||"-"===e)return e;var l=N(t),s=l.thousandSeparator,c=l.decimalSeparator,f=0!==r&&-1!==e.indexOf(".")||r&&n,g=v(e,u),m=g.beforeDecimal,p=g.afterDecimal,h=g.addNegation;return void 0!==r&&(p=d(p,r,!!n)),s&&(m=function(e,t,r){var n=function(e){switch(e){case"lakh":return/(\d+?)(?=(\d\d)+(\d)(?!\d))(\.\d+)?/g;case"wan":return/(\d)(?=(\d{4})+(?!\d))/g;default:return/(\d)(?=(\d{3})+(?!\d))/g}}(r),a=e.search(/[1-9]/);return a=-1===a?e.length:a,e.substring(0,a)+e.substring(a,e.length).replace(n,"$1"+t)}(m,s,i)),a&&(m=a+m),o&&(p+=o),h&&(m="-"+m),e=m+(f&&c||"")+p}function N(e){var t=e.decimalSeparator;void 0===t&&(t=".");var r=e.thousandSeparator,n=e.allowedDecimalSeparators;return!0===r&&(r=","),n||(n=[t,"."]),{decimalSeparator:t,thousandSeparator:r,allowedDecimalSeparators:n}}function T(e,t,r){void 0===t&&(t=b(e));var n=r.allowNegative;void 0===n&&(n=!0);var a=r.prefix;void 0===a&&(a="");var o=r.suffix;void 0===o&&(o="");var u=r.decimalScale,i=t.from,l=t.to,s=l.start,c=l.end,d=N(r),g=d.allowedDecimalSeparators,m=d.decimalSeparator,p=e[c]===m;if(c-s===1&&-1!==g.indexOf(e[s])){var h=0===u?"":m;e=e.substring(0,s)+h+e.substring(s+1,e.length)}var S=!1;a.startsWith("-")?S=e.startsWith("--"):o.startsWith("-")&&e.length===o.length?S=!1:"-"===e[0]&&(S=!0),S&&(e=e.substring(1),s-=1,c-=1);var y=0;e.startsWith(a)?y+=a.length:s<a.length&&(y=s),c-=y;var w=(e=e.substring(y)).length,x=e.length-o.length;e.endsWith(o)?w=x:c>e.length-o.length&&(w=c),e=e.substring(0,w),e=function(e,t){void 0===e&&(e="");var r=new RegExp("(-)"),n=new RegExp("(-)(.)*(-)"),a=r.test(e),o=n.test(e);return e=e.replace(/-/g,""),a&&!o&&t&&(e="-"+e),e}(S?"-"+e:e,n),e=(e.match(function(e,t){return new RegExp("(^-)|[0-9]|"+f(e),t?"g":void 0)}(m,!0))||[]).join("");var V=e.indexOf(m),D=v(e=e.replace(new RegExp(f(m),"g"),(function(e,t){return t===V?".":""})),n),O=D.beforeDecimal,C=D.afterDecimal,T=D.addNegation;return l.end-l.start<i.end-i.start&&""===O&&p&&!parseFloat(C)&&(e=T?"-":""),e}function E(e){var t=e.decimalSeparator;void 0===t&&(t=".");e.allowedDecimalSeparators,e.thousandsGroupStyle,e.suffix,e.allowNegative;var r=e.allowLeadingZeros,a=e.onKeyDown;void 0===a&&(a=i);var o=e.onBlur;void 0===o&&(o=i);var f=e.thousandSeparator,v=e.decimalScale,d=e.fixedDecimalScale,g=e.prefix;void 0===g&&(g="");var S=e.defaultValue,b=e.value,y=e.valueIsNumericString,w=e.onValueChange,V=u(e,["decimalSeparator","allowedDecimalSeparators","thousandsGroupStyle","suffix","allowNegative","allowLeadingZeros","onKeyDown","onBlur","thousandSeparator","decimalScale","fixedDecimalScale","prefix","defaultValue","value","valueIsNumericString","onValueChange"]);!function(e){var t=N(e),r=t.thousandSeparator,n=t.decimalSeparator;if(r===n)throw new Error("\n Decimal separator can't be same as thousand separator.\n thousandSeparator: "+r+' (thousandSeparator = {true} is same as thousandSeparator = ",")\n decimalSeparator: '+n+" (default value for decimalSeparator is .)\n ")}(e);var D=function(t){return C(t,e)},O=function(t,r){return T(t,r,e)},E=y;s(b)?s(S)||(E=null!==y&&void 0!==y?y:"number"===typeof S):E=null!==y&&void 0!==y?y:"number"===typeof b;var R=function(e){return s(e)||c(e)?e:("number"===typeof e&&(e=m(e)),E&&"number"===typeof v?p(e,v,Boolean(d)):e)},A=x(R(b),R(S),Boolean(E),D,O,w),B=A[0],I=B.numAsString,j=B.formattedValue,k=A[1];return Object.assign(Object.assign({},V),{value:j,valueIsNumericString:!1,isValidInputCharacter:function(e){return e===t||l(e)},onValueChange:k,format:D,removeFormatting:O,getCaretBoundary:function(t){return function(e,t){var r=t.prefix;void 0===r&&(r="");var n=t.suffix;void 0===n&&(n="");var a=Array.from({length:e.length+1}).map((function(){return!0})),o="-"===e[0];a.fill(!1,0,r.length+(o?1:0));var u=e.length;return a.fill(!1,u-n.length+1,u+1),a}(t,e)},onKeyDown:function(t){var r=t.target,n=t.key,o=r.selectionStart,u=r.selectionEnd,i=r.value;if(void 0===i&&(i=""),o===u){"Backspace"===n&&"-"===i[0]&&o===g.length+1&&h(r,1);var l=N(e),s=l.decimalSeparator,c=l.allowedDecimalSeparators;"Backspace"===n&&i[o-1]===s&&v&&d&&(h(r,o-1),t.preventDefault()),(null===c||void 0===c?void 0:c.includes(n))&&i[o]===s&&h(r,o+1);var m=!0===f?",":f;"Backspace"===n&&i[o-1]===m&&h(r,o-1),"Delete"===n&&i[o]===m&&h(r,o+1),a(t)}else a(t)},onBlur:function(t){var a=I;if(a.match(/\d/g)||(a=""),r||(a=function(e){if(!e)return e;var t="-"===e[0];t&&(e=e.substring(1,e.length));var r=e.split("."),n=r[0].replace(/^0+/,"")||"0",a=r[1]||"";return(t?"-":"")+n+(a?"."+a:"")}(a)),d&&v&&(a=p(a,v,d)),a!==I){var u=C(a,e);k({formattedValue:u,value:a,floatValue:parseFloat(a)},{event:t,source:n.event})}o(t)}})}function R(e){var t=E(e);return o.createElement(O,Object.assign({},t))}!function(e){e.event="event",e.props="prop"}(n||(n={}));var A=(0,a.d)("div")({name:"NumberOverlayEditorStyle",class:"n1czszh3"});function B(){var e,t,r;const n=null==(r=null==(t=null==(e=Intl.NumberFormat())?void 0:e.formatToParts(1.1))?void 0:t.find((e=>"decimal"===e.type)))?void 0:r.value;return null!=n?n:"."}var I=e=>{const{value:t,onChange:r,disabled:n,highlight:a,validatedSelection:u}=e,i=o.useRef();return o.useLayoutEffect((()=>{var e;if(void 0!==u){const t="number"===typeof u?[u,null]:u;null==(e=i.current)||e.setSelectionRange(t[0],t[1])}}),[u]),o.createElement(A,null,o.createElement(R,{autoFocus:!0,getInputRef:i,className:"gdg-input",onFocus:e=>e.target.setSelectionRange(a?0:e.target.value.length,e.target.value.length),disabled:!0===n,thousandSeparator:"."===B()?",":".",decimalSeparator:B(),value:Object.is(t,-0)?"-":null!=t?t:"",onValueChange:r}))}}}]);
|
|
1
|
+
"use strict";(globalThis.webpackChunk_stlite_desktop=globalThis.webpackChunk_stlite_desktop||[]).push([[6756],{86756:(e,t,r)=>{r.r(t),r.d(t,{default:()=>I});var n,a=r(65850),o=r(5057);function u(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"===typeof Object.getOwnPropertySymbols){var a=0;for(n=Object.getOwnPropertySymbols(e);a<n.length;a++)t.indexOf(n[a])<0&&Object.prototype.propertyIsEnumerable.call(e,n[a])&&(r[n[a]]=e[n[a]])}return r}function i(){}function l(e){return!!(e||"").match(/\d/)}function c(e){return null===e||void 0===e}function s(e){return"number"===typeof e&&isNaN(e)}function f(e){return e.replace(/[-[\]/{}()*+?.\\^$|]/g,"\\$&")}function v(e,t){void 0===t&&(t=!0);var r="-"===e[0],n=r&&t,a=(e=e.replace("-","")).split(".");return{beforeDecimal:a[0],afterDecimal:a[1]||"",hasNegation:r,addNegation:n}}function d(e,t,r){for(var n="",a=r?"0":"",o=0;o<=t-1;o++)n+=e[o]||a;return n}function g(e,t){return Array(t+1).join(e)}function m(e){var t=e+"",r="-"===t[0]?"-":"";r&&(t=t.substring(1));var n=t.split(/[eE]/g),a=n[0],o=n[1];if(!(o=Number(o)))return r+a;var u=1+o,i=(a=a.replace(".","")).length;return u<0?a="0."+g("0",Math.abs(u))+a:u>=i?a+=g("0",u-i):a=(a.substring(0,u)||"0")+"."+a.substring(u),r+a}function p(e,t,r){if(-1!==["","-"].indexOf(e))return e;var n=(-1!==e.indexOf(".")||r)&&t,a=v(e),o=a.beforeDecimal,u=a.afterDecimal,i=a.hasNegation,l=parseFloat("0."+(u||"0")),c=(u.length<=t?"0."+u:l.toFixed(t)).split(".");return""+(i?"-":"")+o.split("").reverse().reduce((function(e,t,r){return e.length>r?(Number(e[0])+Number(t)).toString()+e.substring(1,e.length):t+e}),c[0])+(n?".":"")+d(c[1]||"",t,r)}function h(e,t){if(e.value=e.value,null!==e){if(e.createTextRange){var r=e.createTextRange();return r.move("character",t),r.select(),!0}return e.selectionStart||0===e.selectionStart?(e.focus(),e.setSelectionRange(t,t),!0):(e.focus(),!1)}}function S(e){return Math.max(e.selectionStart,e.selectionEnd)}function b(e){return{from:{start:0,end:0},to:{start:0,end:e.length},lastValue:""}}function y(e,t,r,n){var a,o,u,i=e.length;if(a=t,o=0,u=i,t=Math.min(Math.max(a,o),u),"left"===n){for(;t>=0&&!r[t];)t--;-1===t&&(t=r.indexOf(!0))}else{for(;t<=i&&!r[t];)t++;t>i&&(t=r.lastIndexOf(!0))}return-1===t&&(t=i),t}function w(e){for(var t=Array.from({length:e.length+1}).map((function(){return!0})),r=0,n=t.length;r<n;r++)t[r]=Boolean(l(e[r])||l(e[r-1]));return t}function x(e,t,r,n,a,u){void 0===u&&(u=i);var l=(0,o.useRef)(),f=function(e){var t=(0,o.useRef)(e);t.current=e;var r=(0,o.useRef)((function(){for(var e=[],r=arguments.length;r--;)e[r]=arguments[r];return t.current.apply(t,e)}));return r.current}((function(e){var t,o;return c(e)||s(e)?(o="",t=""):"number"===typeof e||r?(o="number"===typeof e?m(e):e,t=n(o)):(o=a(e,void 0),t=e),{formattedValue:t,numAsString:o}})),v=(0,o.useState)((function(){return f(t)})),d=v[0],g=v[1];return(0,o.useMemo)((function(){c(e)?l.current=void 0:(l.current=f(e),g(l.current))}),[e,f]),[d,function(e,t){g({formattedValue:e.formattedValue,numAsString:e.value}),u(e,t)}]}function V(e){return e.replace(/[^0-9]/g,"")}function D(e){return e}function O(e){var t=e.type;void 0===t&&(t="text");var r=e.displayType;void 0===r&&(r="input");var a=e.customInput,c=e.renderText,s=e.getInputRef,f=e.format;void 0===f&&(f=D);var v=e.removeFormatting;void 0===v&&(v=V);var d=e.defaultValue,g=e.valueIsNumericString,m=e.onValueChange,p=e.isAllowed,b=e.onChange;void 0===b&&(b=i);var O=e.onKeyDown;void 0===O&&(O=i);var N=e.onMouseUp;void 0===N&&(N=i);var C=e.onFocus;void 0===C&&(C=i);var T=e.onBlur;void 0===T&&(T=i);var E=e.value,R=e.getCaretBoundary;void 0===R&&(R=w);var A=e.isValidInputCharacter;void 0===A&&(A=l);var B=u(e,["type","displayType","customInput","renderText","getInputRef","format","removeFormatting","defaultValue","valueIsNumericString","onValueChange","isAllowed","onChange","onKeyDown","onMouseUp","onFocus","onBlur","value","getCaretBoundary","isValidInputCharacter"]),I=x(E,d,Boolean(g),f,v,m),j=I[0],k=j.formattedValue,F=j.numAsString,M=I[1],P=(0,o.useRef)();(0,o.useEffect)((function(){var e=f(F);if(void 0===P.current||e!==P.current){var t=U.current,r=v(e,void 0);H({formattedValue:e,numAsString:r,input:t,setCaretPosition:!0,source:n.props,event:void 0})}}));var K=(0,o.useState)(!1),L=K[0],W=K[1],U=(0,o.useRef)(null),_=(0,o.useRef)({setCaretTimeout:null,focusTimeout:null});(0,o.useEffect)((function(){return W(!0),function(){clearTimeout(_.current.setCaretTimeout),clearTimeout(_.current.focusTimeout)}}),[]);var G=f,$=function(e,t){var r=parseFloat(t);return{formattedValue:e,value:t,floatValue:isNaN(r)?void 0:r}},z=function(e,t,r){h(e,t),_.current.setCaretTimeout=setTimeout((function(){e.value===r&&h(e,t)}),0)},Z=function(e,t,r){return y(e,t,R(e),r)},q=function(e,t,r){var n=R(t),a=function(e,t,r,n,a,o){var u=a.findIndex((function(e){return e})),i=e.slice(0,u);t||r.startsWith(i)||(r=i+r,n+=i.length);for(var l=r.length,c=e.length,s={},f=new Array(l),v=0;v<l;v++){f[v]=-1;for(var d=0,g=c;d<g;d++)if(r[v]===e[d]&&!0!==s[d]){f[v]=d,s[d]=!0;break}}for(var m=n;m<l&&(-1===f[m]||!o(r[m]));)m++;var p=m===l||-1===f[m]?c:f[m];for(m=n-1;m>0&&-1===f[m];)m--;var h=-1===m||-1===f[m]?0:f[m]+1;return h>p?p:n-h<p-n?h:p}(t,k,e,r,n,A);return a=y(t,a,n)},H=function(e){var t=e.formattedValue;void 0===t&&(t="");var r=e.input,n=e.setCaretPosition;void 0===n&&(n=!0);var a=e.source,o=e.event,u=e.numAsString,i=e.caretPos;if(r){if(void 0===i&&n){var l=e.inputValue||r.value,c=S(r);r.value=t,i=q(l,t,c)}r.value=t,n&&void 0!==i&&z(r,i,t)}t!==k&&function(e,t){P.current=e.formattedValue,M(e,t)}($(t,u),{event:o,source:a})},J=!L||"undefined"===typeof navigator||navigator.platform&&/iPhone|iPod/.test(navigator.platform)?void 0:"numeric",Q=Object.assign({inputMode:J},B,{type:t,value:k,onChange:function(e){var t=function(e,t,r){var n=function(e,t){for(var r=0,n=0,a=e.length,o=t.length;e[r]===t[r]&&r<a;)r++;for(;e[a-1-n]===t[o-1-n]&&o-n>r&&a-n>r;)n++;return{from:{start:r,end:a-n},to:{start:r,end:o-n}}}(k,e),a=Object.assign(Object.assign({},n),{lastValue:k}),o=v(e,a),u=G(o);if(o=v(u,void 0),p&&!p($(u,o))){var i=t.target,l=S(i),c=q(e,k,l);return z(i,c,k),!1}return H({formattedValue:u,numAsString:o,inputValue:e,event:t,source:r,setCaretPosition:!0,input:t.target}),!0}(e.target.value,e,n.event);t&&b(e)},onKeyDown:function(e){var t,r=e.target,n=e.key,a=r.selectionStart,o=r.selectionEnd,u=r.value;if(void 0===u&&(u=""),"ArrowLeft"===n||"Backspace"===n?t=Math.max(a-1,0):"ArrowRight"===n?t=Math.min(a+1,u.length):"Delete"===n&&(t=a),void 0!==t&&a===o){var i=t;if("ArrowLeft"===n||"ArrowRight"===n)i=Z(u,t,"ArrowLeft"===n?"left":"right");else"Delete"!==n||A(u[t])?"Backspace"!==n||A(u[t])||(i=Z(u,t,"left")):i=Z(u,t,"right");i!==t&&z(r,i,u),e.isUnitTestRun&&z(r,i,u),O(e)}else O(e)},onMouseUp:function(e){var t=e.target,r=t.selectionStart,n=t.selectionEnd,a=t.value;if(void 0===a&&(a=""),r===n){var o=Z(a,r);o!==r&&z(t,o,a)}N(e)},onFocus:function(e){e.persist&&e.persist();var t=e.target;U.current=t,_.current.focusTimeout=setTimeout((function(){var r=t.selectionStart,n=t.selectionEnd,a=t.value;void 0===a&&(a="");var o=Z(a,r);o===r||0===r&&n===a.length||z(t,o,a),C(e)}),0)},onBlur:function(e){U.current=null,clearTimeout(_.current.focusTimeout),clearTimeout(_.current.setCaretTimeout),T(e)}});if("text"===r)return c?o.createElement(o.Fragment,null,c(k,B)||null):o.createElement("span",Object.assign({},B,{ref:s}),k);if(a){var X=a;return o.createElement(X,Object.assign({},Q,{ref:s}))}return o.createElement("input",Object.assign({},Q,{ref:s}))}function N(e,t){var r=t.decimalScale,n=t.fixedDecimalScale,a=t.prefix;void 0===a&&(a="");var o=t.suffix;void 0===o&&(o="");var u=t.allowNegative;void 0===u&&(u=!0);var i=t.thousandsGroupStyle;if(void 0===i&&(i="thousand"),""===e||"-"===e)return e;var l=C(t),c=l.thousandSeparator,s=l.decimalSeparator,f=0!==r&&-1!==e.indexOf(".")||r&&n,g=v(e,u),m=g.beforeDecimal,p=g.afterDecimal,h=g.addNegation;return void 0!==r&&(p=d(p,r,!!n)),c&&(m=function(e,t,r){var n=function(e){switch(e){case"lakh":return/(\d+?)(?=(\d\d)+(\d)(?!\d))(\.\d+)?/g;case"wan":return/(\d)(?=(\d{4})+(?!\d))/g;default:return/(\d)(?=(\d{3})+(?!\d))/g}}(r),a=e.search(/[1-9]/);return a=-1===a?e.length:a,e.substring(0,a)+e.substring(a,e.length).replace(n,"$1"+t)}(m,c,i)),a&&(m=a+m),o&&(p+=o),h&&(m="-"+m),e=m+(f&&s||"")+p}function C(e){var t=e.decimalSeparator;void 0===t&&(t=".");var r=e.thousandSeparator,n=e.allowedDecimalSeparators;return!0===r&&(r=","),n||(n=[t,"."]),{decimalSeparator:t,thousandSeparator:r,allowedDecimalSeparators:n}}function T(e,t,r){void 0===t&&(t=b(e));var n=r.allowNegative;void 0===n&&(n=!0);var a=r.prefix;void 0===a&&(a="");var o=r.suffix;void 0===o&&(o="");var u=r.decimalScale,i=t.from,l=t.to,c=l.start,s=l.end,d=C(r),g=d.allowedDecimalSeparators,m=d.decimalSeparator,p=e[s]===m;if(s-c===1&&-1!==g.indexOf(e[c])){var h=0===u?"":m;e=e.substring(0,c)+h+e.substring(c+1,e.length)}var S=!1;a.startsWith("-")?S=e.startsWith("--"):o.startsWith("-")&&e.length===o.length?S=!1:"-"===e[0]&&(S=!0),S&&(e=e.substring(1),c-=1,s-=1);var y=0;e.startsWith(a)?y+=a.length:c<a.length&&(y=c),s-=y;var w=(e=e.substring(y)).length,x=e.length-o.length;e.endsWith(o)?w=x:s>e.length-o.length&&(w=s),e=e.substring(0,w),e=function(e,t){void 0===e&&(e="");var r=new RegExp("(-)"),n=new RegExp("(-)(.)*(-)"),a=r.test(e),o=n.test(e);return e=e.replace(/-/g,""),a&&!o&&t&&(e="-"+e),e}(S?"-"+e:e,n),e=(e.match(function(e,t){return new RegExp("(^-)|[0-9]|"+f(e),t?"g":void 0)}(m,!0))||[]).join("");var V=e.indexOf(m),D=v(e=e.replace(new RegExp(f(m),"g"),(function(e,t){return t===V?".":""})),n),O=D.beforeDecimal,N=D.afterDecimal,T=D.addNegation;return l.end-l.start<i.end-i.start&&""===O&&p&&!parseFloat(N)&&(e=T?"-":""),e}function E(e){var t=e.decimalSeparator;void 0===t&&(t=".");e.allowedDecimalSeparators,e.thousandsGroupStyle,e.suffix,e.allowNegative;var r=e.allowLeadingZeros,a=e.onKeyDown;void 0===a&&(a=i);var o=e.onBlur;void 0===o&&(o=i);var f=e.thousandSeparator,v=e.decimalScale,d=e.fixedDecimalScale,g=e.prefix;void 0===g&&(g="");var S=e.defaultValue,b=e.value,y=e.valueIsNumericString,w=e.onValueChange,V=u(e,["decimalSeparator","allowedDecimalSeparators","thousandsGroupStyle","suffix","allowNegative","allowLeadingZeros","onKeyDown","onBlur","thousandSeparator","decimalScale","fixedDecimalScale","prefix","defaultValue","value","valueIsNumericString","onValueChange"]);!function(e){var t=C(e),r=t.thousandSeparator,n=t.decimalSeparator;if(r===n)throw new Error("\n Decimal separator can't be same as thousand separator.\n thousandSeparator: "+r+' (thousandSeparator = {true} is same as thousandSeparator = ",")\n decimalSeparator: '+n+" (default value for decimalSeparator is .)\n ")}(e);var D=function(t){return N(t,e)},O=function(t,r){return T(t,r,e)},E=y;c(b)?c(S)||(E=null!==y&&void 0!==y?y:"number"===typeof S):E=null!==y&&void 0!==y?y:"number"===typeof b;var R=function(e){return c(e)||s(e)?e:("number"===typeof e&&(e=m(e)),E&&"number"===typeof v?p(e,v,Boolean(d)):e)},A=x(R(b),R(S),Boolean(E),D,O,w),B=A[0],I=B.numAsString,j=B.formattedValue,k=A[1];return Object.assign(Object.assign({},V),{value:j,valueIsNumericString:!1,isValidInputCharacter:function(e){return e===t||l(e)},onValueChange:k,format:D,removeFormatting:O,getCaretBoundary:function(t){return function(e,t){var r=t.prefix;void 0===r&&(r="");var n=t.suffix;void 0===n&&(n="");var a=Array.from({length:e.length+1}).map((function(){return!0})),o="-"===e[0];a.fill(!1,0,r.length+(o?1:0));var u=e.length;return a.fill(!1,u-n.length+1,u+1),a}(t,e)},onKeyDown:function(t){var r=t.target,n=t.key,o=r.selectionStart,u=r.selectionEnd,i=r.value;if(void 0===i&&(i=""),o===u){"Backspace"===n&&"-"===i[0]&&o===g.length+1&&h(r,1);var l=C(e),c=l.decimalSeparator,s=l.allowedDecimalSeparators;"Backspace"===n&&i[o-1]===c&&v&&d&&(h(r,o-1),t.preventDefault()),(null===s||void 0===s?void 0:s.includes(n))&&i[o]===c&&h(r,o+1);var m=!0===f?",":f;"Backspace"===n&&i[o-1]===m&&h(r,o-1),"Delete"===n&&i[o]===m&&h(r,o+1),a(t)}else a(t)},onBlur:function(t){var a=I;if(a.match(/\d/g)||(a=""),r||(a=function(e){if(!e)return e;var t="-"===e[0];t&&(e=e.substring(1,e.length));var r=e.split("."),n=r[0].replace(/^0+/,"")||"0",a=r[1]||"";return(t?"-":"")+n+(a?"."+a:"")}(a)),d&&v&&(a=p(a,v,d)),a!==I){var u=N(a,e);k({formattedValue:u,value:a,floatValue:parseFloat(a)},{event:t,source:n.event})}o(t)}})}function R(e){var t=E(e);return o.createElement(O,Object.assign({},t))}!function(e){e.event="event",e.props="prop"}(n||(n={}));var A=(0,a.d)("div")({name:"NumberOverlayEditorStyle",class:"n1czszh3"});function B(){var e,t,r;const n=null==(r=null==(t=null==(e=Intl.NumberFormat())?void 0:e.formatToParts(1.1))?void 0:t.find((e=>"decimal"===e.type)))?void 0:r.value;return null!=n?n:"."}var I=e=>{const{value:t,onChange:r,disabled:n,highlight:a,validatedSelection:u,fixedDecimals:i,allowNegative:l}=e,c=o.useRef();return o.useLayoutEffect((()=>{var e;if(void 0!==u){const t="number"===typeof u?[u,null]:u;null==(e=c.current)||e.setSelectionRange(t[0],t[1])}}),[u]),o.createElement(A,null,o.createElement(R,{autoFocus:!0,getInputRef:c,className:"gdg-input",onFocus:e=>e.target.setSelectionRange(a?0:e.target.value.length,e.target.value.length),disabled:!0===n,decimalScale:i,allowNegative:l,thousandSeparator:"."===B()?",":".",decimalSeparator:B(),value:Object.is(t,-0)?"-":null!=t?t:"",onValueChange:r}))}}}]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";(globalThis.webpackChunk_stlite_desktop=globalThis.webpackChunk_stlite_desktop||[]).push([[
|
|
1
|
+
"use strict";(globalThis.webpackChunk_stlite_desktop=globalThis.webpackChunk_stlite_desktop||[]).push([[6862],{36862:(e,t,i)=>{i.r(t),i.d(t,{default:()=>u});var s=i(5057),o=i(98209),l=i(65742),a=i(46434),r=i(96266);class n extends s.PureComponent{constructor(...e){super(...e),this.formClearHelper=new o.Kz,this.state={value:this.initialValue},this.commitWidgetValue=e=>{this.props.widgetMgr.setStringValue(this.props.element,this.state.value,e)},this.onFormCleared=()=>{this.setState(((e,t)=>({value:t.element.default})),(()=>this.commitWidgetValue({fromUi:!0})))},this.onColorClose=e=>{this.setState({value:e},(()=>this.commitWidgetValue({fromUi:!0})))}}get initialValue(){const e=this.props.widgetMgr.getStringValue(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})}))}render(){var e;const{element:t,width:i,disabled:s,widgetMgr:o}=this.props,{value:n}=this.state;return this.formClearHelper.manageFormClearListener(o,t.formId,this.onFormCleared),(0,r.jsx)(l.Z,{label:t.label,labelVisibility:(0,a.iF)(null===(e=t.labelVisibility)||void 0===e?void 0:e.value),help:t.help,onChange:this.onColorClose,disabled:s,width:i,value:n})}}const u=n}}]);
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
(globalThis.webpackChunk_stlite_desktop=globalThis.webpackChunk_stlite_desktop||[]).push([[6913],{81397:(t,e,a)=>{"use strict";a.d(e,{Z:()=>u});var n=a(5057),r=a(66904),i=a.n(r),o=a(52277),s=a.n(o),c=a(96266);const p=({className:t,scriptRunId:e,numParticles:a,numParticleTypes:n,ParticleComponent:r})=>(0,c.jsx)("div",{className:s()(t,"stHidden"),children:i()(a).map((t=>{const a=Math.floor(Math.random()*n);return(0,c.jsx)(r,{particleType:a},e+t)}))}),u=(0,n.memo)(p)},49774:(t,e,a)=>{"use strict";a.r(e),a.d(e,{NUM_FLAKES:()=>f,default:()=>g});var n=a(5057);const r=a.p+"static/media/flake-0.beded754e8024c73d9d2.png",i=a.p+"static/media/flake-1.8077dc154e0bf900aa73.png",o=a.p+"static/media/flake-2.e3f07d06933dd0e84c24.png";var s=a(81397),c=a(45490),p=a(21371);const u=(t,e=0)=>Math.random()*(t-e)+e,l=(0,c.Z)("img",{target:"e1lf3uja0"})((({theme:t})=>({position:"fixed",top:"-150px",marginLeft:"-75px",zIndex:t.zIndices.balloons,left:`${u(90,10)}vw`,animationDelay:`${u(4e3)}ms`,height:"150px",width:"150px",pointerEvents:"none",animationDuration:"3000ms",animationName:p.F4`
|
|
2
|
+
from {
|
|
3
|
+
transform:
|
|
4
|
+
translateY(0)
|
|
5
|
+
rotateX(${u(360)}deg)
|
|
6
|
+
rotateY(${u(360)}deg)
|
|
7
|
+
rotateZ(${u(360)}deg);
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
to {
|
|
11
|
+
transform:
|
|
12
|
+
translateY(calc(100vh + ${150}px))
|
|
13
|
+
rotateX(0)
|
|
14
|
+
rotateY(0)
|
|
15
|
+
rotateZ(0);
|
|
16
|
+
}
|
|
17
|
+
`,animationTimingFunction:"ease-in",animationDirection:"normal",animationIterationCount:1,opacity:1})),"");var m=a(96266);const f=100,d=[r,i,o],v=d.length,x=({particleType:t})=>(0,m.jsx)(l,{src:d[t]}),h=function({scriptRunId:t}){return(0,m.jsx)(s.Z,{className:"snow",scriptRunId:t,numParticleTypes:v,numParticles:f,ParticleComponent:x})},g=(0,n.memo)(h)},99980:t=>{var e=Math.ceil,a=Math.max;t.exports=function(t,n,r,i){for(var o=-1,s=a(e((n-t)/(r||1)),0),c=Array(s);s--;)c[i?s:++o]=t,t+=r;return c}},39594:(t,e,a)=>{var n=a(36418),r=/^\s+/;t.exports=function(t){return t?t.slice(0,n(t)+1).replace(r,""):t}},9186:(t,e,a)=>{var n=a(99980),r=a(27396),i=a(17046);t.exports=function(t){return function(e,a,o){return o&&"number"!=typeof o&&r(e,a,o)&&(a=o=void 0),e=i(e),void 0===a?(a=e,e=0):a=i(a),o=void 0===o?e<a?1:-1:i(o),n(e,a,o,t)}}},36418:t=>{var e=/\s/;t.exports=function(t){for(var a=t.length;a--&&e.test(t.charAt(a)););return a}},66904:(t,e,a)=>{var n=a(9186)();t.exports=n},17046:(t,e,a)=>{var n=a(81692),r=1/0,i=17976931348623157e292;t.exports=function(t){return t?(t=n(t))===r||t===-r?(t<0?-1:1)*i:t===t?t:0:0===t?t:0}},81692:(t,e,a)=>{var n=a(39594),r=a(26271),i=a(71490),o=NaN,s=/^[-+]0x[0-9a-f]+$/i,c=/^0b[01]+$/i,p=/^0o[0-7]+$/i,u=parseInt;t.exports=function(t){if("number"==typeof t)return t;if(i(t))return o;if(r(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=r(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=n(t);var a=c.test(t);return a||p.test(t)?u(t.slice(2),a?2:8):s.test(t)?o:+t}}}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";(globalThis.webpackChunk_stlite_desktop=globalThis.webpackChunk_stlite_desktop||[]).push([[6939],{46939:(e,n,t)=>{t.r(n),t.d(n,{default:()=>m});var s=t(5057),o=t(31476),i=t(23878),r=t(21807),a=t(35450),l=t(45490),c=t(70765),d=t(69194);const g=(0,l.Z)(c.Q,{shouldForwardProp:d.Z,target:"ed18nn71"})((({theme:e,$usingCustomTheme:n})=>({marginTop:e.spacing.none,marginBottom:e.spacing.none,marginRight:e.spacing.none,marginLeft:e.spacing.none,borderColor:e.colors.fadedText10,borderTopColor:n?e.colors.primary:e.colors.blue70,flexGrow:0,flexShrink:0})),""),h=(0,l.Z)("div",{target:"ed18nn70"})((({theme:e})=>({display:"flex",gap:e.spacing.lg,alignItems:"center",width:"100%"})),"");var p=t(96266);const m=function({width:e,element:n}){const t=(0,o.u)(),{activeTheme:l}=s.useContext(a.E),c=!(0,i.MJ)(l),d={width:e};return(0,p.jsx)("div",{className:"stSpinner",style:d,children:(0,p.jsxs)(h,{children:[(0,p.jsx)(g,{$size:t.iconSizes.twoXL,$usingCustomTheme:c}),(0,p.jsx)(r.Z,{source:n.text,allowHTML:!1})]})})}}}]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(()=>{"use strict";var e={56977:e=>{function t(e){if("string"!==typeof e)throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}function r(e,t){for(var r,n="",o=0,s=-1,i=0,a=0;a<=e.length;++a){if(a<e.length)r=e.charCodeAt(a);else{if(47===r)break;r=47}if(47===r){if(s===a-1||1===i);else if(s!==a-1&&2===i){if(n.length<2||2!==o||46!==n.charCodeAt(n.length-1)||46!==n.charCodeAt(n.length-2))if(n.length>2){var l=n.lastIndexOf("/");if(l!==n.length-1){-1===l?(n="",o=0):o=(n=n.slice(0,l)).length-1-n.lastIndexOf("/"),s=a,i=0;continue}}else if(2===n.length||1===n.length){n="",o=0,s=a,i=0;continue}t&&(n.length>0?n+="/..":n="..",o=2)}else n.length>0?n+="/"+e.slice(s+1,a):n=e.slice(s+1,a),o=a-s-1;s=a,i=0}else 46===r&&-1!==i?++i:i=-1}return n}var n={resolve:function(){for(var e,n="",o=!1,s=arguments.length-1;s>=-1&&!o;s--){var i;s>=0?i=arguments[s]:(void 0===e&&(e=process.cwd()),i=e),t(i),0!==i.length&&(n=i+"/"+n,o=47===i.charCodeAt(0))}return n=r(n,!o),o?n.length>0?"/"+n:"/":n.length>0?n:"."},normalize:function(e){if(t(e),0===e.length)return".";var n=47===e.charCodeAt(0),o=47===e.charCodeAt(e.length-1);return 0!==(e=r(e,!n)).length||n||(e="."),e.length>0&&o&&(e+="/"),n?"/"+e:e},isAbsolute:function(e){return t(e),e.length>0&&47===e.charCodeAt(0)},join:function(){if(0===arguments.length)return".";for(var e,r=0;r<arguments.length;++r){var o=arguments[r];t(o),o.length>0&&(void 0===e?e=o:e+="/"+o)}return void 0===e?".":n.normalize(e)},relative:function(e,r){if(t(e),t(r),e===r)return"";if((e=n.resolve(e))===(r=n.resolve(r)))return"";for(var o=1;o<e.length&&47===e.charCodeAt(o);++o);for(var s=e.length,i=s-o,a=1;a<r.length&&47===r.charCodeAt(a);++a);for(var l=r.length-a,c=i<l?i:l,d=-1,u=0;u<=c;++u){if(u===c){if(l>c){if(47===r.charCodeAt(a+u))return r.slice(a+u+1);if(0===u)return r.slice(a+u)}else i>c&&(47===e.charCodeAt(o+u)?d=u:0===u&&(d=0));break}var g=e.charCodeAt(o+u);if(g!==r.charCodeAt(a+u))break;47===g&&(d=u)}var f="";for(u=o+d+1;u<=s;++u)u!==s&&47!==e.charCodeAt(u)||(0===f.length?f+="..":f+="/..");return f.length>0?f+r.slice(a+d):(a+=d,47===r.charCodeAt(a)&&++a,r.slice(a))},_makeLong:function(e){return e},dirname:function(e){if(t(e),0===e.length)return".";for(var r=e.charCodeAt(0),n=47===r,o=-1,s=!0,i=e.length-1;i>=1;--i)if(47===(r=e.charCodeAt(i))){if(!s){o=i;break}}else s=!1;return-1===o?n?"/":".":n&&1===o?"//":e.slice(0,o)},basename:function(e,r){if(void 0!==r&&"string"!==typeof r)throw new TypeError('"ext" argument must be a string');t(e);var n,o=0,s=-1,i=!0;if(void 0!==r&&r.length>0&&r.length<=e.length){if(r.length===e.length&&r===e)return"";var a=r.length-1,l=-1;for(n=e.length-1;n>=0;--n){var c=e.charCodeAt(n);if(47===c){if(!i){o=n+1;break}}else-1===l&&(i=!1,l=n+1),a>=0&&(c===r.charCodeAt(a)?-1===--a&&(s=n):(a=-1,s=l))}return o===s?s=l:-1===s&&(s=e.length),e.slice(o,s)}for(n=e.length-1;n>=0;--n)if(47===e.charCodeAt(n)){if(!i){o=n+1;break}}else-1===s&&(i=!1,s=n+1);return-1===s?"":e.slice(o,s)},extname:function(e){t(e);for(var r=-1,n=0,o=-1,s=!0,i=0,a=e.length-1;a>=0;--a){var l=e.charCodeAt(a);if(47!==l)-1===o&&(s=!1,o=a+1),46===l?-1===r?r=a:1!==i&&(i=1):-1!==r&&(i=-1);else if(!s){n=a+1;break}}return-1===r||-1===o||0===i||1===i&&r===o-1&&r===n+1?"":e.slice(r,o)},format:function(e){if(null===e||"object"!==typeof e)throw new TypeError('The "pathObject" argument must be of type Object. Received type '+typeof e);return function(e,t){var r=t.dir||t.root,n=t.base||(t.name||"")+(t.ext||"");return r?r===t.root?r+n:r+e+n:n}("/",e)},parse:function(e){t(e);var r={root:"",dir:"",base:"",ext:"",name:""};if(0===e.length)return r;var n,o=e.charCodeAt(0),s=47===o;s?(r.root="/",n=1):n=0;for(var i=-1,a=0,l=-1,c=!0,d=e.length-1,u=0;d>=n;--d)if(47!==(o=e.charCodeAt(d)))-1===l&&(c=!1,l=d+1),46===o?-1===i?i=d:1!==u&&(u=1):-1!==i&&(u=-1);else if(!c){a=d+1;break}return-1===i||-1===l||0===u||1===u&&i===l-1&&i===a+1?-1!==l&&(r.base=r.name=0===a&&s?e.slice(1,l):e.slice(a,l)):(0===a&&s?(r.name=e.slice(1,i),r.base=e.slice(1,l)):(r.name=e.slice(a,i),r.base=e.slice(a,l)),r.ext=e.slice(i,l)),a>0?r.dir=e.slice(0,a-1):s&&(r.dir="/"),r},sep:"/",delimiter:":",win32:null,posix:null};n.posix=n,e.exports=n}},t={};function r(n){var o=t[n];if(void 0!==o)return o.exports;var s=t[n]={exports:{}};return e[n](s,s.exports,r),s.exports}r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{var e;!function(e){function t(e){return null===e||"boolean"===typeof e||"number"===typeof e||"string"===typeof e}function r(e){return Array.isArray(e)}function n(e,o){if(e===o)return!0;if(t(e)||t(o))return!1;var s=r(e),i=r(o);return s===i&&(s&&i?function(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(var r=0,o=e.length;r<o;++r)if(!n(e[r],t[r]))return!1;return!0}(e,o):function(e,t){if(e===t)return!0;for(var r in e)if(void 0!==e[r]&&!(r in t))return!1;for(var r in t)if(void 0!==t[r]&&!(r in e))return!1;for(var r in e){var o=e[r],s=t[r];if(void 0!==o||void 0!==s){if(void 0===o||void 0===s)return!1;if(!n(o,s))return!1}}return!0}(e,o))}function o(e){return t(e)?e:r(e)?function(e){for(var t=new Array(e.length),r=0,n=e.length;r<n;++r)t[r]=o(e[r]);return t}(e):function(e){var t={};for(var r in e){var n=e[r];void 0!==n&&(t[r]=o(n))}return t}(e)}e.emptyObject=Object.freeze({}),e.emptyArray=Object.freeze([]),e.isPrimitive=t,e.isArray=r,e.isObject=function(e){return!t(e)&&!r(e)},e.deepEqual=n,e.deepCopy=o}(e||(e={}));!function(){function e(){this._types=[],this._values=[]}e.prototype.types=function(){return this._types.slice()},e.prototype.hasData=function(e){return-1!==this._types.indexOf(e)},e.prototype.getData=function(e){var t=this._types.indexOf(e);return-1!==t?this._values[t]:void 0},e.prototype.setData=function(e,t){this.clearData(e),this._types.push(e),this._values.push(t)},e.prototype.clearData=function(e){var t=this._types.indexOf(e);-1!==t&&(this._types.splice(t,1),this._values.splice(t,1))},e.prototype.clear=function(){this._types.length=0,this._values.length=0}}();var t,n,o=function(){function e(){var e=this;this.promise=new Promise((function(t,r){e._resolve=t,e._reject=r}))}return e.prototype.resolve=function(e){(0,this._resolve)(e)},e.prototype.reject=function(e){(0,this._reject)(e)},e}();function s(e){for(var t=0,r=0,n=e.length;r<n;++r)r%4===0&&(t=4294967295*Math.random()>>>0),e[r]=255&t,t>>>=8}!function(e){e.getRandomValues=function(){var e="undefined"!==typeof window&&(window.crypto||window.msCrypto)||null;return e&&"function"===typeof e.getRandomValues?function(t){return e.getRandomValues(t)}:s}()}(t||(t={})),function(e){e.uuid4=function(e){for(var t=new Uint8Array(16),r=new Array(256),n=0;n<16;++n)r[n]="0"+n.toString(16);for(n=16;n<256;++n)r[n]=n.toString(16);return function(){return e(t),t[6]=64|15&t[6],t[8]=128|63&t[8],r[t[0]]+r[t[1]]+r[t[2]]+r[t[3]]+"-"+r[t[4]]+r[t[5]]+"-"+r[t[6]]+r[t[7]]+"-"+r[t[8]]+r[t[9]]+"-"+r[t[10]]+r[t[11]]+r[t[12]]+r[t[13]]+r[t[14]]+r[t[15]]}}(t.getRandomValues)}(n||(n={}));var i=r(56977),a=r.n(i);function l(e,t){const r=a().normalize(t),n=a().dirname(r).split("/"),o=[];for(const i of n){o.push(i);const t=o.join("/");if(e.FS.analyzePath(t).exists){if(e.FS.isDir(t))throw new Error(`"${t}" already exists and is not a directory.`)}else try{e.FS.mkdir(t)}catch(s){throw console.error(`Failed to create a directory "${t}"`),s}}}function c(e,t,r,n){l(e,t),e.FS.writeFile(t,r,n)}function d(e){e.forEach((e=>{let t;try{t=new URL(e)}catch(r){return}if("emfs:"===t.protocol||"file:"===t.protocol)throw new Error(`"emfs:" and "file:" protocols are not allowed for the requirement (${e})`)}))}function u(e){e.runPython('\nimport micropip\nmicropip.add_mock_package(\n "pyarrow", "0.0.1",\n modules={\n "pyarrow": """\n__version__ = \'0.0.1\' # TODO: Update when releasing\n\n\nclass Table:\n @classmethod\n def from_pandas(*args, **kwargs):\n raise NotImplementedError("stlite is not supporting this method.")\n"""\n }\n)\n')}var g=function(e,t,r,n){return new(r||(r=Promise))((function(o,s){function i(e){try{l(n.next(e))}catch(t){s(t)}}function a(e){try{l(n.throw(e))}catch(t){s(t)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(i,a)}l((n=n.apply(e,t||[])).next())}))};let f,p;const h=self,m=new o;function y(e){h.postMessage({type:"event:progress",data:{message:e}})}const v=function(){return g(this,void 0,void 0,(function*(){const{entrypoint:e,files:t,archives:r,requirements:n,wheels:o,mountedSitePackagesSnapshotFilePath:s,pyodideEntrypointUrl:i}=yield m.promise;if(y("Loading Pyodide."),console.debug("Import the entrypoint script."),importScripts(null!==i&&void 0!==i?i:"https://cdn.jsdelivr.net/pyodide/v0.22.1/full/pyodide.js"),console.debug("Loading Pyodide"),f=yield loadPyodide({stdout:console.log,stderr:console.error}),console.debug("Loaded Pyodide"),y("Mounting files."),yield Promise.all(Object.keys(t).map((e=>g(this,void 0,void 0,(function*(){const r=t[e];let n;"url"in r?(console.debug(`Fetch a file from ${r.url}`),n=yield fetch(r.url).then((e=>e.arrayBuffer())).then((e=>new Uint8Array(e)))):n=r.data;const{opts:o}=t[e];console.debug(`Write a file "${e}"`),c(f,e,n,o)}))))),y("Unpacking archives."),yield Promise.all(r.map((e=>g(this,void 0,void 0,(function*(){let t;"url"in e?(console.debug(`Fetch an archive from ${e.url}`),t=yield fetch(e.url).then((e=>e.arrayBuffer()))):t=e.buffer;const{format:r,options:n}=e;console.debug("Unpack an archive",{format:r,options:n}),f.unpackArchive(t,r,n)}))))),s)y("Restoring the snapshot."),yield f.runPythonAsync("import tarfile, shutil, site"),yield f.runPythonAsync("\n site_packages_dirs = site.getsitepackages()\n for site_packages in site_packages_dirs:\n shutil.rmtree(site_packages)\n "),console.debug(`Unarchive ${s}`),yield f.runPythonAsync(`\n with tarfile.open("${s}", "r") as tar_gz_file:\n tar_gz_file.extractall("/")\n `),console.debug("Restored the snapshot"),y("Mocking some packages."),console.debug("Mock pyarrow"),u(f),console.debug("Mocked pyarrow");else{if(!o)throw new Error("Neither snapshot nor wheel files are provided.");{y("Installing streamlit and its dependencies."),console.debug("Loading stlite-server, and streamlit"),yield f.loadPackage("micropip");const e=f.pyimport("micropip");yield e.install.callKwargs([o.stliteServer],{keep_going:!0}),yield e.install.callKwargs([o.streamlit],{keep_going:!0}),console.debug("Loaded stlite-server, and streamlit"),y("Mocking some packages."),console.debug("Mock pyarrow"),u(f),console.debug("Mocked pyarrow"),y("Installing the requirements."),console.debug("Installing the requirements:",n),d(n),yield e.install.callKwargs(n,{keep_going:!0}),console.debug("Installed the requirements:",n)}}yield f.runPythonAsync("\n import importlib\n importlib.invalidate_caches()\n "),y("Loading streamlit package."),console.debug("Loading the Streamlit package"),yield f.runPythonAsync("\n import streamlit.runtime\n import streamlit.web\n "),console.debug("Loaded the Streamlit package"),y("Setting up the loggers."),console.debug("Setting the loggers"),yield f.runPythonAsync("\n import logging\n import streamlit.logger\n\n streamlit.logger.get_logger = logging.getLogger\n streamlit.logger.setup_formatter = None\n streamlit.logger.update_formatter = lambda *a, **k: None\n streamlit.logger.set_log_level = lambda *a, **k: None\n ");self.__logCallback__=e=>{e.startsWith("CRITICAL")||e.startsWith("ERROR")?console.error(e):e.startsWith("WARNING")?console.warn(e):e.startsWith("INFO")?console.info(e):e.startsWith("DEBUG")?console.debug(e):console.log(e)},yield f.runPythonAsync('\n from js import __logCallback__\n\n\n class JsHandler(logging.Handler):\n def emit(self, record):\n msg = self.format(record)\n __logCallback__(msg)\n\n\n main_formatter = logging.Formatter("%(levelname)s:%(name)s:%(message)s")\n\n js_handler = JsHandler()\n js_handler.setFormatter(main_formatter)\n\n root_logger = logging.getLogger()\n root_logger.handlers.clear()\n root_logger.addHandler(js_handler)\n root_logger.setLevel(logging.DEBUG)\n\n streamlit_handler = logging.getLogger("streamlit")\n streamlit_handler.setLevel(logging.DEBUG)\n '),console.debug("Set the loggers"),y("Mocking some Streamlit functions for the browser environment."),console.debug("Mocking some Streamlit functions"),yield f.runPythonAsync("\n import streamlit\n\n def is_cacheable_msg(msg):\n return False\n\n streamlit.runtime.runtime.is_cacheable_msg = is_cacheable_msg\n "),console.debug("Mocked some Streamlit functions"),y("Booting up the Streamlit server."),console.debug("Booting up the Streamlit server"),yield f.runPythonAsync(`\n from stlite_server.bootstrap import load_config_options, prepare\n from stlite_server.server import Server\n\n load_config_options({\n "global.dataFrameSerialization": "legacy", # Not to use PyArrow\n "browser.gatherUsageStats": False,\n "runner.fastReruns": False, # Fast reruns do not work well with the async script runner of stlite. See https://github.com/whitphx/stlite/pull/550#issuecomment-1505485865.\n })\n\n main_script_path = "${e}"\n command_line = None\n args = []\n\n prepare(main_script_path, args)\n\n server = Server(main_script_path, command_line)\n server.start()\n `),console.debug("Booted up the Streamlit server"),console.debug("Setting up the HTTP server"),p=f.globals.get("server").copy(),console.debug("Set up the HTTP server"),h.postMessage({type:"event:loaded"})}))}().catch((e=>{throw h.postMessage({type:"event:error",data:{error:e}}),e}));self.onmessage=e=>g(void 0,void 0,void 0,(function*(){const t=e.data;if("initData"===t.type)return void m.resolve(t.data);yield v;const r=e.ports[0];try{switch(t.type){case"websocket:connect":{console.debug("websocket:connect",t.data);const{path:e}=t.data;p.start_websocket(e,((e,t)=>{if(t){const t=e.getBuffer("u8");e.destroy();const r=new Uint8ClampedArray(t.data.buffer,t.data.byteOffset,t.data.byteLength);h.postMessage({type:"websocket:message",data:{payload:new Uint8Array(r)}})}else h.postMessage({type:"websocket:message",data:{payload:e}})})),r.postMessage({type:"reply"});break}case"websocket:send":{console.debug("websocket:send",t.data);const{payload:e}=t.data;p.receive_websocket_from_js(e);break}case"http:request":{console.debug("http:request",t.data);const{request:e}=t.data,n=(e,t,n)=>{const o=t.toJs(),s=n.toJs();console.debug({statusCode:e,headers:o,body:s});const i={type:"http:response",data:{response:{statusCode:e,headers:o,body:s}}};r.postMessage(i)};p.receive_http_from_js(e.method,e.path,e.headers,e.body,n);break}case"file:write":{const{path:e,data:n,opts:o}=t.data;console.debug(`Write a file "${e}"`),c(f,e,n,o),r.postMessage({type:"reply"});break}case"file:rename":{const{oldPath:e,newPath:n}=t.data;console.debug(`Rename "${e}" to ${n}`),function(e,t,r){l(e,r),e.FS.rename(t,r)}(f,e,n),r.postMessage({type:"reply"});break}case"file:unlink":{const{path:e}=t.data;console.debug(`Remove "${e}`),f.FS.unlink(e),r.postMessage({type:"reply"});break}case"install":{const{requirements:e}=t.data,n=f.pyimport("micropip");console.debug("Install the requirements:",e),d(e),yield n.install.callKwargs(e,{keep_going:!0}).then((()=>{if(e.includes("matplotlib"))return f.runPythonAsync("\n from stlite_server.bootstrap import _fix_matplotlib_crash\n _fix_matplotlib_crash()\n ")})).then((()=>{console.debug("Successfully installed"),r.postMessage({type:"reply"})}))}}}catch(n){r.postMessage({type:"reply",error:n})}})),h.postMessage({type:"event:start"})})()})();
|
|
1
|
+
(()=>{"use strict";var e={56977:e=>{function t(e){if("string"!==typeof e)throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}function r(e,t){for(var r,n="",o=0,s=-1,i=0,a=0;a<=e.length;++a){if(a<e.length)r=e.charCodeAt(a);else{if(47===r)break;r=47}if(47===r){if(s===a-1||1===i);else if(s!==a-1&&2===i){if(n.length<2||2!==o||46!==n.charCodeAt(n.length-1)||46!==n.charCodeAt(n.length-2))if(n.length>2){var l=n.lastIndexOf("/");if(l!==n.length-1){-1===l?(n="",o=0):o=(n=n.slice(0,l)).length-1-n.lastIndexOf("/"),s=a,i=0;continue}}else if(2===n.length||1===n.length){n="",o=0,s=a,i=0;continue}t&&(n.length>0?n+="/..":n="..",o=2)}else n.length>0?n+="/"+e.slice(s+1,a):n=e.slice(s+1,a),o=a-s-1;s=a,i=0}else 46===r&&-1!==i?++i:i=-1}return n}var n={resolve:function(){for(var e,n="",o=!1,s=arguments.length-1;s>=-1&&!o;s--){var i;s>=0?i=arguments[s]:(void 0===e&&(e=process.cwd()),i=e),t(i),0!==i.length&&(n=i+"/"+n,o=47===i.charCodeAt(0))}return n=r(n,!o),o?n.length>0?"/"+n:"/":n.length>0?n:"."},normalize:function(e){if(t(e),0===e.length)return".";var n=47===e.charCodeAt(0),o=47===e.charCodeAt(e.length-1);return 0!==(e=r(e,!n)).length||n||(e="."),e.length>0&&o&&(e+="/"),n?"/"+e:e},isAbsolute:function(e){return t(e),e.length>0&&47===e.charCodeAt(0)},join:function(){if(0===arguments.length)return".";for(var e,r=0;r<arguments.length;++r){var o=arguments[r];t(o),o.length>0&&(void 0===e?e=o:e+="/"+o)}return void 0===e?".":n.normalize(e)},relative:function(e,r){if(t(e),t(r),e===r)return"";if((e=n.resolve(e))===(r=n.resolve(r)))return"";for(var o=1;o<e.length&&47===e.charCodeAt(o);++o);for(var s=e.length,i=s-o,a=1;a<r.length&&47===r.charCodeAt(a);++a);for(var l=r.length-a,c=i<l?i:l,d=-1,u=0;u<=c;++u){if(u===c){if(l>c){if(47===r.charCodeAt(a+u))return r.slice(a+u+1);if(0===u)return r.slice(a+u)}else i>c&&(47===e.charCodeAt(o+u)?d=u:0===u&&(d=0));break}var g=e.charCodeAt(o+u);if(g!==r.charCodeAt(a+u))break;47===g&&(d=u)}var p="";for(u=o+d+1;u<=s;++u)u!==s&&47!==e.charCodeAt(u)||(0===p.length?p+="..":p+="/..");return p.length>0?p+r.slice(a+d):(a+=d,47===r.charCodeAt(a)&&++a,r.slice(a))},_makeLong:function(e){return e},dirname:function(e){if(t(e),0===e.length)return".";for(var r=e.charCodeAt(0),n=47===r,o=-1,s=!0,i=e.length-1;i>=1;--i)if(47===(r=e.charCodeAt(i))){if(!s){o=i;break}}else s=!1;return-1===o?n?"/":".":n&&1===o?"//":e.slice(0,o)},basename:function(e,r){if(void 0!==r&&"string"!==typeof r)throw new TypeError('"ext" argument must be a string');t(e);var n,o=0,s=-1,i=!0;if(void 0!==r&&r.length>0&&r.length<=e.length){if(r.length===e.length&&r===e)return"";var a=r.length-1,l=-1;for(n=e.length-1;n>=0;--n){var c=e.charCodeAt(n);if(47===c){if(!i){o=n+1;break}}else-1===l&&(i=!1,l=n+1),a>=0&&(c===r.charCodeAt(a)?-1===--a&&(s=n):(a=-1,s=l))}return o===s?s=l:-1===s&&(s=e.length),e.slice(o,s)}for(n=e.length-1;n>=0;--n)if(47===e.charCodeAt(n)){if(!i){o=n+1;break}}else-1===s&&(i=!1,s=n+1);return-1===s?"":e.slice(o,s)},extname:function(e){t(e);for(var r=-1,n=0,o=-1,s=!0,i=0,a=e.length-1;a>=0;--a){var l=e.charCodeAt(a);if(47!==l)-1===o&&(s=!1,o=a+1),46===l?-1===r?r=a:1!==i&&(i=1):-1!==r&&(i=-1);else if(!s){n=a+1;break}}return-1===r||-1===o||0===i||1===i&&r===o-1&&r===n+1?"":e.slice(r,o)},format:function(e){if(null===e||"object"!==typeof e)throw new TypeError('The "pathObject" argument must be of type Object. Received type '+typeof e);return function(e,t){var r=t.dir||t.root,n=t.base||(t.name||"")+(t.ext||"");return r?r===t.root?r+n:r+e+n:n}("/",e)},parse:function(e){t(e);var r={root:"",dir:"",base:"",ext:"",name:""};if(0===e.length)return r;var n,o=e.charCodeAt(0),s=47===o;s?(r.root="/",n=1):n=0;for(var i=-1,a=0,l=-1,c=!0,d=e.length-1,u=0;d>=n;--d)if(47!==(o=e.charCodeAt(d)))-1===l&&(c=!1,l=d+1),46===o?-1===i?i=d:1!==u&&(u=1):-1!==i&&(u=-1);else if(!c){a=d+1;break}return-1===i||-1===l||0===u||1===u&&i===l-1&&i===a+1?-1!==l&&(r.base=r.name=0===a&&s?e.slice(1,l):e.slice(a,l)):(0===a&&s?(r.name=e.slice(1,i),r.base=e.slice(1,l)):(r.name=e.slice(a,i),r.base=e.slice(a,l)),r.ext=e.slice(i,l)),a>0?r.dir=e.slice(0,a-1):s&&(r.dir="/"),r},sep:"/",delimiter:":",win32:null,posix:null};n.posix=n,e.exports=n}},t={};function r(n){var o=t[n];if(void 0!==o)return o.exports;var s=t[n]={exports:{}};return e[n](s,s.exports,r),s.exports}r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{var e;!function(e){function t(e){return null===e||"boolean"===typeof e||"number"===typeof e||"string"===typeof e}function r(e){return Array.isArray(e)}function n(e,o){if(e===o)return!0;if(t(e)||t(o))return!1;var s=r(e),i=r(o);return s===i&&(s&&i?function(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(var r=0,o=e.length;r<o;++r)if(!n(e[r],t[r]))return!1;return!0}(e,o):function(e,t){if(e===t)return!0;for(var r in e)if(void 0!==e[r]&&!(r in t))return!1;for(var r in t)if(void 0!==t[r]&&!(r in e))return!1;for(var r in e){var o=e[r],s=t[r];if(void 0!==o||void 0!==s){if(void 0===o||void 0===s)return!1;if(!n(o,s))return!1}}return!0}(e,o))}function o(e){return t(e)?e:r(e)?function(e){for(var t=new Array(e.length),r=0,n=e.length;r<n;++r)t[r]=o(e[r]);return t}(e):function(e){var t={};for(var r in e){var n=e[r];void 0!==n&&(t[r]=o(n))}return t}(e)}e.emptyObject=Object.freeze({}),e.emptyArray=Object.freeze([]),e.isPrimitive=t,e.isArray=r,e.isObject=function(e){return!t(e)&&!r(e)},e.deepEqual=n,e.deepCopy=o}(e||(e={}));!function(){function e(){this._types=[],this._values=[]}e.prototype.types=function(){return this._types.slice()},e.prototype.hasData=function(e){return-1!==this._types.indexOf(e)},e.prototype.getData=function(e){var t=this._types.indexOf(e);return-1!==t?this._values[t]:void 0},e.prototype.setData=function(e,t){this.clearData(e),this._types.push(e),this._values.push(t)},e.prototype.clearData=function(e){var t=this._types.indexOf(e);-1!==t&&(this._types.splice(t,1),this._values.splice(t,1))},e.prototype.clear=function(){this._types.length=0,this._values.length=0}}();var t,n,o=function(){function e(){var e=this;this.promise=new Promise((function(t,r){e._resolve=t,e._reject=r}))}return e.prototype.resolve=function(e){(0,this._resolve)(e)},e.prototype.reject=function(e){(0,this._reject)(e)},e}();function s(e){for(var t=0,r=0,n=e.length;r<n;++r)r%4===0&&(t=4294967295*Math.random()>>>0),e[r]=255&t,t>>>=8}!function(e){e.getRandomValues=function(){var e="undefined"!==typeof window&&(window.crypto||window.msCrypto)||null;return e&&"function"===typeof e.getRandomValues?function(t){return e.getRandomValues(t)}:s}()}(t||(t={})),function(e){e.uuid4=function(e){for(var t=new Uint8Array(16),r=new Array(256),n=0;n<16;++n)r[n]="0"+n.toString(16);for(n=16;n<256;++n)r[n]=n.toString(16);return function(){return e(t),t[6]=64|15&t[6],t[8]=128|63&t[8],r[t[0]]+r[t[1]]+r[t[2]]+r[t[3]]+"-"+r[t[4]]+r[t[5]]+"-"+r[t[6]]+r[t[7]]+"-"+r[t[8]]+r[t[9]]+"-"+r[t[10]]+r[t[11]]+r[t[12]]+r[t[13]]+r[t[14]]+r[t[15]]}}(t.getRandomValues)}(n||(n={}));var i=r(56977),a=r.n(i);function l(e,t){const r=a().normalize(t),n=a().dirname(r).split("/"),o=[];for(const i of n){o.push(i);const t=o.join("/");if(e.FS.analyzePath(t).exists){if(e.FS.isDir(t))throw new Error(`"${t}" already exists and is not a directory.`)}else try{e.FS.mkdir(t)}catch(s){throw console.error(`Failed to create a directory "${t}"`),s}}}function c(e,t,r,n){l(e,t),e.FS.writeFile(t,r,n)}function d(e){e.forEach((e=>{let t;try{t=new URL(e)}catch(r){return}if("emfs:"===t.protocol||"file:"===t.protocol)throw new Error(`"emfs:" and "file:" protocols are not allowed for the requirement (${e})`)}))}function u(e){e.runPython('\nimport micropip\nmicropip.add_mock_package(\n "pyarrow", "0.0.1",\n modules={\n "pyarrow": """\n__version__ = \'0.0.1\' # TODO: Update when releasing\n\n\nclass Table:\n @classmethod\n def from_pandas(*args, **kwargs):\n raise NotImplementedError("stlite is not supporting this method.")\n"""\n }\n)\n')}var g=function(e,t,r,n){return new(r||(r=Promise))((function(o,s){function i(e){try{l(n.next(e))}catch(t){s(t)}}function a(e){try{l(n.throw(e))}catch(t){s(t)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(i,a)}l((n=n.apply(e,t||[])).next())}))};let p,f;const h=self,m=new o;function y(e){h.postMessage({type:"event:progress",data:{message:e}})}const v=function(){return g(this,void 0,void 0,(function*(){const{entrypoint:e,files:t,archives:r,requirements:n,wheels:o,mountedSitePackagesSnapshotFilePath:s,pyodideEntrypointUrl:i}=yield m.promise;if(y("Loading Pyodide."),console.debug("Import the entrypoint script."),importScripts(null!==i&&void 0!==i?i:"https://cdn.jsdelivr.net/pyodide/v0.22.1/full/pyodide.js"),console.debug("Loading Pyodide"),p=yield loadPyodide({stdout:console.log,stderr:console.error}),console.debug("Loaded Pyodide"),y("Mounting files."),yield Promise.all(Object.keys(t).map((e=>g(this,void 0,void 0,(function*(){const r=t[e];let n;"url"in r?(console.debug(`Fetch a file from ${r.url}`),n=yield fetch(r.url).then((e=>e.arrayBuffer())).then((e=>new Uint8Array(e)))):n=r.data;const{opts:o}=t[e];console.debug(`Write a file "${e}"`),c(p,e,n,o)}))))),y("Unpacking archives."),yield Promise.all(r.map((e=>g(this,void 0,void 0,(function*(){let t;"url"in e?(console.debug(`Fetch an archive from ${e.url}`),t=yield fetch(e.url).then((e=>e.arrayBuffer()))):t=e.buffer;const{format:r,options:n}=e;console.debug("Unpack an archive",{format:r,options:n}),p.unpackArchive(t,r,n)}))))),s)y("Restoring the snapshot."),yield p.runPythonAsync("import tarfile, shutil, site"),yield p.runPythonAsync("\n site_packages_dirs = site.getsitepackages()\n for site_packages in site_packages_dirs:\n shutil.rmtree(site_packages)\n "),console.debug(`Unarchive ${s}`),yield p.runPythonAsync(`\n with tarfile.open("${s}", "r") as tar_gz_file:\n tar_gz_file.extractall("/")\n `),console.debug("Restored the snapshot"),y("Mocking some packages."),console.debug("Mock pyarrow"),u(p),console.debug("Mocked pyarrow");else{if(!o)throw new Error("Neither snapshot nor wheel files are provided.");{y("Installing streamlit and its dependencies."),console.debug("Loading stlite-server, and streamlit"),yield p.loadPackage("micropip");const e=p.pyimport("micropip");yield e.install.callKwargs([o.stliteServer],{keep_going:!0}),yield e.install.callKwargs([o.streamlit],{keep_going:!0}),console.debug("Loaded stlite-server, and streamlit"),y("Mocking some packages."),console.debug("Mock pyarrow"),u(p),console.debug("Mocked pyarrow")}}if(n.length>0){y("Installing the requirements."),console.debug("Installing the requirements:",n),d(n),yield p.loadPackage("micropip");const e=p.pyimport("micropip");yield e.install.callKwargs(n,{keep_going:!0}),console.debug("Installed the requirements:",n)}yield p.runPythonAsync("\n import importlib\n importlib.invalidate_caches()\n "),y("Loading streamlit package."),console.debug("Loading the Streamlit package"),yield p.runPythonAsync("\n import streamlit.runtime\n import streamlit.web\n "),console.debug("Loaded the Streamlit package"),y("Setting up the loggers."),console.debug("Setting the loggers"),yield p.runPythonAsync("\n import logging\n import streamlit.logger\n\n streamlit.logger.get_logger = logging.getLogger\n streamlit.logger.setup_formatter = None\n streamlit.logger.update_formatter = lambda *a, **k: None\n streamlit.logger.set_log_level = lambda *a, **k: None\n ");self.__logCallback__=e=>{e.startsWith("CRITICAL")||e.startsWith("ERROR")?console.error(e):e.startsWith("WARNING")?console.warn(e):e.startsWith("INFO")?console.info(e):e.startsWith("DEBUG")?console.debug(e):console.log(e)},yield p.runPythonAsync('\n from js import __logCallback__\n\n\n class JsHandler(logging.Handler):\n def emit(self, record):\n msg = self.format(record)\n __logCallback__(msg)\n\n\n main_formatter = logging.Formatter("%(levelname)s:%(name)s:%(message)s")\n\n js_handler = JsHandler()\n js_handler.setFormatter(main_formatter)\n\n root_logger = logging.getLogger()\n root_logger.handlers.clear()\n root_logger.addHandler(js_handler)\n root_logger.setLevel(logging.DEBUG)\n\n streamlit_handler = logging.getLogger("streamlit")\n streamlit_handler.setLevel(logging.DEBUG)\n '),console.debug("Set the loggers"),y("Mocking some Streamlit functions for the browser environment."),console.debug("Mocking some Streamlit functions"),yield p.runPythonAsync("\n import streamlit\n\n def is_cacheable_msg(msg):\n return False\n\n streamlit.runtime.runtime.is_cacheable_msg = is_cacheable_msg\n "),console.debug("Mocked some Streamlit functions"),y("Booting up the Streamlit server."),console.debug("Booting up the Streamlit server"),yield p.runPythonAsync(`\n from stlite_server.bootstrap import load_config_options, prepare\n from stlite_server.server import Server\n\n load_config_options({\n "global.dataFrameSerialization": "legacy", # Not to use PyArrow\n "browser.gatherUsageStats": False,\n "runner.fastReruns": False, # Fast reruns do not work well with the async script runner of stlite. See https://github.com/whitphx/stlite/pull/550#issuecomment-1505485865.\n })\n\n main_script_path = "${e}"\n command_line = None\n args = []\n\n prepare(main_script_path, args)\n\n server = Server(main_script_path, command_line)\n server.start()\n `),console.debug("Booted up the Streamlit server"),console.debug("Setting up the HTTP server"),f=p.globals.get("server").copy(),console.debug("Set up the HTTP server"),h.postMessage({type:"event:loaded"})}))}().catch((e=>{throw h.postMessage({type:"event:error",data:{error:e}}),e}));self.onmessage=e=>g(void 0,void 0,void 0,(function*(){const t=e.data;if("initData"===t.type)return void m.resolve(t.data);yield v;const r=e.ports[0];try{switch(t.type){case"websocket:connect":{console.debug("websocket:connect",t.data);const{path:e}=t.data;f.start_websocket(e,((e,t)=>{if(t){const t=e.getBuffer("u8");e.destroy();const r=new Uint8ClampedArray(t.data.buffer,t.data.byteOffset,t.data.byteLength);h.postMessage({type:"websocket:message",data:{payload:new Uint8Array(r)}})}else h.postMessage({type:"websocket:message",data:{payload:e}})})),r.postMessage({type:"reply"});break}case"websocket:send":{console.debug("websocket:send",t.data);const{payload:e}=t.data;f.receive_websocket_from_js(e);break}case"http:request":{console.debug("http:request",t.data);const{request:e}=t.data,n=(e,t,n)=>{const o=t.toJs(),s=n.toJs();console.debug({statusCode:e,headers:o,body:s});const i={type:"http:response",data:{response:{statusCode:e,headers:o,body:s}}};r.postMessage(i)};f.receive_http_from_js(e.method,e.path,e.headers,e.body,n);break}case"file:write":{const{path:e,data:n,opts:o}=t.data;console.debug(`Write a file "${e}"`),c(p,e,n,o),r.postMessage({type:"reply"});break}case"file:rename":{const{oldPath:e,newPath:n}=t.data;console.debug(`Rename "${e}" to ${n}`),function(e,t,r){l(e,r),e.FS.rename(t,r)}(p,e,n),r.postMessage({type:"reply"});break}case"file:unlink":{const{path:e}=t.data;console.debug(`Remove "${e}`),p.FS.unlink(e),r.postMessage({type:"reply"});break}case"install":{const{requirements:e}=t.data,n=p.pyimport("micropip");console.debug("Install the requirements:",e),d(e),yield n.install.callKwargs(e,{keep_going:!0}).then((()=>{if(e.includes("matplotlib"))return p.runPythonAsync("\n from stlite_server.bootstrap import _fix_matplotlib_crash\n _fix_matplotlib_crash()\n ")})).then((()=>{console.debug("Successfully installed"),r.postMessage({type:"reply"})}))}}}catch(n){r.postMessage({type:"reply",error:n})}})),h.postMessage({type:"event:start"})})()})();
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";(globalThis.webpackChunk_stlite_desktop=globalThis.webpackChunk_stlite_desktop||[]).push([[787],{50787:(t,e,i)=>{i.r(e),i.d(e,{default:()=>r});i(5057);var l=i(46401),s=i(21807),d=i(98093),n=i(96266);const r=function(t){const{disabled:e,element:i,widgetMgr:r,width:a,endpoints:u}=t,o={width:a},c=(0,d.v_)();return(0,n.jsx)("div",{className:"row-widget stDownloadButton",style:o,children:(0,n.jsx)(l.t2,{help:i.help,children:(0,n.jsx)(l.ZP,{kind:l.nW.SECONDARY,size:l.V5.SMALL,disabled:e,onClick:()=>{if(r.setTriggerValue(i,{fromUi:!0}),i.url.startsWith("/media"))return void(0,d.uP)(c,i.url);const t=document.createElement("a"),e=u.buildMediaURL(i.url);t.setAttribute("href",e),t.setAttribute("target","_blank"),t.click()},fluidWidth:i.useContainerWidth||!1,children:(0,n.jsx)(s.Z,{source:i.label,allowHTML:!1,isLabel:!0,isButton:!0})})})})}}}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";(globalThis.webpackChunk_stlite_desktop=globalThis.webpackChunk_stlite_desktop||[]).push([[792],{50792:(t,e,s)=>{s.r(e),s.d(e,{default:()=>l});var i=s(5057),u=s(98093),r=s(96266);function l({element:t,width:e,endpoints:s}){const l=(0,i.useRef)(null);(0,i.useEffect)((()=>{l.current&&(l.current.currentTime=t.startTime)}),[t.startTime]);const n=(0,u.O0)(t.url),a=s.buildMediaURL(n);return(0,r.jsx)("audio",{id:"audio",ref:l,controls:!0,src:a,className:"stAudio",style:{width:e}})}}}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";(globalThis.webpackChunk_stlite_desktop=globalThis.webpackChunk_stlite_desktop||[]).push([[8035],{58035:(t,e,o)=>{o.r(e),o.d(e,{default:()=>F});var i=o(5057),n=o(31476),a=o(55177),s=o(42915),r=o(79220),l=o(95870),d=o(82601),c=o(11787),h=o(18079),g=o(65873),u=o(23878);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},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:e.spacing.mdPx,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 p=(0,o(45490).Z)("div",{target:"e1tqyfl40"})((({theme:t})=>({"&.vega-embed":{"&:hover summary, .vega-embed:focus summary":{background:"transparent"},"&.has-actions":{paddingRight:0},".vega-actions":{zIndex:t.zIndices.popupMenu,backgroundColor:t.colors.bgColor,boxShadow:"rgb(0 0 0 / 16%) 0px 4px 16px",border:`1px solid ${t.colors.fadedText10}`,a:{fontFamily:t.genericFonts.bodyFont,fontWeight:t.fontWeights.normal,fontSize:t.fontSizes.md,margin:0,padding:`${t.spacing.twoXS} ${t.spacing.twoXL}`,color:t.colors.bodyText},"a:hover":{backgroundColor:t.colors.secondaryBg,color:t.colors.bodyText},":before":{content:"none"},":after":{content:"none"}},summary:{opacity:0,height:"auto",zIndex:t.zIndices.menuButton,border:"none",boxShadow:"none",borderRadius:t.radii.lg,color:t.colors.fadedText10,backgroundColor:"transparent",transition:"opacity 300ms 150ms,transform 300ms 150ms","&:active, &:focus-visible, &:hover":{border:"none",boxShadow:"none",color:t.colors.bodyText,opacity:"1 !important",background:t.colors.darkenedBgMix25}}}})),"");var f=o(96266);const b={DATAFRAME_INDEX:"(index)"},w="source",y=new Set([h.GI.DatetimeIndex,h.GI.Float64Index,h.GI.Int64Index,h.GI.RangeIndex,h.GI.UInt64Index]);class v extends i.PureComponent{constructor(...t){super(...t),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=()=>{var t,e;const{element:o,theme:i}=this.props,n=JSON.parse(o.spec),{useContainerWidth:a}=o;if("streamlit"===o.vegaLiteTheme?n.config=m(n.config,i):"streamlit"===(null===(t=n.usermeta)||void 0===t||null===(e=t.embedOptions)||void 0===e?void 0:e.theme)?(n.config=m(n.config,i),n.usermeta.embedOptions.theme=void 0):n.config=function(t,e){const{colors:o,fontSizes:i,genericFonts:n}=e,a={labelFont:n.bodyFont,titleFont:n.bodyFont,labelFontSize:i.twoSmPx,titleFontSize:i.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},view:{continuousHeight:350,continuousWidth:400},mark:{tooltip:!0}};return t?(0,g.merge)({},s,t):s}(n.config,i),this.props.height?(n.width=this.props.width,n.height=this.props.height):a&&(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:i,theme:n}=this.props,a=e.spec,{spec:s}=i;if(!this.vegaView||a!==s||o!==n||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}=i;(r||d)&&this.updateData(this.defaultDataName,r,d);const h=x(e)||{},g=x(i)||{};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:i,dataColumns:n}=e.dimensions,{dataRows:a,dataColumns:r}=o.dimensions;if(function(t,e,o,i,n,a){if(o!==a)return!1;if(e>=n)return!1;if(0===e)return!1;const s=a-1,r=e-1;if(t.getDataValue(0,s)!==i.getDataValue(0,s)||t.getDataValue(r,s)!==i.getDataValue(r,s))return!1;return!0}(e,i,n,o,a,r))i<a&&this.vegaView.insert(t,S(o,i));else{const e=s.changeset().remove(s.truthy).insert(S(o));this.vegaView.change(t,e),(0,l.ji)(`Had to clear the ${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={defaultStyle:!0,ast:!0,expr:r.N},{vgSpec:i,view:n,finalize:s}=await(0,a.ZP)(this.element,e,o);this.vegaView=n,this.vegaFinalizer=s;const d=function(t){const e=x(t);if(null==e)return null;const o={};for(const[i,n]of Object.entries(e))o[i]=S(n);return o}(t),c=d?Object.keys(d):[];if(1===c.length){const[t]=c;this.defaultDataName=t}else 0===c.length&&i.data&&(this.defaultDataName=w);const h=function(t){const e=t.data;if(!e||0===e.data.numRows)return null;return S(e)}(t);if(h&&n.insert(this.defaultDataName,h),d)for(const[a,r]of Object.entries(d))n.insert(a,r);await n.runAsync(),this.vegaView.resize().runAsync()}render(){if(this.state.error)throw this.state.error;return(0,f.jsx)(p,{"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,e=0){if(t.isEmpty())return[];const o=[],{dataRows:i,dataColumns:n}=t.dimensions,a=h.fu.getTypeName(t.types.index[0]),s=y.has(a);for(let r=e;r<i;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<n;o++){const i=t.getDataValue(r,o);e[t.columns[0][o]]="bigint"===typeof i?Number(i):i}o.push(e)}return o}const F=(0,n.b)((0,d.Z)(v))}}]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(globalThis.webpackChunk_stlite_desktop=globalThis.webpackChunk_stlite_desktop||[]).push([[
|
|
1
|
+
(globalThis.webpackChunk_stlite_desktop=globalThis.webpackChunk_stlite_desktop||[]).push([[8295],{29004:(t,e,h)=>{"use strict";h.r(e),h.d(e,{default:()=>d});var i=h(5057),a=h(30669),s=h(46928),r=h(95870),c=h(82601);const n=(0,h(45490).Z)("div",{target:"e1w7uo6s0"})((({theme:t})=>({"& *":{fontFamily:t.genericFonts.bodyFont,fontSize:"9.6px"},"& svg":{maxWidth:"100%"}})),"");var o=h(96266);s.graphviz;const d=(0,c.Z)((function({width:t,element:e,height:h}){const c=`graphviz-chart-${e.elementId}`;let d=0,g=0;const l=()=>{let i=g,a=d;return h?(i=t,a=h):e.useContainerWidth&&(i=t),{chartWidth:i,chartHeight:a}},p=()=>{try{const t=(0,s.graphviz)(`#${c}`).zoom(!1).fit(!0).scale(1).renderDot(e.spec).on("end",(()=>{const t=(0,a.Ys)(`#${c} > svg`).node();t&&(d=t.getBBox().height,g=t.getBBox().width)})),{chartHeight:h,chartWidth:i}=l();h>0&&t.height(h),i>0&&t.width(i)}catch(t){(0,r.H)(t)}};(0,i.useEffect)((()=>{p()}));const u=l(),v=u.chartWidth?u.chartWidth:t,f=u.chartHeight?u.chartHeight:h;return(0,o.jsx)(n,{className:"graphviz stGraphVizChart",id:c,style:{width:v,height:f}})}))},63778:()=>{},32725:()=>{},14966:()=>{}}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(globalThis.webpackChunk_stlite_desktop=globalThis.webpackChunk_stlite_desktop||[]).push([[8418],{60039:(t,e,i)=>{"use strict";i.r(e),i.d(e,{default:()=>_});var o=i(5057),n=i(97991),s=i(50482),a=i.n(s),r=i(64169),h=i(31476),c=i(23878),l=i(34531),p=i(80552),d=i(58186),m=i(65815),w=i(50256),g=i(98899),u=i(22404),x=i(719),b=i(82601),S=i(51842),k=i(10157),j=i(10458),y=i.n(j),f=i(11787);class v extends Error{}class T extends Error{}class V{static async get(t){const{commandLine:e,userMapboxToken:i}=t.current;return V.token&&V.commandLine===e.toLowerCase()||(V.token=""!==i?i:await this.fetchToken("https://data.streamlit.io/tokens.json","mapbox"),V.commandLine=e.toLowerCase()),V.token}static async fetchToken(t,e){try{const i=await y().get(t),{[e]:o}=i.data;if(null==o||""===o)throw new Error(`Missing token "${e}"`);return o}catch(i){const e=(0,f.b)(i);throw new T(`${e.message} (${t})`)}}}V.token=void 0,V.commandLine=void 0,V.isRunningLocal=()=>{const{hostname:t}=window.location;return"localhost"===t||"127.0.0.1"===t};var C=i(56129),E=i.n(C),M=i(70991),Z=i(96266);const O=({error:t,width:e,deltaType:i})=>t instanceof v?(0,Z.jsx)(M.Z,{width:e,name:"No Mapbox token provided",message:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)("p",{children:["To use ",(0,Z.jsxs)("code",{children:["st.",i]})," or ",(0,Z.jsx)("code",{children:"st.map"})," you need to set up a Mapbox access token."]}),(0,Z.jsxs)("p",{children:["To get a token, create an account at"," ",(0,Z.jsx)("a",{href:"https://mapbox.com",children:"https://mapbox.com"}),". It's free for moderate usage levels!"]}),(0,Z.jsxs)("p",{children:["Once you have a token, just set it using the Streamlit config option ",(0,Z.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,Z.jsxs)("p",{children:["See"," ",(0,Z.jsx)("a",{href:"https://docs.streamlit.io/library/advanced-features/configuration#view-all-configuration-options",children:"our documentation"})," ","for more info on how to set config options."]})]})}):t instanceof T?(0,Z.jsx)(M.Z,{width:e,name:"Error fetching Streamlit Mapbox token",message:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)("p",{children:"This app requires an internet connection."}),(0,Z.jsx)("p",{children:"Please check your connection and try again."}),(0,Z.jsxs)("p",{children:["If you think this is a bug, please file bug report"," ",(0,Z.jsx)("a",{href:"https://github.com/streamlit/streamlit/issues/new/choose",children:"here"}),"."]})]})}):(0,Z.jsx)(M.Z,{width:e,name:"Error fetching Streamlit Mapbox token",message:t.message}),F=t=>e=>{class i extends o.PureComponent{constructor(i){super(i),this.initMapboxToken=async()=>{try{const t=await V.get(this.props.sessionInfo);this.setState({mapboxToken:t,isFetching:!1})}catch(t){const e=(0,f.b)(t);this.setState({mapboxTokenError:e,isFetching:!1})}},this.render=()=>{const{mapboxToken:i,mapboxTokenError:o,isFetching:n}=this.state,{width:s}=this.props;return o?(0,Z.jsx)(O,{width:s,error:o,deltaType:t}):n?(0,Z.jsx)(S.Z,{body:"Loading...",kind:k.h.INFO,width:s}):(0,Z.jsx)(e,{...this.props,mapboxToken:i,width:s})},this.state={isFetching:!0,mapboxToken:void 0,mapboxTokenError:void 0},this.initMapboxToken()}}return i.displayName=`withMapboxToken(${e.displayName||e.name})`,E()(i,e)};var L=i(46434),N=i(45490);const P=(0,N.Z)("div",{target:"e1tsyoib1"})((({width:t,height:e,theme:i})=>({marginTop:i.spacing.sm,position:"relative",height:e,width:t})),""),I=(0,N.Z)("div",{target:"e1tsyoib0"})((({theme:t})=>({position:"absolute",right:"2.625rem",top:t.spacing.md,zIndex:1,"button:not(:disabled)":{background:t.colors.bgColor,"& + button":{borderTopColor:t.colors.secondaryBg},"& span":{filter:(0,c.Iy)(t)?"":"invert(100%)"}}})),"");i(20512);const z={classes:{...l,...m,...d,...w}};(0,x.fh)([g.w,u.E]);const D=new p.Z({configuration:z});class $ extends o.PureComponent{constructor(...t){super(...t),this.state={viewState:{bearing:0,pitch:0,zoom:11},initialized:!1,initialViewState:{}},this.componentDidMount=()=>{this.setState({initialized:!0})},this.createTooltip=t=>{const{element:e}=this.props;if(!t||!t.object||!e.tooltip)return!1;const i=JSON.parse(e.tooltip);return i.html?i.html=this.interpolate(t,i.html):i.text=this.interpolate(t,i.text),i},this.interpolate=(t,e)=>{const i=e.match(/{(.*?)}/g);return i&&i.forEach((i=>{const o=i.substring(1,i.length-1);t.object.hasOwnProperty(o)&&(e=e.replace(i,t.object[o]))})),e},this.onViewStateChange=({viewState:t})=>{this.setState({viewState:t})}}static getDerivedStateFromProps(t,e){const i=$.getDeckObject(t);if(!a()(i.initialViewState,e.initialViewState)){const t=Object.keys(i.initialViewState).reduce(((t,o)=>i.initialViewState[o]===e.initialViewState[o]?t:{...t,[o]:i.initialViewState[o]}),{});return{viewState:{...e.viewState,...t},initialViewState:i.initialViewState}}return null}render(){const t=$.getDeckObject(this.props),{viewState:e}=this.state;return(0,Z.jsx)(P,{className:"stDeckGlJsonChart",width:t.initialViewState.width,height:t.initialViewState.height,children:(0,Z.jsxs)(n.Z,{viewState:e,onViewStateChange:this.onViewStateChange,height:t.initialViewState.height,width:t.initialViewState.width,layers:this.state.initialized?t.layers:[],getTooltip:this.createTooltip,ContextProvider:r.X$.Provider,controller:!0,children:[(0,Z.jsx)(r.Z3,{height:t.initialViewState.height,width:t.initialViewState.width,mapStyle:t.mapStyle&&("string"===typeof t.mapStyle?t.mapStyle:t.mapStyle[0]),mapboxApiAccessToken:this.props.mapboxToken}),(0,Z.jsx)(I,{children:(0,Z.jsx)(r.Pv,{className:"zoomButton",showCompass:!1})})]})})}}$.getDeckObject=t=>{const{element:e,width:i,height:o,theme:n}=t,s=JSON.parse(e.json);if(!(0,L.bb)(s.mapStyle)){const t=(0,c.Iy)(n)?"light":"dark";s.mapStyle=`mapbox://styles/mapbox/${t}-v9`}return o?(s.initialViewState.height=o,s.initialViewState.width=i):(s.initialViewState.height||(s.initialViewState.height=500),e.useContainerWidth&&(s.initialViewState.width=i)),delete s.views,D.convert(s)};const _=(0,h.b)(F("st.pydeck_chart")((0,b.Z)($)))},37398:()=>{},85248:()=>{}}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";(globalThis.webpackChunk_stlite_desktop=globalThis.webpackChunk_stlite_desktop||[]).push([[8486],{78486:(t,e,l)=>{l.r(e),l.d(e,{default:()=>o});var s=l(32386),i=(l(5057),l(96266));function o({element:t,width:e}){const l=t.hasWidth?t.width:e;let o,r;t.scrolling?(o="auto",r={}):(o="no",r={overflow:"hidden"});const c=n(t.src),h=null!=c?void 0:n(t.srcdoc);return(0,i.jsx)("iframe",{allow:s.p,style:r,src:c,srcDoc:h,width:l,height:t.height,scrolling:o,sandbox:s.T,title:"st.iframe"})}function n(t){return null==t||""===t?void 0:t}}}]);
|