@stlite/desktop 0.90.13 → 0.90.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (71) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/build/assets/{ErrorOutline.esm-CJGMKtXr.js → ErrorOutline.esm-8R3U-65K.js} +1 -1
  3. package/build/assets/{FileDownload.esm-DVbGfwz7.js → FileDownload.esm-BFOXuaE0.js} +1 -1
  4. package/build/assets/{FileHelper-BAjDG49X.js → FileHelper-CX-ki3eU.js} +1 -1
  5. package/build/assets/{FormClearHelper-CaLJK07N.js → FormClearHelper-CXfZggoC.js} +1 -1
  6. package/build/assets/{Hooks-D54IehuR.js → Hooks-rH_bDoeH.js} +1 -1
  7. package/build/assets/{InputInstructions-BLplNLW9.js → InputInstructions-DBvcFAZU.js} +1 -1
  8. package/build/assets/{Particles-VYhfVp_p.js → Particles-CC5U4uC2.js} +1 -1
  9. package/build/assets/{ProgressBar-DX8k7XSZ.js → ProgressBar-CUUN2Jn1.js} +1 -1
  10. package/build/assets/{Toolbar-BbbydoLD.js → Toolbar-CAXs2ssX.js} +1 -1
  11. package/build/assets/{base-input-d4WKPeU6.js → base-input-CaoUSnQs.js} +1 -1
  12. package/build/assets/{checkbox-DUA9ewQT.js → checkbox-C6QD2M1R.js} +1 -1
  13. package/build/assets/{createSuper-CoIMxZYP.js → createSuper-C2tKBwhP.js} +1 -1
  14. package/build/assets/{data-grid-overlay-editor-cvHWuOOd.js → data-grid-overlay-editor-B6zYg3nK.js} +1 -1
  15. package/build/assets/{downloader-CR6bzPv-.js → downloader-Dkst_JYU.js} +1 -1
  16. package/build/assets/{es6-BCBcAdQS.js → es6-COIX_UTS.js} +2 -2
  17. package/build/assets/{iframeResizer.contentWindow-CEqjsNrn.js → iframeResizer.contentWindow-CLXvvjGK.js} +1 -1
  18. package/build/assets/{index-HqlJZ3Ag.js → index-B1mnHG1O.js} +1 -1
  19. package/build/assets/{index-C91sP-jG.js → index-BAuLAaYe.js} +1 -1
  20. package/build/assets/{index-BGUuVZft.js → index-BI0ZZeqT.js} +1 -1
  21. package/build/assets/{index-mHvUvPYI.js → index-BKmCVz-X.js} +1 -1
  22. package/build/assets/{index-Bwfh73dd.js → index-BS4li24f.js} +1 -1
  23. package/build/assets/{index-vLb3c1eZ.js → index-BeWWu5Gh.js} +1 -1
  24. package/build/assets/{index-CeNNLDtJ.js → index-Bot-HFGd.js} +1 -1
  25. package/build/assets/{index-Bhgfj5y5.js → index-Bt2KSUC2.js} +1 -1
  26. package/build/assets/{index-CdAXvPf5.js → index-Bvl3bY4R.js} +1 -1
  27. package/build/assets/{index-PHqcnj3c.js → index-C0Q8yE7v.js} +1 -1
  28. package/build/assets/{index-B3GOsGpL.js → index-C12OFcIh.js} +1 -1
  29. package/build/assets/{index-BdVfRySM.js → index-C7nKmor1.js} +1 -1
  30. package/build/assets/{index-DOiS7VE9.js → index-CADKCir8.js} +1 -1
  31. package/build/assets/{index-CTZrIDfL.js → index-CCXHPMUB.js} +1 -1
  32. package/build/assets/{index-j6pFDYKO.js → index-CJikVwcT.js} +1 -1
  33. package/build/assets/{index-NigQ67t-.js → index-CKIZeYUq.js} +1 -1
  34. package/build/assets/{index-XsxWL5x-.js → index-C_m1xqoG.js} +1 -1
  35. package/build/assets/{index-CD0SY35r.js → index-CcI6rcYL.js} +1 -1
  36. package/build/assets/{index-CJWk1YT9.js → index-CqPiUIzz.js} +1 -1
  37. package/build/assets/{index-BRiK5gVx.js → index-CzNOzdMD.js} +1 -1
  38. package/build/assets/{index-BMSSeqlt.js → index-D57JlMpf.js} +1 -1
  39. package/build/assets/{index-D_4iXBI5.js → index-DH8imcpD.js} +1 -1
  40. package/build/assets/{index-VVwti7cA.js → index-DKIJUmSp.js} +1 -1
  41. package/build/assets/{index-wUVGuFfU.js → index-DRv0ltn2.js} +1 -1
  42. package/build/assets/{index-B7yzG-4X.js → index-DZKUZQ4z.js} +5 -5
  43. package/build/assets/{index-CIRTE79j.js → index-DpusuKed.js} +1 -1
  44. package/build/assets/{index-DCv3Ovf7.js → index-P8waswk0.js} +1 -1
  45. package/build/assets/{index-CwPp5UqK.js → index-PiPju_F7.js} +1 -1
  46. package/build/assets/{index-B58bWjQH.js → index-R9kIgYTc.js} +1 -1
  47. package/build/assets/{index-CHBxMYoz.js → index-W7pMcdM5.js} +1 -1
  48. package/build/assets/{index-DoQHaClc.js → index-WXxfAlRg.js} +1 -1
  49. package/build/assets/{index-D9P3ZYiC.js → index-gnMTbBzT.js} +1 -1
  50. package/build/assets/{index-wnKDraWU.js → index-k4Zz_A0O.js} +217 -212
  51. package/build/assets/{index-BJK2Ym_S.js → index-k4zlsY75.js} +1 -1
  52. package/build/assets/{index-gb2ePejP.js → index-onhde1_u.js} +1 -1
  53. package/build/assets/{index-Dynm-1sH.js → index-qNX4xGHy.js} +1 -1
  54. package/build/assets/{index-BD2ZweM9.js → index-sKFQbsJX.js} +1 -1
  55. package/build/assets/{inherits-xHSaJdUZ.js → inherits-CEwp2qJ3.js} +1 -1
  56. package/build/assets/{input-PliHooUw.js → input-F2PGHPo-.js} +1 -1
  57. package/build/assets/{memory-BJMhKXeY.js → memory-DrewVBU3.js} +1 -1
  58. package/build/assets/{number-overlay-editor-DRf5xgI3.js → number-overlay-editor-b3bkPSy4.js} +1 -1
  59. package/build/assets/{sandbox-DBdCCxaG.js → sandbox-NITkBzy4.js} +1 -1
  60. package/build/assets/{slicedToArray-Cuk3tbTR.js → slicedToArray-CyBE-4ry.js} +1 -1
  61. package/build/assets/{timepicker-DjzHzJAt.js → timepicker-DRJ4YL4p.js} +1 -1
  62. package/build/assets/{uniqueId-ikSpJ9AP.js → uniqueId-CbEiG62v.js} +1 -1
  63. package/build/assets/{useBasicWidgetState-raTjAqZP.js → useBasicWidgetState-CMQ4ds3J.js} +1 -1
  64. package/build/assets/{useTextInputAutoExpand-Uac3U0I_.js → useTextInputAutoExpand-BfLYssNQ.js} +1 -1
  65. package/build/assets/{useUpdateUiValue-BbEmiOZQ.js → useUpdateUiValue-B81sk7L2.js} +1 -1
  66. package/build/assets/{withFullScreenWrapper-C7u7nPsK.js → withFullScreenWrapper-Bc57_5Q4.js} +1 -1
  67. package/build/assets/{worker-CiNU4sgs.js → worker-CO569BKa.js} +4 -4
  68. package/build/electron/worker.js +5 -5
  69. package/build/index.html +1 -1
  70. package/package.json +4 -4
  71. package/wheels/streamlit-1.50.0-cp313-none-any.whl +0 -0
@@ -1,2 +1,2 @@
1
- import{ac as v,o as H,ai as $,r as s,p as A,aj as F,u as N}from"./index-wnKDraWU.js";import{a as z,b as B,c as R,B as C}from"./base-input-d4WKPeU6.js";function w(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function l(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?w(Object(r),!0).forEach(function(n){D(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):w(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function D(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var O=v("div",function(e){return l(l({},z(l(l({$positive:!1},e),{},{$hasIconTrailing:!1}))),{},{width:e.$resize?"fit-content":"100%"})});O.displayName="StyledTextAreaRoot";O.displayName="StyledTextAreaRoot";var _=v("div",function(e){return B(l({$positive:!1},e))});_.displayName="StyledTextareaContainer";_.displayName="StyledTextareaContainer";var S=v("textarea",function(e){return l(l({},R(e)),{},{resize:e.$resize||"none"})});S.displayName="StyledTextarea";S.displayName="StyledTextarea";function g(e){"@babel/helpers - typeof";return g=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},g(e)}function y(){return y=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},y.apply(this,arguments)}function K(e,t){return q(e)||L(e,t)||U(e,t)||M()}function M(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
1
+ import{ac as v,o as H,ai as $,r as s,p as A,aj as F,u as N}from"./index-k4Zz_A0O.js";import{a as z,b as B,c as R,B as C}from"./base-input-CaoUSnQs.js";function w(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function l(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?w(Object(r),!0).forEach(function(n){D(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):w(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function D(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var O=v("div",function(e){return l(l({},z(l(l({$positive:!1},e),{},{$hasIconTrailing:!1}))),{},{width:e.$resize?"fit-content":"100%"})});O.displayName="StyledTextAreaRoot";O.displayName="StyledTextAreaRoot";var _=v("div",function(e){return B(l({$positive:!1},e))});_.displayName="StyledTextareaContainer";_.displayName="StyledTextareaContainer";var S=v("textarea",function(e){return l(l({},R(e)),{},{resize:e.$resize||"none"})});S.displayName="StyledTextarea";S.displayName="StyledTextarea";function g(e){"@babel/helpers - typeof";return g=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},g(e)}function y(){return y=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},y.apply(this,arguments)}function K(e,t){return q(e)||L(e,t)||U(e,t)||M()}function M(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
2
2
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function U(e,t){if(e){if(typeof e=="string")return P(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return P(e,t)}}function P(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function L(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n=[],o=!0,i=!1,a,u;try{for(r=r.call(e);!(o=(a=r.next()).done)&&(n.push(a.value),!(t&&n.length===t));o=!0);}catch(c){i=!0,u=c}finally{try{!o&&r.return!=null&&r.return()}finally{if(i)throw u}}return n}}function q(e){if(Array.isArray(e))return e}function V(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function G(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function W(e,t,r){return t&&G(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function X(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&m(e,t)}function m(e,t){return m=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,o){return n.__proto__=o,n},m(e,t)}function Y(e){var t=J();return function(){var n=d(e),o;if(t){var i=d(this).constructor;o=Reflect.construct(n,arguments,i)}else o=n.apply(this,arguments);return Z(this,o)}}function Z(e,t){if(t&&(g(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return f(e)}function f(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function J(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function d(e){return d=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},d(e)}function p(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var Q=(function(e){X(r,e);var t=Y(r);function r(){var n;V(this,r);for(var o=arguments.length,i=new Array(o),a=0;a<o;a++)i[a]=arguments[a];return n=t.call.apply(t,[this].concat(i)),p(f(n),"state",{isFocused:n.props.autoFocus||!1}),p(f(n),"onFocus",function(u){n.setState({isFocused:!0}),n.props.onFocus(u)}),p(f(n),"onBlur",function(u){n.setState({isFocused:!1}),n.props.onBlur(u)}),n}return W(r,[{key:"render",value:function(){var o=this.props.overrides,i=o===void 0?{}:o,a=H(i.Root,O),u=K(a,2),c=u[0],h=u[1],b=$({Input:{component:S},InputContainer:{component:_}},i);return s.createElement(c,y({"data-baseweb":"textarea",$isFocused:this.state.isFocused,$isReadOnly:this.props.readOnly,$disabled:this.props.disabled,$error:this.props.error,$positive:this.props.positive,$required:this.props.required,$resize:this.props.resize},h),s.createElement(C,y({},this.props,{type:F.textarea,overrides:b,onFocus:this.onFocus,onBlur:this.onBlur,resize:this.props.resize})))}}]),r})(s.Component);p(Q,"defaultProps",{autoFocus:!1,disabled:!1,readOnly:!1,error:!1,name:"",onBlur:function(){},onChange:function(){},onKeyDown:function(){},onKeyPress:function(){},onKeyUp:function(){},onFocus:function(){},overrides:{},placeholder:"",required:!1,rows:3,size:A.default});const k=6.5,T=1,ee=e=>{let t=0;const{current:r}=e;return r&&(r.style.height="auto",t=r.scrollHeight,r.style.height=""),t},te=(e,t,r)=>e>0&&r.current?Math.abs(e-t)>T:!1,re=(e,t)=>{if(e.current&&t.current){const{offsetHeight:r}=e.current;t.current.minHeight=r,t.current.maxHeight=r*k}},ne=(e,t,r)=>e?`${t+T}px`:r?String(r):"",oe=e=>e?`${e}px`:"",ue=({textareaRef:e,dependencies:t=[]})=>{const r=N(),n=s.useRef({minHeight:0,maxHeight:0}),[o,i]=s.useState(0),[a,u]=s.useState(!1),c=s.useCallback(()=>{i(ee(e))},[e,i]),h=s.useCallback(()=>{i(0)},[i]);s.useLayoutEffect(()=>{e.current&&re(e,n)},[e]),s.useLayoutEffect(()=>{const{minHeight:j}=n.current;u(te(o,j,e))},[o,e]),s.useLayoutEffect(()=>{c()},[e,c,...t]);const{maxHeight:b}=n.current,x=r.sizes.minElementHeight,E=ne(a,o,x),I=oe(b);return{isExtended:a,height:E,maxHeight:I,updateScrollHeight:c,clearScrollHeight:h}};export{Q as T,ue as u};
@@ -1 +1 @@
1
- import{r as a,a5 as p}from"./index-wnKDraWU.js";import{i as b}from"./inputUtils-CptNuJwn.js";function i({formId:r,maxChars:s,setDirty:n,setUiValue:e,setValueWithSource:f,additionalAction:t}){return a.useCallback(u=>{const{value:o}=u.target;s!==0&&o.length>s||(n(!0),e(o),p({formId:r})&&f({value:o,fromUi:!0}),t&&t())},[r,s,n,e,f,t])}function F(r,s,n,e,f,t=!1){return a.useCallback(u=>{const o=t?u.metaKey||u.ctrlKey:!0;!b(u)||!o||(u.preventDefault(),n&&s(),e.allowFormEnterToSubmit(r)&&e.submitForm(r,f))},[r,f,n,s,e,t])}function K(r,s,n,e){a.useEffect(()=>{e||r!==s&&n(r)},[r,s,e,n])}export{i as a,F as b,K as u};
1
+ import{r as a,a5 as p}from"./index-k4Zz_A0O.js";import{i as b}from"./inputUtils-CptNuJwn.js";function i({formId:r,maxChars:s,setDirty:n,setUiValue:e,setValueWithSource:f,additionalAction:t}){return a.useCallback(u=>{const{value:o}=u.target;s!==0&&o.length>s||(n(!0),e(o),p({formId:r})&&f({value:o,fromUi:!0}),t&&t())},[r,s,n,e,f,t])}function F(r,s,n,e,f,t=!1){return a.useCallback(u=>{const o=t?u.metaKey||u.ctrlKey:!0;!b(u)||!o||(u.preventDefault(),n&&s(),e.allowFormEnterToSubmit(r)&&e.submitForm(r,f))},[r,f,n,s,e,t])}function K(r,s,n,e){a.useEffect(()=>{e||r!==s&&n(r)},[r,s,e,n])}export{i as a,F as b,K as u};
@@ -1 +1 @@
1
- import{r as n,s as f,L as p,as as x,u as h,a4 as y,j as d,at as g}from"./index-wnKDraWU.js";const m=n.createContext(null);m.displayName="ElementFullscreenContext";const w=f("div",{target:"elp1w7k0"})(({theme:e,isExpanded:t})=>({width:"100%",height:"100%",...t?{position:"fixed",top:0,left:0,bottom:0,right:0,background:e.colors.bgColor,zIndex:e.zIndices.fullscreenWrapper,padding:e.spacing.md,paddingTop:e.sizes.fullScreenHeaderHeight,overflow:"auto",display:"flex",alignItems:"center",justifyContent:"center"}:{}}),""),C=()=>{const{setFullScreen:e}=n.useContext(p),[t,s]=n.useState(!1),{fullHeight:a,fullWidth:c}=x(),l=n.useCallback(r=>{s(r),e(r)},[e]),u=n.useCallback(()=>{document.body.style.overflow="hidden",l(!0)},[l]),o=n.useCallback(()=>{document.body.style.overflow="unset",l(!1)},[l]),i=n.useCallback(r=>{r.keyCode===27&&t&&o()},[o,t]);return n.useEffect(()=>(document.addEventListener("keydown",i,!1),()=>{document.removeEventListener("keydown",i,!1)}),[i]),n.useMemo(()=>({expanded:t,zoomIn:u,zoomOut:o,fullHeight:a,fullWidth:c}),[t,u,o,a,c])},E=({children:e})=>{const t=h(),{expanded:s,fullHeight:a,fullWidth:c,zoomIn:l,zoomOut:u}=C(),{width:o,elementRef:i}=y(),r=n.useMemo(()=>({width:s?c:o,height:s?a:void 0,expanded:s,expand:l,collapse:u}),[s,a,c,o,l,u]);return d.jsx(m.Provider,{value:r,children:d.jsx(w,{ref:i,isExpanded:s,"data-testid":"stFullScreenFrame",theme:t,children:e})})};function S(e){const t=s=>d.jsx(E,{children:d.jsx(e,{...s})});return t.displayName=`withFullScreenWrapper(${e.displayName||e.name})`,g(t,e)}export{m as E,S as w};
1
+ import{r as n,s as f,L as p,as as x,u as h,a4 as y,j as d,at as g}from"./index-k4Zz_A0O.js";const m=n.createContext(null);m.displayName="ElementFullscreenContext";const w=f("div",{target:"elp1w7k0"})(({theme:e,isExpanded:t})=>({width:"100%",height:"100%",...t?{position:"fixed",top:0,left:0,bottom:0,right:0,background:e.colors.bgColor,zIndex:e.zIndices.fullscreenWrapper,padding:e.spacing.md,paddingTop:e.sizes.fullScreenHeaderHeight,overflow:"auto",display:"flex",alignItems:"center",justifyContent:"center"}:{}}),""),C=()=>{const{setFullScreen:e}=n.useContext(p),[t,s]=n.useState(!1),{fullHeight:a,fullWidth:c}=x(),l=n.useCallback(r=>{s(r),e(r)},[e]),u=n.useCallback(()=>{document.body.style.overflow="hidden",l(!0)},[l]),o=n.useCallback(()=>{document.body.style.overflow="unset",l(!1)},[l]),i=n.useCallback(r=>{r.keyCode===27&&t&&o()},[o,t]);return n.useEffect(()=>(document.addEventListener("keydown",i,!1),()=>{document.removeEventListener("keydown",i,!1)}),[i]),n.useMemo(()=>({expanded:t,zoomIn:u,zoomOut:o,fullHeight:a,fullWidth:c}),[t,u,o,a,c])},E=({children:e})=>{const t=h(),{expanded:s,fullHeight:a,fullWidth:c,zoomIn:l,zoomOut:u}=C(),{width:o,elementRef:i}=y(),r=n.useMemo(()=>({width:s?c:o,height:s?a:void 0,expanded:s,expand:l,collapse:u}),[s,a,c,o,l,u]);return d.jsx(m.Provider,{value:r,children:d.jsx(w,{ref:i,isExpanded:s,"data-testid":"stFullScreenFrame",theme:t,children:e})})};function S(e){const t=s=>d.jsx(E,{children:d.jsx(e,{...s})});return t.displayName=`withFullScreenWrapper(${e.displayName||e.name})`,g(t,e)}export{m as E,S as w};
@@ -1,4 +1,4 @@
1
- function Y(o){return o&&o.__esModule&&Object.prototype.hasOwnProperty.call(o,"default")?o.default:o}var T,j;function Z(){if(j)return T;j=1;function o(i){if(typeof i!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(i))}function c(i,e){for(var t="",s=0,a=-1,d=0,r,l=0;l<=i.length;++l){if(l<i.length)r=i.charCodeAt(l);else{if(r===47)break;r=47}if(r===47){if(!(a===l-1||d===1))if(a!==l-1&&d===2){if(t.length<2||s!==2||t.charCodeAt(t.length-1)!==46||t.charCodeAt(t.length-2)!==46){if(t.length>2){var g=t.lastIndexOf("/");if(g!==t.length-1){g===-1?(t="",s=0):(t=t.slice(0,g),s=t.length-1-t.lastIndexOf("/")),a=l,d=0;continue}}else if(t.length===2||t.length===1){t="",s=0,a=l,d=0;continue}}e&&(t.length>0?t+="/..":t="..",s=2)}else t.length>0?t+="/"+i.slice(a+1,l):t=i.slice(a+1,l),s=l-a-1;a=l,d=0}else r===46&&d!==-1?++d:d=-1}return t}function f(i,e){var t=e.dir||e.root,s=e.base||(e.name||"")+(e.ext||"");return t?t===e.root?t+s:t+i+s:s}var u={resolve:function(){for(var e="",t=!1,s,a=arguments.length-1;a>=-1&&!t;a--){var d;a>=0?d=arguments[a]:(s===void 0&&(s=process.cwd()),d=s),o(d),d.length!==0&&(e=d+"/"+e,t=d.charCodeAt(0)===47)}return e=c(e,!t),t?e.length>0?"/"+e:"/":e.length>0?e:"."},normalize:function(e){if(o(e),e.length===0)return".";var t=e.charCodeAt(0)===47,s=e.charCodeAt(e.length-1)===47;return e=c(e,!t),e.length===0&&!t&&(e="."),e.length>0&&s&&(e+="/"),t?"/"+e:e},isAbsolute:function(e){return o(e),e.length>0&&e.charCodeAt(0)===47},join:function(){if(arguments.length===0)return".";for(var e,t=0;t<arguments.length;++t){var s=arguments[t];o(s),s.length>0&&(e===void 0?e=s:e+="/"+s)}return e===void 0?".":u.normalize(e)},relative:function(e,t){if(o(e),o(t),e===t||(e=u.resolve(e),t=u.resolve(t),e===t))return"";for(var s=1;s<e.length&&e.charCodeAt(s)===47;++s);for(var a=e.length,d=a-s,r=1;r<t.length&&t.charCodeAt(r)===47;++r);for(var l=t.length,g=l-r,S=d<g?d:g,v=-1,h=0;h<=S;++h){if(h===S){if(g>S){if(t.charCodeAt(r+h)===47)return t.slice(r+h+1);if(h===0)return t.slice(r+h)}else d>S&&(e.charCodeAt(s+h)===47?v=h:h===0&&(v=0));break}var P=e.charCodeAt(s+h),R=t.charCodeAt(r+h);if(P!==R)break;P===47&&(v=h)}var b="";for(h=s+v+1;h<=a;++h)(h===a||e.charCodeAt(h)===47)&&(b.length===0?b+="..":b+="/..");return b.length>0?b+t.slice(r+v):(r+=v,t.charCodeAt(r)===47&&++r,t.slice(r))},_makeLong:function(e){return e},dirname:function(e){if(o(e),e.length===0)return".";for(var t=e.charCodeAt(0),s=t===47,a=-1,d=!0,r=e.length-1;r>=1;--r)if(t=e.charCodeAt(r),t===47){if(!d){a=r;break}}else d=!1;return a===-1?s?"/":".":s&&a===1?"//":e.slice(0,a)},basename:function(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');o(e);var s=0,a=-1,d=!0,r;if(t!==void 0&&t.length>0&&t.length<=e.length){if(t.length===e.length&&t===e)return"";var l=t.length-1,g=-1;for(r=e.length-1;r>=0;--r){var S=e.charCodeAt(r);if(S===47){if(!d){s=r+1;break}}else g===-1&&(d=!1,g=r+1),l>=0&&(S===t.charCodeAt(l)?--l===-1&&(a=r):(l=-1,a=g))}return s===a?a=g:a===-1&&(a=e.length),e.slice(s,a)}else{for(r=e.length-1;r>=0;--r)if(e.charCodeAt(r)===47){if(!d){s=r+1;break}}else a===-1&&(d=!1,a=r+1);return a===-1?"":e.slice(s,a)}},extname:function(e){o(e);for(var t=-1,s=0,a=-1,d=!0,r=0,l=e.length-1;l>=0;--l){var g=e.charCodeAt(l);if(g===47){if(!d){s=l+1;break}continue}a===-1&&(d=!1,a=l+1),g===46?t===-1?t=l:r!==1&&(r=1):t!==-1&&(r=-1)}return t===-1||a===-1||r===0||r===1&&t===a-1&&t===s+1?"":e.slice(t,a)},format:function(e){if(e===null||typeof e!="object")throw new TypeError('The "pathObject" argument must be of type Object. Received type '+typeof e);return f("/",e)},parse:function(e){o(e);var t={root:"",dir:"",base:"",ext:"",name:""};if(e.length===0)return t;var s=e.charCodeAt(0),a=s===47,d;a?(t.root="/",d=1):d=0;for(var r=-1,l=0,g=-1,S=!0,v=e.length-1,h=0;v>=d;--v){if(s=e.charCodeAt(v),s===47){if(!S){l=v+1;break}continue}g===-1&&(S=!1,g=v+1),s===46?r===-1?r=v:h!==1&&(h=1):r!==-1&&(h=-1)}return r===-1||g===-1||h===0||h===1&&r===g-1&&r===l+1?g!==-1&&(l===0&&a?t.base=t.name=e.slice(1,g):t.base=t.name=e.slice(l,g)):(l===0&&a?(t.name=e.slice(1,r),t.base=e.slice(1,g)):(t.name=e.slice(l,r),t.base=e.slice(l,g)),t.ext=e.slice(r,g)),l>0?t.dir=e.slice(0,l-1):a&&(t.dir="/"),t},sep:"/",delimiter:":",win32:null,posix:null};return u.posix=u,T=u,T}var ee=Z(),M=Y(ee);const z="/home/pyodide",H=o=>`${z}/${o}`,C=(o,c)=>o==null?M.resolve(z,c):M.resolve(H(o),c);function N(o,c){const f=M.normalize(c),i=M.dirname(f).split(/(?=\/)/);let e="";for(const t of i){e+=t;const s=o.FS.analyzePath(e);if(s.exists&&s.object){if(!o.FS.isDir(s.object.mode))throw new Error(`"${e}" already exists and is not a directory.`);continue}try{o.FS.mkdir(e)}catch(a){throw console.error(`Failed to create a directory "${e}"`),a}}}function W(o,c,f,u){N(o,c),o.FS.writeFile(c,f,u)}function te(o,c,f){N(o,f),o.FS.rename(c,f)}const re="[",oe="(<=>!~",ne=";",se="@",ae=new RegExp(`[${re+oe+ne+se}]`);function ie(o){return o.split(ae)[0].trim()}function q(o){return o.forEach(f=>{let u;try{u=new URL(f)}catch{return}if(u.protocol==="emfs:"||u.protocol==="file:")throw new Error(`"emfs:" and "file:" protocols are not allowed for the requirement (${f})`)}),o.filter(f=>ie(f)==="streamlit"?(console.warn(`Streamlit is specified in the requirements ("${f}"), but it will be ignored. A built-in version of Streamlit will be used.`),!1):!0)}async function le(o){const c=typeof process<"u"&&process.versions?.node;let f;c?f=(await Promise.resolve().then(function(){return D})).sep:f="/";const u=o.slice(0,o.lastIndexOf(f)+1);if(o.endsWith(".mjs")){if(c){const i=await Promise.resolve().then(function(){return D}),e=await Promise.resolve().then(function(){return D});!o.includes("://")&&i.isAbsolute(o)&&(o=e.pathToFileURL(o).href)}return{scriptURL:o,pyodideIndexURL:u,isESModule:!0}}else return{scriptURL:o,pyodideIndexURL:u,isESModule:!1}}async function ce(o,c){const{scriptURL:f,pyodideIndexURL:u,isESModule:i}=await le(o);let e;return i?e=(await import(f)).loadPyodide:(importScripts(f),e=self.loadPyodide),e({...c,indexURL:u})}function de(o){o.runPython(`
1
+ function Y(o){return o&&o.__esModule&&Object.prototype.hasOwnProperty.call(o,"default")?o.default:o}var I,j;function Z(){if(j)return I;j=1;function o(i){if(typeof i!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(i))}function c(i,e){for(var t="",s=0,a=-1,d=0,r,l=0;l<=i.length;++l){if(l<i.length)r=i.charCodeAt(l);else{if(r===47)break;r=47}if(r===47){if(!(a===l-1||d===1))if(a!==l-1&&d===2){if(t.length<2||s!==2||t.charCodeAt(t.length-1)!==46||t.charCodeAt(t.length-2)!==46){if(t.length>2){var g=t.lastIndexOf("/");if(g!==t.length-1){g===-1?(t="",s=0):(t=t.slice(0,g),s=t.length-1-t.lastIndexOf("/")),a=l,d=0;continue}}else if(t.length===2||t.length===1){t="",s=0,a=l,d=0;continue}}e&&(t.length>0?t+="/..":t="..",s=2)}else t.length>0?t+="/"+i.slice(a+1,l):t=i.slice(a+1,l),s=l-a-1;a=l,d=0}else r===46&&d!==-1?++d:d=-1}return t}function f(i,e){var t=e.dir||e.root,s=e.base||(e.name||"")+(e.ext||"");return t?t===e.root?t+s:t+i+s:s}var u={resolve:function(){for(var e="",t=!1,s,a=arguments.length-1;a>=-1&&!t;a--){var d;a>=0?d=arguments[a]:(s===void 0&&(s=process.cwd()),d=s),o(d),d.length!==0&&(e=d+"/"+e,t=d.charCodeAt(0)===47)}return e=c(e,!t),t?e.length>0?"/"+e:"/":e.length>0?e:"."},normalize:function(e){if(o(e),e.length===0)return".";var t=e.charCodeAt(0)===47,s=e.charCodeAt(e.length-1)===47;return e=c(e,!t),e.length===0&&!t&&(e="."),e.length>0&&s&&(e+="/"),t?"/"+e:e},isAbsolute:function(e){return o(e),e.length>0&&e.charCodeAt(0)===47},join:function(){if(arguments.length===0)return".";for(var e,t=0;t<arguments.length;++t){var s=arguments[t];o(s),s.length>0&&(e===void 0?e=s:e+="/"+s)}return e===void 0?".":u.normalize(e)},relative:function(e,t){if(o(e),o(t),e===t||(e=u.resolve(e),t=u.resolve(t),e===t))return"";for(var s=1;s<e.length&&e.charCodeAt(s)===47;++s);for(var a=e.length,d=a-s,r=1;r<t.length&&t.charCodeAt(r)===47;++r);for(var l=t.length,g=l-r,S=d<g?d:g,v=-1,_=0;_<=S;++_){if(_===S){if(g>S){if(t.charCodeAt(r+_)===47)return t.slice(r+_+1);if(_===0)return t.slice(r+_)}else d>S&&(e.charCodeAt(s+_)===47?v=_:_===0&&(v=0));break}var P=e.charCodeAt(s+_),R=t.charCodeAt(r+_);if(P!==R)break;P===47&&(v=_)}var b="";for(_=s+v+1;_<=a;++_)(_===a||e.charCodeAt(_)===47)&&(b.length===0?b+="..":b+="/..");return b.length>0?b+t.slice(r+v):(r+=v,t.charCodeAt(r)===47&&++r,t.slice(r))},_makeLong:function(e){return e},dirname:function(e){if(o(e),e.length===0)return".";for(var t=e.charCodeAt(0),s=t===47,a=-1,d=!0,r=e.length-1;r>=1;--r)if(t=e.charCodeAt(r),t===47){if(!d){a=r;break}}else d=!1;return a===-1?s?"/":".":s&&a===1?"//":e.slice(0,a)},basename:function(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');o(e);var s=0,a=-1,d=!0,r;if(t!==void 0&&t.length>0&&t.length<=e.length){if(t.length===e.length&&t===e)return"";var l=t.length-1,g=-1;for(r=e.length-1;r>=0;--r){var S=e.charCodeAt(r);if(S===47){if(!d){s=r+1;break}}else g===-1&&(d=!1,g=r+1),l>=0&&(S===t.charCodeAt(l)?--l===-1&&(a=r):(l=-1,a=g))}return s===a?a=g:a===-1&&(a=e.length),e.slice(s,a)}else{for(r=e.length-1;r>=0;--r)if(e.charCodeAt(r)===47){if(!d){s=r+1;break}}else a===-1&&(d=!1,a=r+1);return a===-1?"":e.slice(s,a)}},extname:function(e){o(e);for(var t=-1,s=0,a=-1,d=!0,r=0,l=e.length-1;l>=0;--l){var g=e.charCodeAt(l);if(g===47){if(!d){s=l+1;break}continue}a===-1&&(d=!1,a=l+1),g===46?t===-1?t=l:r!==1&&(r=1):t!==-1&&(r=-1)}return t===-1||a===-1||r===0||r===1&&t===a-1&&t===s+1?"":e.slice(t,a)},format:function(e){if(e===null||typeof e!="object")throw new TypeError('The "pathObject" argument must be of type Object. Received type '+typeof e);return f("/",e)},parse:function(e){o(e);var t={root:"",dir:"",base:"",ext:"",name:""};if(e.length===0)return t;var s=e.charCodeAt(0),a=s===47,d;a?(t.root="/",d=1):d=0;for(var r=-1,l=0,g=-1,S=!0,v=e.length-1,_=0;v>=d;--v){if(s=e.charCodeAt(v),s===47){if(!S){l=v+1;break}continue}g===-1&&(S=!1,g=v+1),s===46?r===-1?r=v:_!==1&&(_=1):r!==-1&&(_=-1)}return r===-1||g===-1||_===0||_===1&&r===g-1&&r===l+1?g!==-1&&(l===0&&a?t.base=t.name=e.slice(1,g):t.base=t.name=e.slice(l,g)):(l===0&&a?(t.name=e.slice(1,r),t.base=e.slice(1,g)):(t.name=e.slice(l,r),t.base=e.slice(l,g)),t.ext=e.slice(r,g)),l>0?t.dir=e.slice(0,l-1):a&&(t.dir="/"),t},sep:"/",delimiter:":",win32:null,posix:null};return u.posix=u,I=u,I}var ee=Z(),M=Y(ee);const z="/home/pyodide",H=o=>`${z}/${o}`,C=(o,c)=>o==null?M.resolve(z,c):M.resolve(H(o),c);function J(o,c){const f=M.normalize(c),i=M.dirname(f).split(/(?=\/)/);let e="";for(const t of i){e+=t;const s=o.FS.analyzePath(e);if(s.exists&&s.object){if(!o.FS.isDir(s.object.mode))throw new Error(`"${e}" already exists and is not a directory.`);continue}try{o.FS.mkdir(e)}catch(a){throw console.error(`Failed to create a directory "${e}"`),a}}}function N(o,c,f,u){J(o,c),o.FS.writeFile(c,f,u)}function te(o,c,f){J(o,f),o.FS.rename(c,f)}const re="[",oe="(<=>!~",ne=";",se="@",ae=new RegExp(`[${re+oe+ne+se}]`);function ie(o){return o.split(ae)[0].trim()}function q(o){return o.forEach(f=>{let u;try{u=new URL(f)}catch{return}if(u.protocol==="emfs:"||u.protocol==="file:")throw new Error(`"emfs:" and "file:" protocols are not allowed for the requirement (${f})`)}),o.filter(f=>ie(f)==="streamlit"?(console.warn(`Streamlit is specified in the requirements ("${f}"), but it will be ignored. A built-in version of Streamlit will be used.`),!1):!0)}async function le(o){const c=typeof process<"u"&&process.versions?.node;let f;c?f=(await Promise.resolve().then(function(){return D})).sep:f="/";const u=o.slice(0,o.lastIndexOf(f)+1);if(o.endsWith(".mjs")){if(c){const i=await Promise.resolve().then(function(){return D}),e=await Promise.resolve().then(function(){return D});!o.includes("://")&&i.isAbsolute(o)&&(o=e.pathToFileURL(o).href)}return{scriptURL:o,pyodideIndexURL:u,isESModule:!0}}else return{scriptURL:o,pyodideIndexURL:u,isESModule:!1}}async function ce(o,c){const{scriptURL:f,pyodideIndexURL:u,isESModule:i}=await le(o);let e;return i?e=(await import(f)).loadPyodide:(importScripts(f),e=self.loadPyodide),e({...c,indexURL:u})}function de(o){o.runPython(`
2
2
  import micropip
3
3
  micropip.add_mock_package(
4
4
  "pyarrow", "0.0.1",
@@ -24,12 +24,12 @@ class ChunkedArray:
24
24
  """
25
25
  }
26
26
  )
27
- `)}function ue(o,c,f){const u=o.pyimport("pyodide"),i=r=>u.code.find_imports(r).toJs(),e=f.map(r=>i(r)),a=Array.from(new Set(e.flat())).filter(r=>!o.runPython(`__import__('importlib').util.find_spec('${r}')`)).map(r=>o._api._import_name_to_package_name.get(r)).filter(r=>r);if(a.length===0)return Promise.resolve();const d=o.loadPackage(a);return c(a,d),d.then()}function J(o,c,f){const u=ue(o,c,f);o.runPython(`
27
+ `)}function ue(o,c,f){const u=o.pyimport("pyodide"),i=r=>u.code.find_imports(r).toJs(),e=f.map(r=>i(r)),a=Array.from(new Set(e.flat())).filter(r=>!o.runPython(`__import__('importlib').util.find_spec('${r}')`)).map(r=>o._api._import_name_to_package_name.get(r)).filter(r=>r);if(a.length===0)return Promise.resolve();const d=o.loadPackage(a);return c(a,d),d.then()}function W(o,c,f){const u=ue(o,c,f);o.runPython(`
28
28
  def __set_module_auto_load_promise__(promise):
29
29
  from streamlit.runtime.scriptrunner import script_runner
30
30
  script_runner.moduleAutoLoadPromise = promise
31
31
 
32
- __set_module_auto_load_promise__`)(u)}async function ge(o,c,f){const{line:u,column:i}=f,e=o.Script(c);if(u>e._code_lines.length)return[];const t=e.complete.callKwargs({line:u,column:i,fuzzy:!1}),s=[];for(const a of t.toJs())s.push({name:a.name,type:a.$type,docstring:a.docstring.callKwargs({raw:!0}),complete:a.complete}),a.destroy();return s}let O=null;async function fe(o,c,f,u,i){const{files:e,archives:t,requirements:s,prebuiltPackageNames:a,wheels:d,installs:r,pyodideUrl:l=o,streamlitConfig:g,idbfsMountpoints:S,nodefsMountpoints:v,moduleAutoLoad:h,env:P,languageServer:R}=f,b=q(s);if(O)i("Pyodide is already loaded."),console.debug("Pyodide is already loaded.");else{i("Loading Pyodide."),console.debug("Loading Pyodide."),O=ce(l,{stdout:console.log,stderr:console.error});const m=[];d&&(m.push(d.streamlit),m.push(d.stliteLib)),R&&m.push("jedi"),b.unshift(...m),console.debug("Loaded Pyodide")}const n=await O;if(P){console.debug("Setting environment variables",P);const m=n.pyimport("os");m.environ.update(n.toPy(P)),console.debug("Set environment variables",m.environ)}let p=!1;S&&(p=!0,S.forEach(m=>{n.FS.mkdir(m),n.FS.mount(n.FS.filesystems.IDBFS,{},m)}),await new Promise((m,y)=>{n.FS.syncfs(!0,k=>{k?y(k):m()})})),v&&Object.entries(v).forEach(([m,y])=>{n.FS.mkdir(m),n.FS.mount(n.FS.filesystems.NODEFS,{root:y},m)}),i("Mounting files.");const _=[];await Promise.all(Object.keys(e).map(async m=>{const y=e[m];m=C(c,m);let k;"url"in y?(console.debug(`Fetch a file from ${y.url}`),k=await fetch(y.url).then(A=>A.arrayBuffer()).then(A=>new Uint8Array(A))):k=y.data,console.debug(`Write a file "${m}"`),W(n,m,k,e.opts),m.endsWith(".py")&&_.push(m)})),i("Unpacking archives."),await Promise.all(t.map(async m=>{let y;"url"in m?(console.debug(`Fetch an archive from ${m.url}`),y=await fetch(m.url).then(V=>V.arrayBuffer())):y=m.buffer;const{format:k,options:A}=m;console.debug("Unpack an archive",{format:k,options:A}),n.unpackArchive(y,k,A)})),await n.loadPackage("micropip");const w=n.pyimport("micropip");if(i("Mocking some packages."),console.debug("Mock pyarrow"),de(n),console.debug("Mocked pyarrow"),i("Installing packages."),console.debug("Installing the prebuilt packages:",a),await n.loadPackage(a),console.debug("Installed the prebuilt packages"),console.debug("Installing the requirements:",b),await w.install.callKwargs(b,{keep_going:!0}),console.debug("Installed the requirements"),r&&(console.debug("Installing the additional requirements"),await Promise.all(r.map(({requirements:m,options:y})=>{const k=q(m);return console.debug("Installing the requirements:",k),w.install.callKwargs(k,y??{})}))),h){const m=_.map(y=>n.FS.readFile(y,{encoding:"utf8"}));J(n,u,m)}await n.runPythonAsync(`
32
+ __set_module_auto_load_promise__`)(u)}async function ge(o,c,f){const{line:u,column:i}=f,e=o.Script(c);if(u>e._code_lines.length)return[];const t=e.complete.callKwargs({line:u,column:i,fuzzy:!1}),s=[];for(const a of t.toJs())s.push({name:a.name,type:a.$type,docstring:a.docstring.callKwargs({raw:!0}),complete:a.complete}),a.destroy();return s}let O=null;async function fe(o,c,f,u,i){const{files:e,archives:t,requirements:s,prebuiltPackageNames:a,wheels:d,installs:r,pyodideUrl:l=o,streamlitConfig:g,idbfsMountpoints:S,nodefsMountpoints:v,moduleAutoLoad:_,env:P,languageServer:R}=f,b=q(s);if(O)i("Pyodide is already loaded."),console.debug("Pyodide is already loaded.");else{i("Loading Pyodide."),console.debug("Loading Pyodide."),O=ce(l,{stdout:console.log,stderr:console.error});const m=[];d&&(m.push(d.streamlit),m.push(d.stliteLib)),R&&m.push("jedi"),b.unshift(...m),console.debug("Loaded Pyodide")}const n=await O;if(P){console.debug("Setting environment variables",P);const m=n.pyimport("os");m.environ.update(n.toPy(P)),console.debug("Set environment variables",m.environ)}let p=!1;S&&(p=!0,S.forEach(m=>{n.FS.mkdir(m),n.FS.mount(n.FS.filesystems.IDBFS,{},m)}),await new Promise((m,y)=>{n.FS.syncfs(!0,k=>{k?y(k):m()})})),v&&Object.entries(v).forEach(([m,y])=>{n.FS.mkdir(m),n.FS.mount(n.FS.filesystems.NODEFS,{root:y},m)}),i("Mounting files.");const h=[];await Promise.all(Object.keys(e).map(async m=>{const y=e[m];m=C(c,m);let k;"url"in y?(console.debug(`Fetch a file from ${y.url}`),k=await fetch(y.url).then(A=>A.arrayBuffer()).then(A=>new Uint8Array(A))):k=y.data,console.debug(`Write a file "${m}"`),N(n,m,k,e.opts),m.endsWith(".py")&&h.push(m)})),i("Unpacking archives."),await Promise.all(t.map(async m=>{let y;"url"in m?(console.debug(`Fetch an archive from ${m.url}`),y=await fetch(m.url).then(V=>V.arrayBuffer())):y=m.buffer;const{format:k,options:A}=m;console.debug("Unpack an archive",{format:k,options:A}),n.unpackArchive(y,k,A)})),await n.loadPackage("micropip");const w=n.pyimport("micropip");if(i("Mocking some packages."),console.debug("Mock pyarrow"),de(n),console.debug("Mocked pyarrow"),i("Installing packages."),console.debug("Installing the prebuilt packages:",a),await n.loadPackage(a),console.debug("Installed the prebuilt packages"),console.debug("Installing the requirements:",b),await w.install.callKwargs(b,{keep_going:!0}),console.debug("Installed the requirements"),r&&(console.debug("Installing the additional requirements"),await Promise.all(r.map(({requirements:m,options:y})=>{const k=q(m);return console.debug("Installing the requirements:",k),w.install.callKwargs(k,y??{})}))),_){const m=h.map(y=>n.FS.readFile(y,{encoding:"utf8"}));W(n,u,m)}await n.runPythonAsync(`
33
33
  import importlib
34
34
  importlib.invalidate_caches()
35
35
  `),i("Loading streamlit package."),console.debug("Loading the Streamlit package"),await n.runPythonAsync(`
@@ -102,4 +102,4 @@ def __setup_script_finished_callback__(callback):
102
102
 
103
103
  AppSession._on_scriptrunner_event = wrap_app_session_on_scriptrunner_event(AppSession._on_scriptrunner_event)
104
104
 
105
- __setup_script_finished_callback__`))(y),console.debug("Set up the IndexedDB filesystem synchronizer")}console.debug("Setting up the Streamlit configuration");const{load_config_options:G}=n.pyimport("stlite_lib.bootstrap"),X={"browser.gatherUsageStats":!1,...g,"runner.fastReruns":!1},Q=c!=null;G(n.toPy(X),Q),console.debug("Set up the Streamlit configuration");let I;if(R){i("Loading auto-completion engine."),console.debug("Loading Jedi");try{I=await n.pyimport("jedi"),console.debug("Loaded Jedi")}catch(m){console.error("Failed to load Jedi:",m),I=void 0}}return{pyodide:n,micropip:w,jedi:I,initData:f}}async function $(o,c,f){const u=C(c,f);console.debug("Preparing the Streamlit environment");const{prepare:i}=o.pyimport("stlite_lib.bootstrap");i(u,[]),console.debug("Prepared the Streamlit environment"),console.debug("Booting up the Streamlit server");const t=o.pyimport("stlite_lib.server.Server")(u,c?H(c):void 0);return await t.start(),console.debug("Booted up the Streamlit server"),t}function B(o,c,f,u){function i(d){c({type:"event:progress",data:{message:d}})}const e=(d,r)=>{const l=new MessageChannel;c({type:"event:moduleAutoLoad",data:{packagesToLoad:d}},[l.port2]),r.then(g=>{l.port1.postMessage({type:"moduleAutoLoad:success",data:{loadedPackages:g}}),l.port1.close()}).catch(g=>{throw l.port1.postMessage({type:"moduleAutoLoad:error",error:g}),l.port1.close(),g})};let t=null,s=null;const a=async d=>{const r=d.data;if(r.type==="initData"){const n=r.data,p={...f,...n};console.debug("Initial data",p),t=fe(o,u,p,e,i),t.then(({pyodide:_})=>(i("Booting up the Streamlit server."),s=$(_,u,p.entrypoint),s)).then(()=>{c({type:"event:loaded"})}).catch(_=>{console.error(_),c({type:"event:error",data:{error:_}})});return}if(!t)throw new Error("Pyodide initialization has not been started yet.");if(!s)throw new Error("Streamlit server has not been started yet.");const l=await t,g=l.pyodide,S=l.micropip,v=l.jedi,{moduleAutoLoad:h}=l.initData,P=await s,R=d.ports[0];function b(n){R.postMessage(n)}try{switch(r.type){case"reboot":{console.debug("Reboot the Streamlit server",r.data);const{entrypoint:n}=r.data;P.stop(),console.debug("Booting up the Streamlit server"),s=$(g,u,n),await s,console.debug("Booted up the Streamlit server"),b({type:"reply"});break}case"websocket:connect":{console.debug("websocket:connect",r.data);const{path:n}=r.data;P.start_websocket(n,(p,_)=>{if(_){const w=p;try{const F=w.toJs(),L=F.buffer.slice(F.byteOffset,F.byteOffset+F.byteLength);c({type:"websocket:message",data:{payload:L}},[L])}finally{w.destroy()}}else c({type:"websocket:message",data:{payload:p}})}),b({type:"reply"});break}case"websocket:send":{console.debug("websocket:send",r.data);const{payload:n}=r.data;P.receive_websocket_from_js(n);break}case"http:request":{console.debug("http:request",r.data);const{request:n}=r.data,p=(_,w,F)=>{const L=new Map(w.toJs()),E=F.toJs();console.debug({statusCode:_,headers:L,body:E}),b({type:"http:response",data:{response:{statusCode:_,headers:L,body:E}}})};P.receive_http_from_js(n.method,decodeURIComponent(n.path),n.headers,n.body,p);break}case"file:write":{const{path:n,data:p,opts:_}=r.data,w=C(u,n);h&&typeof p=="string"&&w.endsWith(".py")&&(console.debug(`Auto install the requirements in ${w}`),J(g,e,[p])),console.debug(`Write a file "${w}"`),W(g,w,p,_),b({type:"reply"});break}case"file:rename":{const{oldPath:n,newPath:p}=r.data,_=C(u,n),w=C(u,p);console.debug(`Rename "${_}" to ${w}`),te(g,_,w),b({type:"reply"});break}case"file:unlink":{const{path:n}=r.data,p=C(u,n);console.debug(`Remove "${p}`),g.FS.unlink(p),b({type:"reply"});break}case"file:read":{const{path:n,opts:p}=r.data;console.debug(`Read "${n}"`);const _=g.FS.readFile(n,p);b({type:"reply:file:read",data:{content:_}});break}case"install":{const{requirements:n,options:p}=r.data,_=q(n);console.debug("Install the requirements:",_),await S.install.callKwargs(_,p??{}).then(()=>{console.debug("Successfully installed"),b({type:"reply"})});break}case"setEnv":{const{env:n}=r.data;g.pyimport("os").environ.update(g.toPy(n)),console.debug("Successfully set the environment variables",n),b({type:"reply"});break}case"code_completion":{if(!v)throw new Error("Jedi is not installed");const{code:n,line:p,column:_}=r.data,w=await ge(v,n,{line:p,column:_});b({type:"reply:code_completion",data:{codeCompletions:w}});break}}}catch(n){if(console.error(n),!(n instanceof Error))throw n;const p=new Error(n.message);p.name=n.name,p.stack=n.stack,b({type:"reply",error:p})}};return c({type:"event:start"}),a}const x="abcdefghijklmnopqrstuvwxyz",me=x.length;function pe(o){let c="";for(let f=0;f<o;f++){const u=Math.floor(Math.random()*me);c+=x[u]}return c}const U="https://cdn.jsdelivr.net/pyodide/v0.28.2/full/pyodide.mjs";if("postMessage"in self)self.onmessage=B(U,(o,c)=>c?self.postMessage(o,c):self.postMessage(o));else{const o=[];self.onconnect=c=>{let f;do f=pe(4);while(o.includes(f));o.push(f),console.debug("SharedWorker mode.",{appId:f});const u=c.ports[0];u.onmessage=B(U,(i,e)=>e?u.postMessage(i,e):u.postMessage(i),void 0,f),u.start()}}var D=Object.freeze({__proto__:null});
105
+ __setup_script_finished_callback__`))(y),console.debug("Set up the IndexedDB filesystem synchronizer")}console.debug("Setting up the Streamlit configuration");const{load_config_options:G}=n.pyimport("stlite_lib.bootstrap"),X={"browser.gatherUsageStats":!1,...g,"runner.fastReruns":!1},Q=c!=null;G(n.toPy(X),Q),console.debug("Set up the Streamlit configuration");let T;if(R){i("Loading auto-completion engine."),console.debug("Loading Jedi");try{T=await n.pyimport("jedi"),console.debug("Loaded Jedi")}catch(m){console.error("Failed to load Jedi:",m),T=void 0}}return{pyodide:n,micropip:w,jedi:T,initData:f}}async function $(o,c,f){const u=C(c,f);console.debug("Preparing the Streamlit environment");const{prepare:i}=o.pyimport("stlite_lib.bootstrap");i(u,[]),console.debug("Prepared the Streamlit environment"),console.debug("Booting up the Streamlit server");const t=o.pyimport("stlite_lib.server.Server")(u,c?H(c):void 0);return await t.start(),console.debug("Booted up the Streamlit server"),t}function B(o,c,f,u){function i(d){c({type:"event:loadProgress",data:{message:d}})}const e=(d,r)=>{const l=new MessageChannel;c({type:"event:moduleAutoLoad",data:{packagesToLoad:d}},[l.port2]),r.then(g=>{l.port1.postMessage({type:"moduleAutoLoad:success",data:{loadedPackages:g}}),l.port1.close()}).catch(g=>{throw l.port1.postMessage({type:"moduleAutoLoad:error",error:g}),l.port1.close(),g})};let t=null,s=null;const a=async d=>{const r=d.data;if(r.type==="initData"){const n=r.data,p={...f,...n};console.debug("Initial data",p),t=fe(o,u,p,e,i),t.then(({pyodide:h})=>(i("Booting up the Streamlit server."),s=$(h,u,p.entrypoint),s)).then(()=>{c({type:"event:loadFinished"})}).catch(h=>{console.error(h),c({type:"event:loadError",data:{error:h}})});return}if(!t)throw new Error("Pyodide initialization has not been started yet.");if(!s)throw new Error("Streamlit server has not been started yet.");const l=await t,g=l.pyodide,S=l.micropip,v=l.jedi,{moduleAutoLoad:_}=l.initData,P=await s,R=d.ports[0];function b(n){R.postMessage(n)}try{switch(r.type){case"reboot":{console.debug("Reboot the Streamlit server",r.data);const{entrypoint:n}=r.data;P.stop(),console.debug("Booting up the Streamlit server"),s=$(g,u,n),await s,console.debug("Booted up the Streamlit server"),b({type:"reply"});break}case"websocket:connect":{console.debug("websocket:connect",r.data);const{path:n}=r.data;P.start_websocket(n,(p,h)=>{if(h){const w=p;try{const F=w.toJs(),L=F.buffer.slice(F.byteOffset,F.byteOffset+F.byteLength);c({type:"websocket:message",data:{payload:L}},[L])}finally{w.destroy()}}else c({type:"websocket:message",data:{payload:p}})}),b({type:"reply"});break}case"websocket:send":{console.debug("websocket:send",r.data);const{payload:n}=r.data;P.receive_websocket_from_js(n);break}case"http:request":{console.debug("http:request",r.data);const{request:n}=r.data,p=(h,w,F)=>{const L=new Map(w.toJs()),E=F.toJs();console.debug({statusCode:h,headers:L,body:E}),b({type:"http:response",data:{response:{statusCode:h,headers:L,body:E}}})};P.receive_http_from_js(n.method,decodeURIComponent(n.path),n.headers,n.body,p);break}case"file:write":{const{path:n,data:p,opts:h}=r.data,w=C(u,n);_&&typeof p=="string"&&w.endsWith(".py")&&(console.debug(`Auto install the requirements in ${w}`),W(g,e,[p])),console.debug(`Write a file "${w}"`),N(g,w,p,h),b({type:"reply"});break}case"file:rename":{const{oldPath:n,newPath:p}=r.data,h=C(u,n),w=C(u,p);console.debug(`Rename "${h}" to ${w}`),te(g,h,w),b({type:"reply"});break}case"file:unlink":{const{path:n}=r.data,p=C(u,n);console.debug(`Remove "${p}`),g.FS.unlink(p),b({type:"reply"});break}case"file:read":{const{path:n,opts:p}=r.data;console.debug(`Read "${n}"`);const h=g.FS.readFile(n,p);b({type:"reply:file:read",data:{content:h}});break}case"install":{const{requirements:n,options:p}=r.data,h=q(n);console.debug("Install the requirements:",h),await S.install.callKwargs(h,p??{}).then(()=>{console.debug("Successfully installed"),b({type:"reply"})});break}case"setEnv":{const{env:n}=r.data;g.pyimport("os").environ.update(g.toPy(n)),console.debug("Successfully set the environment variables",n),b({type:"reply"});break}case"code_completion":{if(!v)throw new Error("Jedi is not installed");const{code:n,line:p,column:h}=r.data,w=await ge(v,n,{line:p,column:h});b({type:"reply:code_completion",data:{codeCompletions:w}});break}case"run_python":{const{code:n}=r.data;console.debug("Run python code",n);const p=await g.runPythonAsync(n);let h;p instanceof g.ffi.PyProxy?(console.debug("The result is a PyProxy object"),h=p.toJs(),p.destroy(),console.debug("Converted the result to a JS object",h)):(h=p,console.debug("The result is a JS primitive",h)),b({type:"reply:run_python",data:{result:h}});break}}}catch(n){if(console.error(n),!(n instanceof Error))throw n;const p=new Error(n.message);p.name=n.name,p.stack=n.stack,b({type:"reply",error:p})}};return c({type:"event:envSetup"}),a}const x="abcdefghijklmnopqrstuvwxyz",me=x.length;function pe(o){let c="";for(let f=0;f<o;f++){const u=Math.floor(Math.random()*me);c+=x[u]}return c}const U="https://cdn.jsdelivr.net/pyodide/v0.28.2/full/pyodide.mjs";if("postMessage"in self)self.onmessage=B(U,(o,c)=>c?self.postMessage(o,c):self.postMessage(o));else{const o=[];self.onconnect=c=>{let f;do f=pe(4);while(o.includes(f));o.push(f),console.debug("SharedWorker mode.",{appId:f});const u=c.ports[0];u.onmessage=B(U,(i,e)=>e?u.postMessage(i,e):u.postMessage(i),void 0,f),u.start()}}var D=Object.freeze({__proto__:null});
@@ -1,4 +1,4 @@
1
- var ie=Object.create;var H=Object.defineProperty;var ae=Object.getOwnPropertyDescriptor;var le=Object.getOwnPropertyNames;var de=Object.getPrototypeOf,ce=Object.prototype.hasOwnProperty;var ue=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports);var ge=(r,e,t,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of le(e))!ce.call(r,n)&&n!==t&&H(r,n,{get:()=>e[n],enumerable:!(o=ae(e,n))||o.enumerable});return r};var O=(r,e,t)=>(t=r!=null?ie(de(r)):{},ge(e||!r||!r.__esModule?H(t,"default",{value:r,enumerable:!0}):t,r));var J=ue((ke,j)=>{"use strict";function S(r){if(typeof r!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(r))}function B(r,e){for(var t="",o=0,n=-1,a=0,s,l=0;l<=r.length;++l){if(l<r.length)s=r.charCodeAt(l);else{if(s===47)break;s=47}if(s===47){if(!(n===l-1||a===1))if(n!==l-1&&a===2){if(t.length<2||o!==2||t.charCodeAt(t.length-1)!==46||t.charCodeAt(t.length-2)!==46){if(t.length>2){var c=t.lastIndexOf("/");if(c!==t.length-1){c===-1?(t="",o=0):(t=t.slice(0,c),o=t.length-1-t.lastIndexOf("/")),n=l,a=0;continue}}else if(t.length===2||t.length===1){t="",o=0,n=l,a=0;continue}}e&&(t.length>0?t+="/..":t="..",o=2)}else t.length>0?t+="/"+r.slice(n+1,l):t=r.slice(n+1,l),o=l-n-1;n=l,a=0}else s===46&&a!==-1?++a:a=-1}return t}function fe(r,e){var t=e.dir||e.root,o=e.base||(e.name||"")+(e.ext||"");return t?t===e.root?t+o:t+r+o:o}var M={resolve:function(){for(var e="",t=!1,o,n=arguments.length-1;n>=-1&&!t;n--){var a;n>=0?a=arguments[n]:(o===void 0&&(o=process.cwd()),a=o),S(a),a.length!==0&&(e=a+"/"+e,t=a.charCodeAt(0)===47)}return e=B(e,!t),t?e.length>0?"/"+e:"/":e.length>0?e:"."},normalize:function(e){if(S(e),e.length===0)return".";var t=e.charCodeAt(0)===47,o=e.charCodeAt(e.length-1)===47;return e=B(e,!t),e.length===0&&!t&&(e="."),e.length>0&&o&&(e+="/"),t?"/"+e:e},isAbsolute:function(e){return S(e),e.length>0&&e.charCodeAt(0)===47},join:function(){if(arguments.length===0)return".";for(var e,t=0;t<arguments.length;++t){var o=arguments[t];S(o),o.length>0&&(e===void 0?e=o:e+="/"+o)}return e===void 0?".":M.normalize(e)},relative:function(e,t){if(S(e),S(t),e===t||(e=M.resolve(e),t=M.resolve(t),e===t))return"";for(var o=1;o<e.length&&e.charCodeAt(o)===47;++o);for(var n=e.length,a=n-o,s=1;s<t.length&&t.charCodeAt(s)===47;++s);for(var l=t.length,c=l-s,m=a<c?a:c,d=-1,g=0;g<=m;++g){if(g===m){if(c>m){if(t.charCodeAt(s+g)===47)return t.slice(s+g+1);if(g===0)return t.slice(s+g)}else a>m&&(e.charCodeAt(o+g)===47?d=g:g===0&&(d=0));break}var _=e.charCodeAt(o+g),L=t.charCodeAt(s+g);if(_!==L)break;_===47&&(d=g)}var P="";for(g=o+d+1;g<=n;++g)(g===n||e.charCodeAt(g)===47)&&(P.length===0?P+="..":P+="/..");return P.length>0?P+t.slice(s+d):(s+=d,t.charCodeAt(s)===47&&++s,t.slice(s))},_makeLong:function(e){return e},dirname:function(e){if(S(e),e.length===0)return".";for(var t=e.charCodeAt(0),o=t===47,n=-1,a=!0,s=e.length-1;s>=1;--s)if(t=e.charCodeAt(s),t===47){if(!a){n=s;break}}else a=!1;return n===-1?o?"/":".":o&&n===1?"//":e.slice(0,n)},basename:function(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');S(e);var o=0,n=-1,a=!0,s;if(t!==void 0&&t.length>0&&t.length<=e.length){if(t.length===e.length&&t===e)return"";var l=t.length-1,c=-1;for(s=e.length-1;s>=0;--s){var m=e.charCodeAt(s);if(m===47){if(!a){o=s+1;break}}else c===-1&&(a=!1,c=s+1),l>=0&&(m===t.charCodeAt(l)?--l===-1&&(n=s):(l=-1,n=c))}return o===n?n=c:n===-1&&(n=e.length),e.slice(o,n)}else{for(s=e.length-1;s>=0;--s)if(e.charCodeAt(s)===47){if(!a){o=s+1;break}}else n===-1&&(a=!1,n=s+1);return n===-1?"":e.slice(o,n)}},extname:function(e){S(e);for(var t=-1,o=0,n=-1,a=!0,s=0,l=e.length-1;l>=0;--l){var c=e.charCodeAt(l);if(c===47){if(!a){o=l+1;break}continue}n===-1&&(a=!1,n=l+1),c===46?t===-1?t=l:s!==1&&(s=1):t!==-1&&(s=-1)}return t===-1||n===-1||s===0||s===1&&t===n-1&&t===o+1?"":e.slice(t,n)},format:function(e){if(e===null||typeof e!="object")throw new TypeError('The "pathObject" argument must be of type Object. Received type '+typeof e);return fe("/",e)},parse:function(e){S(e);var t={root:"",dir:"",base:"",ext:"",name:""};if(e.length===0)return t;var o=e.charCodeAt(0),n=o===47,a;n?(t.root="/",a=1):a=0;for(var s=-1,l=0,c=-1,m=!0,d=e.length-1,g=0;d>=a;--d){if(o=e.charCodeAt(d),o===47){if(!m){l=d+1;break}continue}c===-1&&(m=!1,c=d+1),o===46?s===-1?s=d:g!==1&&(g=1):s!==-1&&(g=-1)}return s===-1||c===-1||g===0||g===1&&s===c-1&&s===l+1?c!==-1&&(l===0&&n?t.base=t.name=e.slice(1,c):t.base=t.name=e.slice(l,c)):(l===0&&n?(t.name=e.slice(1,s),t.base=e.slice(1,c)):(t.name=e.slice(l,s),t.base=e.slice(l,c)),t.ext=e.slice(s,c)),l>0?t.dir=e.slice(0,l-1):n&&(t.dir="/"),t},sep:"/",delimiter:":",win32:null,posix:null};M.posix=M;j.exports=M});var q=require("node:worker_threads");var C=O(J(),1),z="/home/pyodide",x=r=>`${z}/${r}`,R=(r,e)=>r==null?C.default.resolve(z,e):C.default.resolve(x(r),e);function K(r,e){let t=C.default.normalize(e),n=C.default.dirname(t).split(/(?=\/)/),a="";for(let s of n){a+=s;let l=r.FS.analyzePath(a);if(l.exists&&l.object){if(!r.FS.isDir(l.object.mode))throw new Error(`"${a}" already exists and is not a directory.`);continue}try{r.FS.mkdir(a)}catch(c){throw console.error(`Failed to create a directory "${a}"`),c}}}function U(r,e,t,o){K(r,e),r.FS.writeFile(e,t,o)}function V(r,e,t){K(r,t),r.FS.rename(e,t)}var me="(<=>!~";var pe=new RegExp(`[${"["+me+";@"}]`);function ye(r){return r.split(pe)[0].trim()}function T(r){return r.forEach(t=>{let o;try{o=new URL(t)}catch{return}if(o.protocol==="emfs:"||o.protocol==="file:")throw new Error(`"emfs:" and "file:" protocols are not allowed for the requirement (${t})`)}),r.filter(t=>ye(t)==="streamlit"?(console.warn(`Streamlit is specified in the requirements ("${t}"), but it will be ignored. A built-in version of Streamlit will be used.`),!1):!0)}async function _e(r){let e=typeof process<"u"&&process.versions?.node,t;e?t=(await import("node:path")).sep:t="/";let o=r.slice(0,r.lastIndexOf(t)+1);if(r.endsWith(".mjs")){if(e){let n=await import("node:path"),a=await import("node:url");!r.includes("://")&&n.isAbsolute(r)&&(r=a.pathToFileURL(r).href)}return{scriptURL:r,pyodideIndexURL:o,isESModule:!0}}else return{scriptURL:r,pyodideIndexURL:o,isESModule:!1}}async function X(r,e){let{scriptURL:t,pyodideIndexURL:o,isESModule:n}=await _e(r),a;return n?a=(await import(t)).loadPyodide:(importScripts(t),a=self.loadPyodide),a({...e,indexURL:o})}function G(r){r.runPython(`
1
+ var ie=Object.create;var q=Object.defineProperty;var ae=Object.getOwnPropertyDescriptor;var le=Object.getOwnPropertyNames;var de=Object.getPrototypeOf,ce=Object.prototype.hasOwnProperty;var ue=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports);var ge=(r,e,t,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of le(e))!ce.call(r,n)&&n!==t&&q(r,n,{get:()=>e[n],enumerable:!(o=ae(e,n))||o.enumerable});return r};var O=(r,e,t)=>(t=r!=null?ie(de(r)):{},ge(e||!r||!r.__esModule?q(t,"default",{value:r,enumerable:!0}):t,r));var B=ue((ke,J)=>{"use strict";function S(r){if(typeof r!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(r))}function H(r,e){for(var t="",o=0,n=-1,a=0,s,l=0;l<=r.length;++l){if(l<r.length)s=r.charCodeAt(l);else{if(s===47)break;s=47}if(s===47){if(!(n===l-1||a===1))if(n!==l-1&&a===2){if(t.length<2||o!==2||t.charCodeAt(t.length-1)!==46||t.charCodeAt(t.length-2)!==46){if(t.length>2){var c=t.lastIndexOf("/");if(c!==t.length-1){c===-1?(t="",o=0):(t=t.slice(0,c),o=t.length-1-t.lastIndexOf("/")),n=l,a=0;continue}}else if(t.length===2||t.length===1){t="",o=0,n=l,a=0;continue}}e&&(t.length>0?t+="/..":t="..",o=2)}else t.length>0?t+="/"+r.slice(n+1,l):t=r.slice(n+1,l),o=l-n-1;n=l,a=0}else s===46&&a!==-1?++a:a=-1}return t}function fe(r,e){var t=e.dir||e.root,o=e.base||(e.name||"")+(e.ext||"");return t?t===e.root?t+o:t+r+o:o}var C={resolve:function(){for(var e="",t=!1,o,n=arguments.length-1;n>=-1&&!t;n--){var a;n>=0?a=arguments[n]:(o===void 0&&(o=process.cwd()),a=o),S(a),a.length!==0&&(e=a+"/"+e,t=a.charCodeAt(0)===47)}return e=H(e,!t),t?e.length>0?"/"+e:"/":e.length>0?e:"."},normalize:function(e){if(S(e),e.length===0)return".";var t=e.charCodeAt(0)===47,o=e.charCodeAt(e.length-1)===47;return e=H(e,!t),e.length===0&&!t&&(e="."),e.length>0&&o&&(e+="/"),t?"/"+e:e},isAbsolute:function(e){return S(e),e.length>0&&e.charCodeAt(0)===47},join:function(){if(arguments.length===0)return".";for(var e,t=0;t<arguments.length;++t){var o=arguments[t];S(o),o.length>0&&(e===void 0?e=o:e+="/"+o)}return e===void 0?".":C.normalize(e)},relative:function(e,t){if(S(e),S(t),e===t||(e=C.resolve(e),t=C.resolve(t),e===t))return"";for(var o=1;o<e.length&&e.charCodeAt(o)===47;++o);for(var n=e.length,a=n-o,s=1;s<t.length&&t.charCodeAt(s)===47;++s);for(var l=t.length,c=l-s,p=a<c?a:c,d=-1,g=0;g<=p;++g){if(g===p){if(c>p){if(t.charCodeAt(s+g)===47)return t.slice(s+g+1);if(g===0)return t.slice(s+g)}else a>p&&(e.charCodeAt(o+g)===47?d=g:g===0&&(d=0));break}var h=e.charCodeAt(o+g),L=t.charCodeAt(s+g);if(h!==L)break;h===47&&(d=g)}var P="";for(g=o+d+1;g<=n;++g)(g===n||e.charCodeAt(g)===47)&&(P.length===0?P+="..":P+="/..");return P.length>0?P+t.slice(s+d):(s+=d,t.charCodeAt(s)===47&&++s,t.slice(s))},_makeLong:function(e){return e},dirname:function(e){if(S(e),e.length===0)return".";for(var t=e.charCodeAt(0),o=t===47,n=-1,a=!0,s=e.length-1;s>=1;--s)if(t=e.charCodeAt(s),t===47){if(!a){n=s;break}}else a=!1;return n===-1?o?"/":".":o&&n===1?"//":e.slice(0,n)},basename:function(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');S(e);var o=0,n=-1,a=!0,s;if(t!==void 0&&t.length>0&&t.length<=e.length){if(t.length===e.length&&t===e)return"";var l=t.length-1,c=-1;for(s=e.length-1;s>=0;--s){var p=e.charCodeAt(s);if(p===47){if(!a){o=s+1;break}}else c===-1&&(a=!1,c=s+1),l>=0&&(p===t.charCodeAt(l)?--l===-1&&(n=s):(l=-1,n=c))}return o===n?n=c:n===-1&&(n=e.length),e.slice(o,n)}else{for(s=e.length-1;s>=0;--s)if(e.charCodeAt(s)===47){if(!a){o=s+1;break}}else n===-1&&(a=!1,n=s+1);return n===-1?"":e.slice(o,n)}},extname:function(e){S(e);for(var t=-1,o=0,n=-1,a=!0,s=0,l=e.length-1;l>=0;--l){var c=e.charCodeAt(l);if(c===47){if(!a){o=l+1;break}continue}n===-1&&(a=!1,n=l+1),c===46?t===-1?t=l:s!==1&&(s=1):t!==-1&&(s=-1)}return t===-1||n===-1||s===0||s===1&&t===n-1&&t===o+1?"":e.slice(t,n)},format:function(e){if(e===null||typeof e!="object")throw new TypeError('The "pathObject" argument must be of type Object. Received type '+typeof e);return fe("/",e)},parse:function(e){S(e);var t={root:"",dir:"",base:"",ext:"",name:""};if(e.length===0)return t;var o=e.charCodeAt(0),n=o===47,a;n?(t.root="/",a=1):a=0;for(var s=-1,l=0,c=-1,p=!0,d=e.length-1,g=0;d>=a;--d){if(o=e.charCodeAt(d),o===47){if(!p){l=d+1;break}continue}c===-1&&(p=!1,c=d+1),o===46?s===-1?s=d:g!==1&&(g=1):s!==-1&&(g=-1)}return s===-1||c===-1||g===0||g===1&&s===c-1&&s===l+1?c!==-1&&(l===0&&n?t.base=t.name=e.slice(1,c):t.base=t.name=e.slice(l,c)):(l===0&&n?(t.name=e.slice(1,s),t.base=e.slice(1,c)):(t.name=e.slice(l,s),t.base=e.slice(l,c)),t.ext=e.slice(s,c)),l>0?t.dir=e.slice(0,l-1):n&&(t.dir="/"),t},sep:"/",delimiter:":",win32:null,posix:null};C.posix=C;J.exports=C});var j=require("node:worker_threads");var M=O(B(),1),z="/home/pyodide",N=r=>`${z}/${r}`,R=(r,e)=>r==null?M.default.resolve(z,e):M.default.resolve(N(r),e);function K(r,e){let t=M.default.normalize(e),n=M.default.dirname(t).split(/(?=\/)/),a="";for(let s of n){a+=s;let l=r.FS.analyzePath(a);if(l.exists&&l.object){if(!r.FS.isDir(l.object.mode))throw new Error(`"${a}" already exists and is not a directory.`);continue}try{r.FS.mkdir(a)}catch(c){throw console.error(`Failed to create a directory "${a}"`),c}}}function U(r,e,t,o){K(r,e),r.FS.writeFile(e,t,o)}function V(r,e,t){K(r,t),r.FS.rename(e,t)}var me="(<=>!~";var pe=new RegExp(`[${"["+me+";@"}]`);function ye(r){return r.split(pe)[0].trim()}function T(r){return r.forEach(t=>{let o;try{o=new URL(t)}catch{return}if(o.protocol==="emfs:"||o.protocol==="file:")throw new Error(`"emfs:" and "file:" protocols are not allowed for the requirement (${t})`)}),r.filter(t=>ye(t)==="streamlit"?(console.warn(`Streamlit is specified in the requirements ("${t}"), but it will be ignored. A built-in version of Streamlit will be used.`),!1):!0)}async function he(r){let e=typeof process<"u"&&process.versions?.node,t;e?t=(await import("node:path")).sep:t="/";let o=r.slice(0,r.lastIndexOf(t)+1);if(r.endsWith(".mjs")){if(e){let n=await import("node:path"),a=await import("node:url");!r.includes("://")&&n.isAbsolute(r)&&(r=a.pathToFileURL(r).href)}return{scriptURL:r,pyodideIndexURL:o,isESModule:!0}}else return{scriptURL:r,pyodideIndexURL:o,isESModule:!1}}async function X(r,e){let{scriptURL:t,pyodideIndexURL:o,isESModule:n}=await he(r),a;return n?a=(await import(t)).loadPyodide:(importScripts(t),a=self.loadPyodide),a({...e,indexURL:o})}function G(r){r.runPython(`
2
2
  import micropip
3
3
  micropip.add_mock_package(
4
4
  "pyarrow", "0.0.1",
@@ -24,12 +24,12 @@ class ChunkedArray:
24
24
  """
25
25
  }
26
26
  )
27
- `)}function he(r,e,t){let o=r.pyimport("pyodide"),n=d=>o.code.find_imports(d).toJs(),a=t.map(d=>n(d)),c=Array.from(new Set(a.flat())).filter(d=>!r.runPython(`__import__('importlib').util.find_spec('${d}')`)).map(d=>r._api._import_name_to_package_name.get(d)).filter(d=>d);if(c.length===0)return Promise.resolve();let m=r.loadPackage(c);return e(c,m),m.then()}function W(r,e,t){let o=he(r,e,t);r.runPython(`
27
+ `)}function _e(r,e,t){let o=r.pyimport("pyodide"),n=d=>o.code.find_imports(d).toJs(),a=t.map(d=>n(d)),c=Array.from(new Set(a.flat())).filter(d=>!r.runPython(`__import__('importlib').util.find_spec('${d}')`)).map(d=>r._api._import_name_to_package_name.get(d)).filter(d=>d);if(c.length===0)return Promise.resolve();let p=r.loadPackage(c);return e(c,p),p.then()}function W(r,e,t){let o=_e(r,e,t);r.runPython(`
28
28
  def __set_module_auto_load_promise__(promise):
29
29
  from streamlit.runtime.scriptrunner import script_runner
30
30
  script_runner.moduleAutoLoadPromise = promise
31
31
 
32
- __set_module_auto_load_promise__`)(o)}async function Q(r,e,t){let{line:o,column:n}=t,a=r.Script(e);if(o>a._code_lines.length)return[];let s=a.complete.callKwargs({line:o,column:n,fuzzy:!1}),l=[];for(let c of s.toJs())l.push({name:c.name,type:c.$type,docstring:c.docstring.callKwargs({raw:!0}),complete:c.complete}),c.destroy();return l}var $=null;async function be(r,e,t,o,n){let{files:a,archives:s,requirements:l,prebuiltPackageNames:c,wheels:m,installs:d,pyodideUrl:g=r,streamlitConfig:_,idbfsMountpoints:L,nodefsMountpoints:P,moduleAutoLoad:D,env:w,languageServer:E}=t,b=T(l);if($)n("Pyodide is already loaded."),console.debug("Pyodide is already loaded.");else{n("Loading Pyodide."),console.debug("Loading Pyodide."),$=X(g,{stdout:console.log,stderr:console.error});let u=[];m&&(u.push(m.streamlit),u.push(m.stliteLib)),E&&u.push("jedi"),b.unshift(...u),console.debug("Loaded Pyodide")}let i=await $;if(w){console.debug("Setting environment variables",w);let u=i.pyimport("os");u.environ.update(i.toPy(w)),console.debug("Set environment variables",u.environ)}let f=!1;L&&(f=!0,L.forEach(u=>{i.FS.mkdir(u),i.FS.mount(i.FS.filesystems.IDBFS,{},u)}),await new Promise((u,y)=>{i.FS.syncfs(!0,v=>{v?y(v):u()})})),P&&Object.entries(P).forEach(([u,y])=>{i.FS.mkdir(u),i.FS.mount(i.FS.filesystems.NODEFS,{root:y},u)}),n("Mounting files.");let p=[];await Promise.all(Object.keys(a).map(async u=>{let y=a[u];u=R(e,u);let v;"url"in y?(console.debug(`Fetch a file from ${y.url}`),v=await fetch(y.url).then(k=>k.arrayBuffer()).then(k=>new Uint8Array(k))):v=y.data,console.debug(`Write a file "${u}"`),U(i,u,v,a.opts),u.endsWith(".py")&&p.push(u)})),n("Unpacking archives."),await Promise.all(s.map(async u=>{let y;"url"in u?(console.debug(`Fetch an archive from ${u.url}`),y=await fetch(u.url).then(se=>se.arrayBuffer())):y=u.buffer;let{format:v,options:k}=u;console.debug("Unpack an archive",{format:v,options:k}),i.unpackArchive(y,v,k)})),await i.loadPackage("micropip");let h=i.pyimport("micropip");if(n("Mocking some packages."),console.debug("Mock pyarrow"),G(i),console.debug("Mocked pyarrow"),n("Installing packages."),console.debug("Installing the prebuilt packages:",c),await i.loadPackage(c),console.debug("Installed the prebuilt packages"),console.debug("Installing the requirements:",b),await h.install.callKwargs(b,{keep_going:!0}),console.debug("Installed the requirements"),d&&(console.debug("Installing the additional requirements"),await Promise.all(d.map(({requirements:u,options:y})=>{let v=T(u);return console.debug("Installing the requirements:",v),h.install.callKwargs(v,y??{})}))),D){let u=p.map(y=>i.FS.readFile(y,{encoding:"utf8"}));W(i,o,u)}await i.runPythonAsync(`
32
+ __set_module_auto_load_promise__`)(o)}async function Q(r,e,t){let{line:o,column:n}=t,a=r.Script(e);if(o>a._code_lines.length)return[];let s=a.complete.callKwargs({line:o,column:n,fuzzy:!1}),l=[];for(let c of s.toJs())l.push({name:c.name,type:c.$type,docstring:c.docstring.callKwargs({raw:!0}),complete:c.complete}),c.destroy();return l}var $=null;async function be(r,e,t,o,n){let{files:a,archives:s,requirements:l,prebuiltPackageNames:c,wheels:p,installs:d,pyodideUrl:g=r,streamlitConfig:h,idbfsMountpoints:L,nodefsMountpoints:P,moduleAutoLoad:x,env:w,languageServer:E}=t,b=T(l);if($)n("Pyodide is already loaded."),console.debug("Pyodide is already loaded.");else{n("Loading Pyodide."),console.debug("Loading Pyodide."),$=X(g,{stdout:console.log,stderr:console.error});let u=[];p&&(u.push(p.streamlit),u.push(p.stliteLib)),E&&u.push("jedi"),b.unshift(...u),console.debug("Loaded Pyodide")}let i=await $;if(w){console.debug("Setting environment variables",w);let u=i.pyimport("os");u.environ.update(i.toPy(w)),console.debug("Set environment variables",u.environ)}let f=!1;L&&(f=!0,L.forEach(u=>{i.FS.mkdir(u),i.FS.mount(i.FS.filesystems.IDBFS,{},u)}),await new Promise((u,y)=>{i.FS.syncfs(!0,v=>{v?y(v):u()})})),P&&Object.entries(P).forEach(([u,y])=>{i.FS.mkdir(u),i.FS.mount(i.FS.filesystems.NODEFS,{root:y},u)}),n("Mounting files.");let m=[];await Promise.all(Object.keys(a).map(async u=>{let y=a[u];u=R(e,u);let v;"url"in y?(console.debug(`Fetch a file from ${y.url}`),v=await fetch(y.url).then(k=>k.arrayBuffer()).then(k=>new Uint8Array(k))):v=y.data,console.debug(`Write a file "${u}"`),U(i,u,v,a.opts),u.endsWith(".py")&&m.push(u)})),n("Unpacking archives."),await Promise.all(s.map(async u=>{let y;"url"in u?(console.debug(`Fetch an archive from ${u.url}`),y=await fetch(u.url).then(se=>se.arrayBuffer())):y=u.buffer;let{format:v,options:k}=u;console.debug("Unpack an archive",{format:v,options:k}),i.unpackArchive(y,v,k)})),await i.loadPackage("micropip");let _=i.pyimport("micropip");if(n("Mocking some packages."),console.debug("Mock pyarrow"),G(i),console.debug("Mocked pyarrow"),n("Installing packages."),console.debug("Installing the prebuilt packages:",c),await i.loadPackage(c),console.debug("Installed the prebuilt packages"),console.debug("Installing the requirements:",b),await _.install.callKwargs(b,{keep_going:!0}),console.debug("Installed the requirements"),d&&(console.debug("Installing the additional requirements"),await Promise.all(d.map(({requirements:u,options:y})=>{let v=T(u);return console.debug("Installing the requirements:",v),_.install.callKwargs(v,y??{})}))),x){let u=m.map(y=>i.FS.readFile(y,{encoding:"utf8"}));W(i,o,u)}await i.runPythonAsync(`
33
33
  import importlib
34
34
  importlib.invalidate_caches()
35
35
  `),n("Loading streamlit package."),console.debug("Loading the Streamlit package"),await i.runPythonAsync(`
@@ -79,7 +79,7 @@ def __setup_loggers__(streamlit_level, streamlit_message_format, callback):
79
79
  streamlit_logger.addHandler(streamlit_handler)
80
80
  streamlit_logger.setLevel(streamlit_level.upper())
81
81
 
82
- __setup_loggers__`),I=(_?.["logger.level"]??"INFO").toString(),te=_?.["logger.messageFormat"]??"%(asctime)s %(message)s";if(F(I,te,A),console.debug("Set the loggers"),n("Mocking some Streamlit functions for the browser environment."),console.debug("Mocking some Streamlit functions"),await i.runPythonAsync(`
82
+ __setup_loggers__`),I=(h?.["logger.level"]??"INFO").toString(),te=h?.["logger.messageFormat"]??"%(asctime)s %(message)s";if(F(I,te,A),console.debug("Set the loggers"),n("Mocking some Streamlit functions for the browser environment."),console.debug("Mocking some Streamlit functions"),await i.runPythonAsync(`
83
83
  import streamlit
84
84
 
85
85
  def is_cacheable_msg(msg):
@@ -102,4 +102,4 @@ def __setup_script_finished_callback__(callback):
102
102
 
103
103
  AppSession._on_scriptrunner_event = wrap_app_session_on_scriptrunner_event(AppSession._on_scriptrunner_event)
104
104
 
105
- __setup_script_finished_callback__`))(y),console.debug("Set up the IndexedDB filesystem synchronizer")}console.debug("Setting up the Streamlit configuration");let{load_config_options:re}=i.pyimport("stlite_lib.bootstrap"),oe={"browser.gatherUsageStats":!1,..._,"runner.fastReruns":!1},ne=e!=null;re(i.toPy(oe),ne),console.debug("Set up the Streamlit configuration");let N;if(E){n("Loading auto-completion engine."),console.debug("Loading Jedi");try{N=await i.pyimport("jedi"),console.debug("Loaded Jedi")}catch(u){console.error("Failed to load Jedi:",u),N=void 0}}return{pyodide:i,micropip:h,jedi:N,initData:t}}async function Y(r,e,t){let o=R(e,t);console.debug("Preparing the Streamlit environment");let{prepare:n}=r.pyimport("stlite_lib.bootstrap");n(o,[]),console.debug("Prepared the Streamlit environment"),console.debug("Booting up the Streamlit server");let s=r.pyimport("stlite_lib.server.Server")(o,e?x(e):void 0);return await s.start(),console.debug("Booted up the Streamlit server"),s}function Z(r,e,t,o){function n(m){e({type:"event:progress",data:{message:m}})}let a=(m,d)=>{let g=new MessageChannel;e({type:"event:moduleAutoLoad",data:{packagesToLoad:m}},[g.port2]),d.then(_=>{g.port1.postMessage({type:"moduleAutoLoad:success",data:{loadedPackages:_}}),g.port1.close()}).catch(_=>{throw g.port1.postMessage({type:"moduleAutoLoad:error",error:_}),g.port1.close(),_})},s=null,l=null,c=async m=>{let d=m.data;if(d.type==="initData"){let i=d.data,f={...t,...i};console.debug("Initial data",f),s=be(r,o,f,a,n),s.then(({pyodide:p})=>(n("Booting up the Streamlit server."),l=Y(p,o,f.entrypoint),l)).then(()=>{e({type:"event:loaded"})}).catch(p=>{console.error(p),e({type:"event:error",data:{error:p}})});return}if(!s)throw new Error("Pyodide initialization has not been started yet.");if(!l)throw new Error("Streamlit server has not been started yet.");let g=await s,_=g.pyodide,L=g.micropip,P=g.jedi,{moduleAutoLoad:D}=g.initData,w=await l,E=m.ports[0];function b(i){E.postMessage(i)}try{switch(d.type){case"reboot":{console.debug("Reboot the Streamlit server",d.data);let{entrypoint:i}=d.data;w.stop(),console.debug("Booting up the Streamlit server"),l=Y(_,o,i),await l,console.debug("Booted up the Streamlit server"),b({type:"reply"});break}case"websocket:connect":{console.debug("websocket:connect",d.data);let{path:i}=d.data;w.start_websocket(i,(f,p)=>{if(p){let h=f;try{let A=h.toJs(),F=A.buffer.slice(A.byteOffset,A.byteOffset+A.byteLength);e({type:"websocket:message",data:{payload:F}},[F])}finally{h.destroy()}}else e({type:"websocket:message",data:{payload:f}})}),b({type:"reply"});break}case"websocket:send":{console.debug("websocket:send",d.data);let{payload:i}=d.data;w.receive_websocket_from_js(i);break}case"http:request":{console.debug("http:request",d.data);let{request:i}=d.data,f=(p,h,A)=>{let F=new Map(h.toJs()),I=A.toJs();console.debug({statusCode:p,headers:F,body:I}),b({type:"http:response",data:{response:{statusCode:p,headers:F,body:I}}})};w.receive_http_from_js(i.method,decodeURIComponent(i.path),i.headers,i.body,f);break}case"file:write":{let{path:i,data:f,opts:p}=d.data,h=R(o,i);D&&typeof f=="string"&&h.endsWith(".py")&&(console.debug(`Auto install the requirements in ${h}`),W(_,a,[f])),console.debug(`Write a file "${h}"`),U(_,h,f,p),b({type:"reply"});break}case"file:rename":{let{oldPath:i,newPath:f}=d.data,p=R(o,i),h=R(o,f);console.debug(`Rename "${p}" to ${h}`),V(_,p,h),b({type:"reply"});break}case"file:unlink":{let{path:i}=d.data,f=R(o,i);console.debug(`Remove "${f}`),_.FS.unlink(f),b({type:"reply"});break}case"file:read":{let{path:i,opts:f}=d.data;console.debug(`Read "${i}"`);let p=_.FS.readFile(i,f);b({type:"reply:file:read",data:{content:p}});break}case"install":{let{requirements:i,options:f}=d.data,p=T(i);console.debug("Install the requirements:",p),await L.install.callKwargs(p,f??{}).then(()=>{console.debug("Successfully installed"),b({type:"reply"})});break}case"setEnv":{let{env:i}=d.data;_.pyimport("os").environ.update(_.toPy(i)),console.debug("Successfully set the environment variables",i),b({type:"reply"});break}case"code_completion":{if(!P)throw new Error("Jedi is not installed");let{code:i,line:f,column:p}=d.data,h=await Q(P,i,{line:f,column:p});b({type:"reply:code_completion",data:{codeCompletions:h}});break}}}catch(i){if(console.error(i),!(i instanceof Error))throw i;let f=new Error(i.message);f.name=i.name,f.stack=i.stack,b({type:"reply",error:f})}};return e({type:"event:start"}),c}function ee(){let r=process.env.NODEFS_MOUNTPOINTS;if(!r)return;let e;try{e=JSON.parse(r)}catch{console.error(`Failed to parse NODEFS_MOUNTPOINTS as JSON: ${r}`);return}if(typeof e!="object"){console.error(`NODEFS_MOUNTPOINTS is not an object: ${r}`);return}if(Array.isArray(e)){console.error(`NODEFS_MOUNTPOINTS is an array: ${r}`);return}if(Object.keys(e).some(t=>typeof t!="string")){console.error(`NODEFS_MOUNTPOINTS has non-string keys: ${r}`);return}if(Object.values(e).some(t=>typeof t!="string")){console.error(`NODEFS_MOUNTPOINTS has non-string values: ${r}`);return}return e}var ve=r=>{console.debug("[worker thread] postMessage from worker",r),q.parentPort?.postMessage(r)},Pe=Z(process.env.PYODIDE_URL,ve,{nodefsMountpoints:ee()});q.parentPort?.on("message",({data:r,port:e})=>{console.debug("[worker thread] parentPort.onMessage",{data:r,port:e}),Pe({data:r,ports:[e]})});
105
+ __setup_script_finished_callback__`))(y),console.debug("Set up the IndexedDB filesystem synchronizer")}console.debug("Setting up the Streamlit configuration");let{load_config_options:re}=i.pyimport("stlite_lib.bootstrap"),oe={"browser.gatherUsageStats":!1,...h,"runner.fastReruns":!1},ne=e!=null;re(i.toPy(oe),ne),console.debug("Set up the Streamlit configuration");let D;if(E){n("Loading auto-completion engine."),console.debug("Loading Jedi");try{D=await i.pyimport("jedi"),console.debug("Loaded Jedi")}catch(u){console.error("Failed to load Jedi:",u),D=void 0}}return{pyodide:i,micropip:_,jedi:D,initData:t}}async function Y(r,e,t){let o=R(e,t);console.debug("Preparing the Streamlit environment");let{prepare:n}=r.pyimport("stlite_lib.bootstrap");n(o,[]),console.debug("Prepared the Streamlit environment"),console.debug("Booting up the Streamlit server");let s=r.pyimport("stlite_lib.server.Server")(o,e?N(e):void 0);return await s.start(),console.debug("Booted up the Streamlit server"),s}function Z(r,e,t,o){function n(p){e({type:"event:loadProgress",data:{message:p}})}let a=(p,d)=>{let g=new MessageChannel;e({type:"event:moduleAutoLoad",data:{packagesToLoad:p}},[g.port2]),d.then(h=>{g.port1.postMessage({type:"moduleAutoLoad:success",data:{loadedPackages:h}}),g.port1.close()}).catch(h=>{throw g.port1.postMessage({type:"moduleAutoLoad:error",error:h}),g.port1.close(),h})},s=null,l=null,c=async p=>{let d=p.data;if(d.type==="initData"){let i=d.data,f={...t,...i};console.debug("Initial data",f),s=be(r,o,f,a,n),s.then(({pyodide:m})=>(n("Booting up the Streamlit server."),l=Y(m,o,f.entrypoint),l)).then(()=>{e({type:"event:loadFinished"})}).catch(m=>{console.error(m),e({type:"event:loadError",data:{error:m}})});return}if(!s)throw new Error("Pyodide initialization has not been started yet.");if(!l)throw new Error("Streamlit server has not been started yet.");let g=await s,h=g.pyodide,L=g.micropip,P=g.jedi,{moduleAutoLoad:x}=g.initData,w=await l,E=p.ports[0];function b(i){E.postMessage(i)}try{switch(d.type){case"reboot":{console.debug("Reboot the Streamlit server",d.data);let{entrypoint:i}=d.data;w.stop(),console.debug("Booting up the Streamlit server"),l=Y(h,o,i),await l,console.debug("Booted up the Streamlit server"),b({type:"reply"});break}case"websocket:connect":{console.debug("websocket:connect",d.data);let{path:i}=d.data;w.start_websocket(i,(f,m)=>{if(m){let _=f;try{let A=_.toJs(),F=A.buffer.slice(A.byteOffset,A.byteOffset+A.byteLength);e({type:"websocket:message",data:{payload:F}},[F])}finally{_.destroy()}}else e({type:"websocket:message",data:{payload:f}})}),b({type:"reply"});break}case"websocket:send":{console.debug("websocket:send",d.data);let{payload:i}=d.data;w.receive_websocket_from_js(i);break}case"http:request":{console.debug("http:request",d.data);let{request:i}=d.data,f=(m,_,A)=>{let F=new Map(_.toJs()),I=A.toJs();console.debug({statusCode:m,headers:F,body:I}),b({type:"http:response",data:{response:{statusCode:m,headers:F,body:I}}})};w.receive_http_from_js(i.method,decodeURIComponent(i.path),i.headers,i.body,f);break}case"file:write":{let{path:i,data:f,opts:m}=d.data,_=R(o,i);x&&typeof f=="string"&&_.endsWith(".py")&&(console.debug(`Auto install the requirements in ${_}`),W(h,a,[f])),console.debug(`Write a file "${_}"`),U(h,_,f,m),b({type:"reply"});break}case"file:rename":{let{oldPath:i,newPath:f}=d.data,m=R(o,i),_=R(o,f);console.debug(`Rename "${m}" to ${_}`),V(h,m,_),b({type:"reply"});break}case"file:unlink":{let{path:i}=d.data,f=R(o,i);console.debug(`Remove "${f}`),h.FS.unlink(f),b({type:"reply"});break}case"file:read":{let{path:i,opts:f}=d.data;console.debug(`Read "${i}"`);let m=h.FS.readFile(i,f);b({type:"reply:file:read",data:{content:m}});break}case"install":{let{requirements:i,options:f}=d.data,m=T(i);console.debug("Install the requirements:",m),await L.install.callKwargs(m,f??{}).then(()=>{console.debug("Successfully installed"),b({type:"reply"})});break}case"setEnv":{let{env:i}=d.data;h.pyimport("os").environ.update(h.toPy(i)),console.debug("Successfully set the environment variables",i),b({type:"reply"});break}case"code_completion":{if(!P)throw new Error("Jedi is not installed");let{code:i,line:f,column:m}=d.data,_=await Q(P,i,{line:f,column:m});b({type:"reply:code_completion",data:{codeCompletions:_}});break}case"run_python":{let{code:i}=d.data;console.debug("Run python code",i);let f=await h.runPythonAsync(i),m;f instanceof h.ffi.PyProxy?(console.debug("The result is a PyProxy object"),m=f.toJs(),f.destroy(),console.debug("Converted the result to a JS object",m)):(m=f,console.debug("The result is a JS primitive",m)),b({type:"reply:run_python",data:{result:m}});break}}}catch(i){if(console.error(i),!(i instanceof Error))throw i;let f=new Error(i.message);f.name=i.name,f.stack=i.stack,b({type:"reply",error:f})}};return e({type:"event:envSetup"}),c}function ee(){let r=process.env.NODEFS_MOUNTPOINTS;if(!r)return;let e;try{e=JSON.parse(r)}catch{console.error(`Failed to parse NODEFS_MOUNTPOINTS as JSON: ${r}`);return}if(typeof e!="object"){console.error(`NODEFS_MOUNTPOINTS is not an object: ${r}`);return}if(Array.isArray(e)){console.error(`NODEFS_MOUNTPOINTS is an array: ${r}`);return}if(Object.keys(e).some(t=>typeof t!="string")){console.error(`NODEFS_MOUNTPOINTS has non-string keys: ${r}`);return}if(Object.values(e).some(t=>typeof t!="string")){console.error(`NODEFS_MOUNTPOINTS has non-string values: ${r}`);return}return e}var ve=r=>{console.debug("[worker thread] postMessage from worker",r),j.parentPort?.postMessage(r)},Pe=Z(process.env.PYODIDE_URL,ve,{nodefsMountpoints:ee()});j.parentPort?.on("message",({data:r,port:e})=>{console.debug("[worker thread] parentPort.onMessage",{data:r,port:e}),Pe({data:r,ports:[e]})});
package/build/index.html CHANGED
@@ -6,7 +6,7 @@
6
6
  <meta name="viewport" content="width=device-width, initial-scale=1" />
7
7
  <title>Stlite Desktop</title>
8
8
  <!-- The Content-Security-Policy setting will be injected at build time. See craco.config.js. -->
9
- <script type="module" crossorigin src="/assets/index-wnKDraWU.js"></script>
9
+ <script type="module" crossorigin src="/assets/index-k4Zz_A0O.js"></script>
10
10
  <link rel="stylesheet" crossorigin href="/assets/index.BGUxDbb1.css">
11
11
  </head>
12
12
  <body>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stlite/desktop",
3
- "version": "0.90.13",
3
+ "version": "0.90.15",
4
4
  "type": "module",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -65,9 +65,9 @@
65
65
  "@emotion/babel-plugin": "^11.13.5",
66
66
  "@eslint/js": "^9.32.0",
67
67
  "@stlite/common": "^0.90.0",
68
- "@stlite/common-react": "^0.90.1",
68
+ "@stlite/common-react": "^0.91.0",
69
69
  "@stlite/devutils": "^0.90.0",
70
- "@stlite/kernel": "^0.90.0",
70
+ "@stlite/kernel": "^0.92.1",
71
71
  "@streamlit/app": "^1.50.0",
72
72
  "@types/react": "^18.2.0",
73
73
  "@types/react-dom": "^18.2.0",
@@ -97,7 +97,7 @@
97
97
  "vite": "^7.1.5",
98
98
  "vite-plugin-wasm": "^3.5.0",
99
99
  "vite-tsconfig-paths": "^5.1.4",
100
- "vitest": "^4.0.8",
100
+ "vitest": "^4.0.13",
101
101
  "wait-on": "^8.0.1",
102
102
  "winston": "^3.13.0"
103
103
  },