@stlite/mountable 0.74.0 → 0.75.0

Sign up to get free protection for your applications and to get access to all the features.
package/build/stlite.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*! For license information please see stlite.js.LICENSE.txt */
2
- var stlite;(()=>{var __webpack_modules__={87330:(e,t,n)=>{"use strict";n.d(t,{DZ:()=>o.D,Yl:()=>r.Y});n(12796);var r=n(45349),o=n(57639)},57639:(e,t,n)=>{"use strict";n.d(t,{D:()=>r});class r{constructor(){this.promise=new Promise(((e,t)=>{this.resolveInternal=e,this.rejectInternal=t}))}resolve(e){this.resolveInternal(e)}reject(e){this.rejectInternal(e)}}},45349:(e,t,n)=>{"use strict";n.d(t,{Y:()=>o});const r=/\s#.*$/;function o(e){return e.split("\n").filter((e=>!e.startsWith("#"))).map((e=>e.replace(r,""))).map((e=>e.trim())).filter((e=>""!==e))}},12796:(e,t,n)=>{"use strict";new RegExp("[[(<=>!~;@]")},58278:(e,t,n)=>{"use strict";n.d(t,{l:()=>H,B$:()=>P,VC:()=>D,rI:()=>b,yp:()=>m,yJ:()=>g,Yr:()=>I,Ke:()=>A,mn:()=>O,PY:()=>w,$m:()=>S,U7:()=>v});var r=n(87330),o=n(8124);function i(e,t){if(function(e){try{return new URL(e),!0}catch{return!1}}(e))return e;if(e.startsWith("./")){if(null==t)throw new Error("baseUrl is null");return o.URLExt.join(t,e)}const n=t?new URL(t).origin:window.location.origin;return o.URLExt.join(n,e)}const a=new Map;class s{constructor(e,t){if(function(e){return e.origin===window.location.origin}(e))console.debug(`Loading a worker script from the same origin: ${e}`),this.worker=t.shared?new SharedWorker(e):new Worker(e);else{console.debug(`Loading a worker script from a different origin: ${e}`);const n=function(e){const t=e.toString(),n=a.get(t);if(n)return console.debug(`Using a cached worker blob URL for ${t}`),n;const r=new Blob([`importScripts("${t}");`],{type:"text/javascript"}),o=URL.createObjectURL(r);return a.set(t,o),o}(e);this.worker=t.shared?new SharedWorker(n):new Worker(n)}}}function l(e){if(!function(e){return"object"===typeof e&&null!=e&&Object.entries(e).every((e=>{let[t,n]=e;return"string"===typeof t&&function(e){return"string"===typeof e||"number"===typeof e||"boolean"===typeof e||null===e||void 0===e}(n)}))}(e))throw new Error(`Invalid streamlitConfig: ${e}`)}const c=n.p+"pypi/stlite_lib-0.1.0-py3-none-any.whl",u=n.p+"pypi/streamlit-1.40.1-cp312-none-any.whl",p=/\/+$/,d=/^\/+/;class b{constructor(e){var t,o,a;if(this._isDisposed=!1,this._loaded=new r.DZ,this.handleWebSocketMessage=null,this.basePath=(null!==(t=e.basePath)&&void 0!==t?t:window.location.pathname).replace(p,"").replace(d,""),this.hostConfigResponse=null!==(o=e.hostConfigResponse)&&void 0!==o?o:{},this.onProgress=e.onProgress,this.onLoad=e.onLoad,this.onError=e.onError,this.onModuleAutoLoad=e.onModuleAutoLoad,e.worker)this._worker=e.worker;else{var b;const t=new s(new URL(n.p+n.u(3209),n.b),{shared:null!==(b=e.sharedWorkerMode)&&void 0!==b&&b});this._worker=t.worker}let f;if(this._worker instanceof SharedWorker?(this._worker.port.start(),this._postMessageTarget=this._worker.port):this._postMessageTarget=this._worker,this._postMessageTarget.onmessage=e=>{const t=e.ports[0];this._processWorkerMessage(e.data,t)},!e.skipStliteWheelsInstall){console.debug("Custom wheel URLs:",{STLITE_LIB_WHEEL:c,STREAMLIT_WHEEL:u});f={stliteLib:i(c,e.wheelBaseUrl),streamlit:i(u,e.wheelBaseUrl)},console.debug("Custom wheel resolved URLs:",f)}null!=e.streamlitConfig&&l(e.streamlitConfig),this._workerInitData={entrypoint:e.entrypoint,files:e.files,archives:e.archives,requirements:e.requirements,prebuiltPackageNames:e.prebuiltPackageNames,pyodideUrl:e.pyodideUrl,wheels:f,streamlitConfig:e.streamlitConfig,idbfsMountpoints:e.idbfsMountpoints,moduleAutoLoad:null!==(a=e.moduleAutoLoad)&&void 0!==a&&a}}get loaded(){return this._loaded.promise}connectWebSocket(e){return this._asyncPostMessage({type:"websocket:connect",data:{path:e}})}sendWebSocketMessage(e){return this._asyncPostMessage({type:"websocket:send",data:{payload:e}})}onWebSocketMessage(e){this.handleWebSocketMessage=e}sendHttpRequest(e){return this._asyncPostMessage({type:"http:request",data:{request:e}},"http:response").then((e=>({...e.response,headers:new Headers(Object.fromEntries(e.response.headers))})))}writeFile(e,t,n){return this._asyncPostMessage({type:"file:write",data:{path:e,data:t,opts:n}})}renameFile(e,t){return this._asyncPostMessage({type:"file:rename",data:{oldPath:e,newPath:t}})}readFile(e,t){return this._asyncPostMessage({type:"file:read",data:{path:e,opts:t}},"reply:file:read").then((e=>e.content))}unlink(e){return this._asyncPostMessage({type:"file:unlink",data:{path:e}})}install(e){return this._asyncPostMessage({type:"install",data:{requirements:e}})}reboot(e){return this._asyncPostMessage({type:"reboot",data:{entrypoint:e}})}_asyncPostMessage(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"reply";return new Promise(((n,r)=>{const o=new MessageChannel;o.port1.onmessage=e=>{o.port1.close();const i=e.data;if(i.error)r(i.error);else{if(i.type!==t)throw new Error(`Unexpected reply type "${i.type}"`);n(i.data)}},this._postMessageTarget.postMessage(e,[o.port2])}))}_processWorkerMessage(e,t){switch(e.type){case"event:start":this._postMessageTarget.postMessage({type:"initData",data:this._workerInitData});break;case"event:progress":this.onProgress&&this.onProgress(e.data.message);break;case"event:error":this.onError&&this.onError(e.data.error);break;case"event:loaded":this._loaded.resolve(),this.onLoad&&this.onLoad();break;case"websocket:message":{const{payload:t}=e.data;this.handleWebSocketMessage&&this.handleWebSocketMessage(t);break}case"event:moduleAutoLoad":if(null==t)throw new Error("Port is required for moduleAutoLoad event");this.onModuleAutoLoad&&this.onModuleAutoLoad(e.data.packagesToLoad,new Promise(((e,n)=>{t.onmessage=r=>{const o=r.data;"moduleAutoLoad:success"===o.type?e(o.data.loadedPackages):n(o.error),t.close()}})))}}get isDisposed(){return this._isDisposed}dispose(){this.isDisposed||(this._worker instanceof SharedWorker?this._worker.port.close():this._worker.terminate(),this._isDisposed=!0)}}var f=n(80812),h=n(72176);const m=h.createContext(void 0),M=m.Provider;function g(e){const{children:t,kernel:n}=e,r=(0,h.useMemo)((()=>({kernel:n})),[n]);return(0,f.jsx)(M,{value:r,children:t})}function O(){const e=(0,h.useContext)(m);if(null==e)throw new Error("useStliteKernel() must be inside <StliteKernelProvider />");return e.kernel}function z(e,t){return e.sendHttpRequest({method:"GET",path:t,headers:{},body:""}).then((e=>{let{statusCode:t,headers:n,body:r}=e;if(200!==t)throw new Error(`Failed to fetch media object: ${t}`);const o=n.get("Content-Type"),i=new Blob([r],o?{type:o}:void 0);return URL.createObjectURL(i)}))}function y(e,t){return t.startsWith("/media")?z(e,t):Promise.resolve(t)}function A(e,t){return Promise.all([y(e,t.image),y(e,t.iconImage)]).then((e=>{let[n,r]=e;return t.image=n,t.iconImage=r,t}))}function v(e){const t=O(),[n,r]=(0,h.useState)(null);return(0,h.useEffect)((()=>{let n=!1;const o=[];return null==e?r(null):A(t,e).then((e=>{n||(o.push(e.image),o.push(e.iconImage),r(e))})),()=>{o.forEach((e=>{URL.revokeObjectURL(e)})),n=!0}}),[t,e]),n}function w(e){const t=O(),[n,r]=(0,h.useState)(e);return(0,h.useEffect)((()=>{if(null==t)return;if(!e.startsWith("/media"))return;let n=!1;const o=[];return z(t,e).then((e=>{n||(o.push(e),r(e))})),()=>{n=!0,o.forEach((e=>{URL.revokeObjectURL(e)}))}}),[t,e]),n}function S(e){const[t,n]=(0,h.useState)(e),r=O();return(0,h.useEffect)((()=>{if(null==r)return;let t=!1;const o=[],i=e.map((e=>null==e.url?e:e.url.startsWith("/media")?z(r,e.url).then((n=>t?e:(o.push(n),{...e,url:n}))):e));return Promise.all(i).then((e=>{t||n(e)})),()=>{t=!0,o.forEach((e=>{URL.revokeObjectURL(e)}))}}),[r,e]),t}const q=/%([0-9A-Fa-f]{2})/g,E=/[^\x20-\x7e\xa0-\xff]/g,_=/\\([\u0000-\u007f])/g,x=/;[\x09\x20]*([!#$%&'*+.0-9A-Z^_`a-z|~-]+)[\x09\x20]*=[\x09\x20]*("(?:[\x20!\x23-\x5b\x5d-\x7e\x80-\xff]|\\[\x20-\x7e])*"|[!#$%&'*+.0-9A-Z^_`a-z|~-]+)[\x09\x20]*/g,T=/^([A-Za-z0-9!#$%&+\-^_`{}~]+)'(?:[A-Za-z]{2,3}(?:-[A-Za-z]{3}){0,3}|[A-Za-z]{4,8}|)'((?:%[0-9A-Fa-f]{2}|[A-Za-z0-9!#$&+.^_`|~-])+)$/,R=/^([!#$%&'*+.0-9A-Z^_`a-z|~-]+)[\x09\x20]*(?:$|;)/,k=e=>String(e).replace(E,"?");class N{constructor(e,t){this.type=e,this.parameters=t}}const C=(e,t)=>String.fromCharCode(Number.parseInt(t,16));function W(e){const t=T.exec(e);if(!t)throw new TypeError("invalid extended field value");const n=t[1].toLowerCase(),r=t[2];let o;switch(n){case"iso-8859-1":o=k(r.replace(q,C));break;case"utf-8":try{o=decodeURIComponent(r)}catch{throw new TypeError("invalid encoded utf-8")}break;default:throw new TypeError("unsupported charset in extended field")}return o}function L(e){const t=function(e){let t=R.exec(e);if(!t)throw new TypeError("invalid type format");let n=t[0].length;const r=t[1].toLowerCase();let o;const i=[],a={};let s;for(n=x.lastIndex=";"===t[0].slice(-1)?n-1:n;t=x.exec(e);){if(t.index!==n)throw new TypeError("invalid parameter format");if(n+=t[0].length,o=t[1].toLowerCase(),s=t[2],-1!==i.indexOf(o))throw new TypeError("invalid duplicate parameter");i.push(o),o.indexOf("*")+1!==o.length?"string"!==typeof a[o]&&('"'===s[0]&&(s=s.slice(1,s.length-1).replace(_,"$1")),a[o]=s):(o=o.slice(0,-1),s=W(s),a[o]=s)}if(-1!==n&&n!==e.length)throw new TypeError("invalid parameter format");return new N(r,a)}(e);if("attachment"!==t.type)return;const n=t.parameters.filename;return"string"===typeof n?n:void 0}function I(e,t){e.sendHttpRequest({method:"GET",path:`${t}?title=${encodeURIComponent(document.title)}`,headers:{},body:""}).then((e=>{var t;let{statusCode:n,headers:r,body:o}=e;if(200!==n)return;const i=r.get("Content-Disposition"),a=null!==(t=i&&L(i))&&void 0!==t?t:"",s=r.get("Content-Type"),l=new Blob([o],s?{type:s}:void 0),c=URL.createObjectURL(l),u=document.createElement("a");u.setAttribute("href",c),u.setAttribute("target","_blank"),u.setAttribute("download",a),u.click(),URL.revokeObjectURL(c),u.remove()}))}const P="xxx",D=99999,B=P+":"+D.toString();function j(e){const t=e.split("/").slice(0,-1).join("/");return t.startsWith("/")?t:"/"+t}function F(e,t,n){const r=j(t);if(!(n.host===e&&n.pathname.startsWith(r)))return null;const o=n.pathname.slice(r.length);return o.startsWith("/")?o.slice(1):o}const U=h.forwardRef(((e,t)=>{let{src:n,...r}=e;const i=O(),[a,s]=(0,h.useState)();(0,h.useEffect)((()=>{if(null==i)return;if(!n.startsWith("/component"))return;let e=!1;return i.sendHttpRequest({method:"GET",path:n,headers:{},body:""}).then((t=>{let{statusCode:n,headers:r,body:o}=t;if(e)return;if(200!==n)return;const i=r.get("Content-Type");new Blob([o],i?{type:i}:void 0).text().then((t=>{e||s(t)}))})),()=>{e=!0}}),[i,n]);const l=(0,h.useCallback)((e=>{var t;const r=null===(t=e.target.contentWindow)||void 0===t?void 0:t.document;null!=r?function(e,t,n){const r=[],i=t.getElementsByTagName("script");for(const s of i){if(""===s.src)continue;const i=F(window.location.host,window.location.pathname,new URL(s.src));if(null==i)continue;const a=o.URLExt.join(n,i),l=e.sendHttpRequest({method:"GET",headers:{},path:a,body:""}).then((e=>{let{statusCode:n,headers:r,body:o}=e;if(200!==n)return;const i=r.get("Content-Type");return new Blob([o],i?{type:i}:void 0).text().then((e=>{const n=t.createElement("script");n.text=e,n.type="text/javascript",n.setAttribute("data-stlite",""),s.replaceWith(n)}))}));r.push(l)}const a=t.querySelectorAll("link[rel=stylesheet]");for(const s of a){const i=F(window.location.host,window.location.pathname,new URL(s.href));if(null==i)continue;const a=o.URLExt.join(n,i),l=e.sendHttpRequest({method:"GET",headers:{},path:a,body:""}).then((e=>{let{statusCode:n,headers:r,body:o}=e;if(200!==n)return;const i=r.get("Content-Type");return new Blob([o],i?{type:i}:void 0).text().then((e=>{const n=t.createElement("style");n.innerHTML=e,n.setAttribute("data-stlite",""),s.replaceWith(n)}))}));r.push(l)}Promise.all(r).then()}(i,r,j(n)):console.warn("document not found in iframe")}),[i,n]);return(0,f.jsx)("iframe",{...r,srcDoc:a,onLoad:l,ref:t})}));U.displayName="InnerIFrame";const V=h.forwardRef(((e,t)=>{const n=function(e,t){const n=(B+"/"+e).replace(/\/$/,""),r=new RegExp(`https?://${n}(/.*?$)`),o=t.match(r);return null==o?null:o[1]}(O().basePath,e.src);return null==n?(0,f.jsx)("iframe",{...e,ref:t}):(0,f.jsx)(U,{...e,src:n,ref:t})}));V.displayName="StliteCustomComponentIFrame";const H=V},2343:(e,t,n)=>{"use strict";n.d(t,{LD:()=>r});const r=3e3===+window.location.port},82398:(e,t,n)=>{"use strict";n.d(t,{A:()=>r});const r=n(72176).createContext(!1)},59834:(e,t,n)=>{"use strict";n.d(t,{A:()=>r});const r=n(72176).createContext(!1)},32057:(e,t,n)=>{"use strict";n.d(t,{n:()=>i});var r=n(72176),o=n(21564);const i=r.createContext({isFullScreen:!1,setFullScreen:()=>{},addScriptFinishedHandler:()=>{},removeScriptFinishedHandler:()=>{},activeTheme:o.$7,setTheme:()=>{},availableThemes:[],addThemes:()=>{},onPageChange:()=>{},currentPageScriptHash:"",libConfig:{},fragmentIdsThisRun:[],locale:window.navigator.language})},46815:(e,t,n)=>{"use strict";n.d(t,{E:()=>r});const r=n(72176).createContext(null)},58263:(e,t,n)=>{"use strict";n.d(t,{A:()=>h,b:()=>f});n(72176);var r=n(60265),o=n(40252),i=n(20052),a=n(45460),s=n(80333),l=n(271),c=n(29847),u=n(37920),p=n(43417);const d=(0,l.A)("div",{target:"e1eexb540"})((e=>{let{theme:t}=e;return{display:"flex",gap:t.spacing.sm,width:"100%",[`${c.Dz}, ${c.vE}, ${p.q}`]:{position:"relative",top:"2px"},[`${u.c3} code`]:{paddingRight:t.spacing.lg}}}),"");var b=n(80812);function f(e){switch(e){case o.Fc.Format.ERROR:return s.b.ERROR;case o.Fc.Format.INFO:return s.b.INFO;case o.Fc.Format.SUCCESS:return s.b.SUCCESS;case o.Fc.Format.WARNING:return s.b.WARNING;default:throw new Error(`Unexpected alert type: ${e}`)}}function h(e){let{icon:t,body:n,kind:o,width:l}=e;const c=(0,r.u)(),u={width:t?`calc(100% - (${c.iconSizes.lg} + ${c.spacing.sm}))`:"100%"};return(0,b.jsx)("div",{className:"stAlert","data-testid":"stAlert",children:(0,b.jsx)(s.A,{width:l,kind:o,children:(0,b.jsxs)(d,{children:[t&&(0,b.jsx)(a.$,{iconValue:t,size:"lg",testid:"stAlertDynamicIcon"}),(0,b.jsx)(i.Ay,{source:n,allowHTML:!1,style:u})]})})})}},9148:(e,t,n)=>{"use strict";n.r(t),n.d(t,{default:()=>U});var r=n(72176),o=n(89575),i=n(24586);function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function s(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?a(Object(n),!0).forEach((function(t){(0,i.A)(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):a(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var l={};function c(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2?arguments[2]:void 0;return function(e){if(0===e.length||1===e.length)return e;var t=e.join(".");return l[t]||(l[t]=function(e){var t=e.length;return 0===t||1===t?e:2===t?[e[0],e[1],"".concat(e[0],".").concat(e[1]),"".concat(e[1],".").concat(e[0])]:3===t?[e[0],e[1],e[2],"".concat(e[0],".").concat(e[1]),"".concat(e[0],".").concat(e[2]),"".concat(e[1],".").concat(e[0]),"".concat(e[1],".").concat(e[2]),"".concat(e[2],".").concat(e[0]),"".concat(e[2],".").concat(e[1]),"".concat(e[0],".").concat(e[1],".").concat(e[2]),"".concat(e[0],".").concat(e[2],".").concat(e[1]),"".concat(e[1],".").concat(e[0],".").concat(e[2]),"".concat(e[1],".").concat(e[2],".").concat(e[0]),"".concat(e[2],".").concat(e[0],".").concat(e[1]),"".concat(e[2],".").concat(e[1],".").concat(e[0])]:t>=4?[e[0],e[1],e[2],e[3],"".concat(e[0],".").concat(e[1]),"".concat(e[0],".").concat(e[2]),"".concat(e[0],".").concat(e[3]),"".concat(e[1],".").concat(e[0]),"".concat(e[1],".").concat(e[2]),"".concat(e[1],".").concat(e[3]),"".concat(e[2],".").concat(e[0]),"".concat(e[2],".").concat(e[1]),"".concat(e[2],".").concat(e[3]),"".concat(e[3],".").concat(e[0]),"".concat(e[3],".").concat(e[1]),"".concat(e[3],".").concat(e[2]),"".concat(e[0],".").concat(e[1],".").concat(e[2]),"".concat(e[0],".").concat(e[1],".").concat(e[3]),"".concat(e[0],".").concat(e[2],".").concat(e[1]),"".concat(e[0],".").concat(e[2],".").concat(e[3]),"".concat(e[0],".").concat(e[3],".").concat(e[1]),"".concat(e[0],".").concat(e[3],".").concat(e[2]),"".concat(e[1],".").concat(e[0],".").concat(e[2]),"".concat(e[1],".").concat(e[0],".").concat(e[3]),"".concat(e[1],".").concat(e[2],".").concat(e[0]),"".concat(e[1],".").concat(e[2],".").concat(e[3]),"".concat(e[1],".").concat(e[3],".").concat(e[0]),"".concat(e[1],".").concat(e[3],".").concat(e[2]),"".concat(e[2],".").concat(e[0],".").concat(e[1]),"".concat(e[2],".").concat(e[0],".").concat(e[3]),"".concat(e[2],".").concat(e[1],".").concat(e[0]),"".concat(e[2],".").concat(e[1],".").concat(e[3]),"".concat(e[2],".").concat(e[3],".").concat(e[0]),"".concat(e[2],".").concat(e[3],".").concat(e[1]),"".concat(e[3],".").concat(e[0],".").concat(e[1]),"".concat(e[3],".").concat(e[0],".").concat(e[2]),"".concat(e[3],".").concat(e[1],".").concat(e[0]),"".concat(e[3],".").concat(e[1],".").concat(e[2]),"".concat(e[3],".").concat(e[2],".").concat(e[0]),"".concat(e[3],".").concat(e[2],".").concat(e[1]),"".concat(e[0],".").concat(e[1],".").concat(e[2],".").concat(e[3]),"".concat(e[0],".").concat(e[1],".").concat(e[3],".").concat(e[2]),"".concat(e[0],".").concat(e[2],".").concat(e[1],".").concat(e[3]),"".concat(e[0],".").concat(e[2],".").concat(e[3],".").concat(e[1]),"".concat(e[0],".").concat(e[3],".").concat(e[1],".").concat(e[2]),"".concat(e[0],".").concat(e[3],".").concat(e[2],".").concat(e[1]),"".concat(e[1],".").concat(e[0],".").concat(e[2],".").concat(e[3]),"".concat(e[1],".").concat(e[0],".").concat(e[3],".").concat(e[2]),"".concat(e[1],".").concat(e[2],".").concat(e[0],".").concat(e[3]),"".concat(e[1],".").concat(e[2],".").concat(e[3],".").concat(e[0]),"".concat(e[1],".").concat(e[3],".").concat(e[0],".").concat(e[2]),"".concat(e[1],".").concat(e[3],".").concat(e[2],".").concat(e[0]),"".concat(e[2],".").concat(e[0],".").concat(e[1],".").concat(e[3]),"".concat(e[2],".").concat(e[0],".").concat(e[3],".").concat(e[1]),"".concat(e[2],".").concat(e[1],".").concat(e[0],".").concat(e[3]),"".concat(e[2],".").concat(e[1],".").concat(e[3],".").concat(e[0]),"".concat(e[2],".").concat(e[3],".").concat(e[0],".").concat(e[1]),"".concat(e[2],".").concat(e[3],".").concat(e[1],".").concat(e[0]),"".concat(e[3],".").concat(e[0],".").concat(e[1],".").concat(e[2]),"".concat(e[3],".").concat(e[0],".").concat(e[2],".").concat(e[1]),"".concat(e[3],".").concat(e[1],".").concat(e[0],".").concat(e[2]),"".concat(e[3],".").concat(e[1],".").concat(e[2],".").concat(e[0]),"".concat(e[3],".").concat(e[2],".").concat(e[0],".").concat(e[1]),"".concat(e[3],".").concat(e[2],".").concat(e[1],".").concat(e[0])]:void 0}(e)),l[t]}(e.filter((function(e){return"token"!==e}))).reduce((function(e,t){return s(s({},e),n[t])}),t)}function u(e){return e.join(" ")}function p(e){var t=e.node,n=e.stylesheet,i=e.style,a=void 0===i?{}:i,l=e.useInlineStyles,d=e.key,b=t.properties,f=t.type,h=t.tagName,m=t.value;if("text"===f)return m;if(h){var M,g=function(e,t){var n=0;return function(r){return n+=1,r.map((function(r,o){return p({node:r,stylesheet:e,useInlineStyles:t,key:"code-segment-".concat(n,"-").concat(o)})}))}}(n,l);if(l){var O=Object.keys(n).reduce((function(e,t){return t.split(".").forEach((function(t){e.includes(t)||e.push(t)})),e}),[]),z=b.className&&b.className.includes("token")?["token"]:[],y=b.className&&z.concat(b.className.filter((function(e){return!O.includes(e)})));M=s(s({},b),{},{className:u(y)||void 0,style:c(b.className,Object.assign({},b.style,a),n)})}else M=s(s({},b),{},{className:u(b.className)});var A=g(t.children);return r.createElement(h,(0,o.A)({key:d},M),A)}}var d=n(39850),b=n(64619);const f=function(e,t){return-1!==e.listLanguages().indexOf(t)};var h=["language","children","style","customStyle","codeTagProps","useInlineStyles","showLineNumbers","showInlineLineNumbers","startingLineNumber","lineNumberContainerStyle","lineNumberStyle","wrapLines","wrapLongLines","lineProps","renderer","PreTag","CodeTag","code","astGenerator"];function m(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function M(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?m(Object(n),!0).forEach((function(t){(0,i.A)(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):m(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var g=/\n/g;function O(e){var t=e.codeString,n=e.codeStyle,o=e.containerStyle,i=void 0===o?{float:"left",paddingRight:"10px"}:o,a=e.numberStyle,s=void 0===a?{}:a,l=e.startingLineNumber;return r.createElement("code",{style:Object.assign({},n,i)},function(e){var t=e.lines,n=e.startingLineNumber,o=e.style;return t.map((function(e,t){var i=t+n;return r.createElement("span",{key:"line-".concat(t),className:"react-syntax-highlighter-line-number",style:"function"===typeof o?o(i):o},"".concat(i,"\n"))}))}({lines:t.replace(/\n$/,"").split("\n"),style:s,startingLineNumber:l}))}function z(e,t){return{type:"element",tagName:"span",properties:{key:"line-number--".concat(e),className:["comment","linenumber","react-syntax-highlighter-line-number"],style:t},children:[{type:"text",value:e}]}}function y(e,t,n){var r,o={display:"inline-block",minWidth:(r=n,"".concat(r.toString().length,".25em")),paddingRight:"1em",textAlign:"right",userSelect:"none"},i="function"===typeof e?e(t):e;return M(M({},o),i)}function A(e){var t=e.children,n=e.lineNumber,r=e.lineNumberStyle,o=e.largestLineNumber,i=e.showInlineLineNumbers,a=e.lineProps,s=void 0===a?{}:a,l=e.className,c=void 0===l?[]:l,u=e.showLineNumbers,p=e.wrapLongLines,d="function"===typeof s?s(n):s;if(d.className=c,n&&i){var b=y(r,n,o);t.unshift(z(n,b))}return p&u&&(d.style=M(M({},d.style),{},{display:"flex"})),{type:"element",tagName:"span",properties:d,children:t}}function v(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],r=0;r<e.length;r++){var o=e[r];if("text"===o.type)n.push(A({children:[o],className:(0,b.A)(new Set(t))}));else if(o.children){var i=t.concat(o.properties.className);v(o.children,i).forEach((function(e){return n.push(e)}))}}return n}function w(e,t,n,r,o,i,a,s,l){var c,u=v(e.value),p=[],d=-1,b=0;function f(e,i){var c=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];return t||c.length>0?function(e,t){return A({children:e,lineNumber:t,lineNumberStyle:s,largestLineNumber:a,showInlineLineNumbers:o,lineProps:n,className:arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],showLineNumbers:r,wrapLongLines:l})}(e,i,c):function(e,t){if(r&&t&&o){var n=y(s,t,a);e.unshift(z(t,n))}return e}(e,i)}for(var h=function(){var e=u[b],t=e.children[0].value;if(t.match(g)){var n=t.split("\n");n.forEach((function(t,o){var a=r&&p.length+i,s={type:"text",value:"".concat(t,"\n")};if(0===o){var l=f(u.slice(d+1,b).concat(A({children:[s],className:e.properties.className})),a);p.push(l)}else if(o===n.length-1){var c=u[b+1]&&u[b+1].children&&u[b+1].children[0],h={type:"text",value:"".concat(t)};if(c){var m=A({children:[h],className:e.properties.className});u.splice(b+1,0,m)}else{var M=f([h],a,e.properties.className);p.push(M)}}else{var g=f([s],a,e.properties.className);p.push(g)}})),d=b}b++};b<u.length;)h();if(d!==u.length-1){var m=u.slice(d+1,u.length);if(m&&m.length){var M=f(m,r&&p.length+i);p.push(M)}}return t?p:(c=[]).concat.apply(c,p)}function S(e){var t=e.rows,n=e.stylesheet,r=e.useInlineStyles;return t.map((function(e,t){return p({node:e,stylesheet:n,useInlineStyles:r,key:"code-segement".concat(t)})}))}function q(e){return e&&"undefined"!==typeof e.highlightAuto}var E=n(13);var _,x,T=(_=n.n(E)(),x={'code[class*="language-"]':{color:"black",background:"none",textShadow:"0 1px white",fontFamily:"Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace",fontSize:"1em",textAlign:"left",whiteSpace:"pre",wordSpacing:"normal",wordBreak:"normal",wordWrap:"normal",lineHeight:"1.5",MozTabSize:"4",OTabSize:"4",tabSize:"4",WebkitHyphens:"none",MozHyphens:"none",msHyphens:"none",hyphens:"none"},'pre[class*="language-"]':{color:"black",background:"#f5f2f0",textShadow:"0 1px white",fontFamily:"Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace",fontSize:"1em",textAlign:"left",whiteSpace:"pre",wordSpacing:"normal",wordBreak:"normal",wordWrap:"normal",lineHeight:"1.5",MozTabSize:"4",OTabSize:"4",tabSize:"4",WebkitHyphens:"none",MozHyphens:"none",msHyphens:"none",hyphens:"none",padding:"1em",margin:".5em 0",overflow:"auto"},'pre[class*="language-"]::-moz-selection':{textShadow:"none",background:"#b3d4fc"},'pre[class*="language-"] ::-moz-selection':{textShadow:"none",background:"#b3d4fc"},'code[class*="language-"]::-moz-selection':{textShadow:"none",background:"#b3d4fc"},'code[class*="language-"] ::-moz-selection':{textShadow:"none",background:"#b3d4fc"},'pre[class*="language-"]::selection':{textShadow:"none",background:"#b3d4fc"},'pre[class*="language-"] ::selection':{textShadow:"none",background:"#b3d4fc"},'code[class*="language-"]::selection':{textShadow:"none",background:"#b3d4fc"},'code[class*="language-"] ::selection':{textShadow:"none",background:"#b3d4fc"},':not(pre) > code[class*="language-"]':{background:"#f5f2f0",padding:".1em",borderRadius:".3em",whiteSpace:"normal"},comment:{color:"slategray"},prolog:{color:"slategray"},doctype:{color:"slategray"},cdata:{color:"slategray"},punctuation:{color:"#999"},namespace:{Opacity:".7"},property:{color:"#905"},tag:{color:"#905"},boolean:{color:"#905"},number:{color:"#905"},constant:{color:"#905"},symbol:{color:"#905"},deleted:{color:"#905"},selector:{color:"#690"},"attr-name":{color:"#690"},string:{color:"#690"},char:{color:"#690"},builtin:{color:"#690"},inserted:{color:"#690"},operator:{color:"#9a6e3a",background:"hsla(0, 0%, 100%, .5)"},entity:{color:"#9a6e3a",background:"hsla(0, 0%, 100%, .5)",cursor:"help"},url:{color:"#9a6e3a",background:"hsla(0, 0%, 100%, .5)"},".language-css .token.string":{color:"#9a6e3a",background:"hsla(0, 0%, 100%, .5)"},".style .token.string":{color:"#9a6e3a",background:"hsla(0, 0%, 100%, .5)"},atrule:{color:"#07a"},"attr-value":{color:"#07a"},keyword:{color:"#07a"},function:{color:"#DD4A68"},"class-name":{color:"#DD4A68"},regex:{color:"#e90"},important:{color:"#e90",fontWeight:"bold"},variable:{color:"#e90"},bold:{fontWeight:"bold"},italic:{fontStyle:"italic"}},function(e){var t=e.language,n=e.children,o=e.style,i=void 0===o?x:o,a=e.customStyle,s=void 0===a?{}:a,l=e.codeTagProps,c=void 0===l?{className:t?"language-".concat(t):void 0,style:M(M({},i['code[class*="language-"]']),i['code[class*="language-'.concat(t,'"]')])}:l,u=e.useInlineStyles,p=void 0===u||u,b=e.showLineNumbers,m=void 0!==b&&b,g=e.showInlineLineNumbers,z=void 0===g||g,y=e.startingLineNumber,A=void 0===y?1:y,v=e.lineNumberContainerStyle,E=e.lineNumberStyle,T=void 0===E?{}:E,R=e.wrapLines,k=e.wrapLongLines,N=void 0!==k&&k,C=e.lineProps,W=void 0===C?{}:C,L=e.renderer,I=e.PreTag,P=void 0===I?"pre":I,D=e.CodeTag,B=void 0===D?"code":D,j=e.code,F=void 0===j?(Array.isArray(n)?n[0]:n)||"":j,U=e.astGenerator,V=(0,d.A)(e,h);U=U||_;var H=m?r.createElement(O,{containerStyle:v,codeStyle:c.style||{},numberStyle:T,startingLineNumber:A,codeString:F}):null,X=i.hljs||i['pre[class*="language-"]']||{backgroundColor:"#fff"},$=q(U)?"hljs":"prismjs",G=p?Object.assign({},V,{style:Object.assign({},X,s)}):Object.assign({},V,{className:V.className?"".concat($," ").concat(V.className):$,style:Object.assign({},s)});if(c.style=M(M({},c.style),{},N?{whiteSpace:"pre-wrap"}:{whiteSpace:"pre"}),!U)return r.createElement(P,G,H,r.createElement(B,c,F));(void 0===R&&L||N)&&(R=!0),L=L||S;var K=[{type:"text",value:F}],Y=function(e){var t=e.astGenerator,n=e.language,r=e.code,o=e.defaultCodeValue;if(q(t)){var i=f(t,n);return"text"===n?{value:o,language:"text"}:i?t.highlight(n,r):t.highlightAuto(r)}try{return n&&"text"!==n?{value:t.highlight(r,n)}:{value:o}}catch(a){return{value:o}}}({astGenerator:U,language:t,code:F,defaultCodeValue:K});null===Y.language&&(Y.value=K);var J=w(Y,R,W,m,z,A,Y.value.length+A,T,N);return r.createElement(P,G,r.createElement(B,c,!z&&H,L({rows:J,stylesheet:i,useInlineStyles:p})))});T.supportedLanguages=["abap","abnf","actionscript","ada","agda","al","antlr4","apacheconf","apex","apl","applescript","aql","arduino","arff","asciidoc","asm6502","asmatmel","aspnet","autohotkey","autoit","avisynth","avro-idl","bash","basic","batch","bbcode","bicep","birb","bison","bnf","brainfuck","brightscript","bro","bsl","c","cfscript","chaiscript","cil","clike","clojure","cmake","cobol","coffeescript","concurnas","coq","cpp","crystal","csharp","cshtml","csp","css-extras","css","csv","cypher","d","dart","dataweave","dax","dhall","diff","django","dns-zone-file","docker","dot","ebnf","editorconfig","eiffel","ejs","elixir","elm","erb","erlang","etlua","excel-formula","factor","false","firestore-security-rules","flow","fortran","fsharp","ftl","gap","gcode","gdscript","gedcom","gherkin","git","glsl","gml","gn","go-module","go","graphql","groovy","haml","handlebars","haskell","haxe","hcl","hlsl","hoon","hpkp","hsts","http","ichigojam","icon","icu-message-format","idris","iecst","ignore","inform7","ini","io","j","java","javadoc","javadoclike","javascript","javastacktrace","jexl","jolie","jq","js-extras","js-templates","jsdoc","json","json5","jsonp","jsstacktrace","jsx","julia","keepalived","keyman","kotlin","kumir","kusto","latex","latte","less","lilypond","liquid","lisp","livescript","llvm","log","lolcode","lua","magma","makefile","markdown","markup-templating","markup","matlab","maxscript","mel","mermaid","mizar","mongodb","monkey","moonscript","n1ql","n4js","nand2tetris-hdl","naniscript","nasm","neon","nevod","nginx","nim","nix","nsis","objectivec","ocaml","opencl","openqasm","oz","parigp","parser","pascal","pascaligo","pcaxis","peoplecode","perl","php-extras","php","phpdoc","plsql","powerquery","powershell","processing","prolog","promql","properties","protobuf","psl","pug","puppet","pure","purebasic","purescript","python","q","qml","qore","qsharp","r","racket","reason","regex","rego","renpy","rest","rip","roboconf","robotframework","ruby","rust","sas","sass","scala","scheme","scss","shell-session","smali","smalltalk","smarty","sml","solidity","solution-file","soy","sparql","splunk-spl","sqf","sql","squirrel","stan","stylus","swift","systemd","t4-cs","t4-templating","t4-vb","tap","tcl","textile","toml","tremor","tsx","tt2","turtle","twig","typescript","typoscript","unrealscript","uorazor","uri","v","vala","vbnet","velocity","verilog","vhdl","vim","visual-basic","warpscript","wasm","web-idl","wiki","wolfram","wren","xeora","xml-doc","xojo","xquery","yaml","yang","zig"];const R=T;var k=n(73668),N=n.n(k),C=n(15360),W=n.n(C);function L(){return L=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},L.apply(this,arguments)}function I(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var P=(0,r.forwardRef)((function(e,t){var n=e.color,o=void 0===n?"currentColor":n,i=e.size,a=void 0===i?24:i,s=I(e,["color","size"]);return r.createElement("svg",L({ref:t,xmlns:"http://www.w3.org/2000/svg",width:a,height:a,viewBox:"0 0 24 24",fill:"none",stroke:o,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},s),r.createElement("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),r.createElement("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"}))}));P.propTypes={color:W().string,size:W().oneOfType([W().string,W().number])},P.displayName="Copy";const D=P;var B=n(37920),j=n(80812);const F=e=>{let{text:t}=e;const n=(0,r.useRef)(null),o=(0,r.useRef)(null);return(0,r.useEffect)((()=>{const e=n.current;var t;null!==e&&(o.current=new(N())(e,{container:null!==(t=e.parentElement)&&void 0!==t?t:void 0}));return()=>{null!==o.current&&o.current.destroy()}}),[]),(0,j.jsx)(B.xd,{"data-testid":"stCodeCopyButton",title:"Copy to clipboard",ref:n,"data-clipboard-text":t,style:{top:0,right:0},children:(0,j.jsx)(D,{size:"16"})})};function U(e){let{language:t,showLineNumbers:n,wrapLines:o,children:i}=e;const a=(0,r.useCallback)((e=>{let{rows:t,stylesheet:n,useInlineStyles:r}=e;return t.map(((e,t)=>{const o=e.children;if(o){const t=o.shift();t&&(e.children=[t,{children:o,properties:{className:[]},tagName:"span",type:"element"}])}return p({node:e,stylesheet:n,useInlineStyles:r,key:t})}))}),[]);return(0,j.jsxs)(B.c3,{className:"stCode","data-testid":"stCode",children:[(0,j.jsx)(B.rs,{children:(0,j.jsx)(R,{language:t,PreTag:"div",customStyle:{backgroundColor:"transparent"},style:{},lineNumberStyle:{},showLineNumbers:n,wrapLongLines:o,renderer:n&&o?a:void 0,children:i})}),"string"===typeof i&&""!==i.trim()&&(0,j.jsx)(B.Wh,{children:(0,j.jsx)(F,{text:i})})]})}},37920:(e,t,n)=>{"use strict";n.d(t,{Wh:()=>c,c3:()=>u,m7:()=>i,pR:()=>s,rs:()=>l,xd:()=>p});var r=n(271);const o={"a > &":{color:"inherit"}},i=(0,r.A)("code",{target:"e1ycw9pz5"})((e=>{let{theme:t}=e;return{padding:"0.2em 0.4em",wordWrap:"break-word",margin:0,borderRadius:t.radii.md,background:t.colors.codeHighlightColor,color:t.colors.codeTextColor,fontFamily:t.genericFonts.codeFont,fontSize:"0.75em",...o}}),""),a=e=>({background:"transparent",border:0,color:"inherit",display:"inline",fontSize:e.fontSizes.sm,lineHeight:"inherit",margin:0,overflowX:"auto",padding:0,whiteSpace:"pre",wordBreak:"normal",wordWrap:"normal",...o}),s=(0,r.A)("code",{target:"e1ycw9pz4"})((e=>{let{theme:t}=e;return{...a(t)}}),""),l=(0,r.A)("pre",{target:"e1ycw9pz3"})((e=>{let{theme:t}=e;return{background:t.colors.codeHighlightColor,borderRadius:t.radii.default,color:t.colors.bodyText,fontSize:t.fontSizes.twoSm,display:"block",margin:0,msOverflowStyle:"scrollbar",overflow:"auto",padding:t.spacing.lg,paddingRight:t.iconSizes.threeXL,code:{...a(t)},".comment.linenumber":{color:t.colors.fadedText40,fontSize:t.fontSizes.twoSm,alignSelf:"center",minWidth:`${t.spacing.threeXL} !important`},".token.comment, .token.prolog, .token.doctype, .token.cdata":{color:t.colors.gray70},".token.punctuation":{color:t.colors.gray70},".namespace":{opacity:.7},".token.attr-name, .token.property, .token.variable":{color:t.colors.lightBlue80},".token.boolean, .token.constant, .token.symbol":{color:t.colors.green70},".token.number, .token.regex":{color:t.colors.blueGreen80},".token.string, .token.char, .token.attr-value":{color:t.colors.green80},".token.operator, .token.entity":{color:t.colors.orange90},".token.url":{color:t.colors.purple80},".token.decorator, .token.atrule":{color:t.colors.orange90},".token.keyword, .token.tag":{color:t.colors.blue70},".token.function, .token.class-name, .token.selector":{color:t.colors.blue70,fontWeight:t.fontWeights.extrabold},".token.important":{color:t.colors.red70,fontWeight:t.fontWeights.extrabold},".token.comment":{color:t.colors.gray70,fontStyle:"italic"},".token.italic":{fontStyle:"italic"},".token.entity":{cursor:"help"},".token.deleted.line, .token.deleted.prefix":{color:t.colors.red70},".token.inserted.line, .token.inserted.prefix":{color:t.colors.green70},".token.unchanged.line":{color:t.colors.gray70}}}),""),c=(0,r.A)("div",{target:"e1ycw9pz2"})((e=>{let{theme:t}=e;return{opacity:0,padding:`${t.spacing.sm} ${t.spacing.sm} 0 0`,top:0,right:0,position:"absolute",width:"100%",height:"100%",backgroundColor:t.colors.transparent,zIndex:t.zIndices.sidebar+1,display:"flex",justifyContent:"flex-end",alignItems:"flex-start",transition:"opacity 300ms 150ms",pointerEvents:"none"}}),""),u=(0,r.A)("div",{target:"e1ycw9pz1"})((e=>{let{theme:t}=e;return{position:"relative",marginLeft:t.spacing.none,marginRight:t.spacing.none,marginTop:t.spacing.none,marginBottom:void 0,"&:hover":{[`${c}`]:{opacity:1}}}}),""),p=(0,r.A)("button",{target:"e1ycw9pz0"})((e=>{let{theme:t}=e;return{pointerEvents:"auto",height:t.iconSizes.threeXL,width:t.iconSizes.threeXL,padding:t.spacing.none,border:"none",backgroundColor:t.colors.transparent,color:t.colors.fadedText60,transform:"scale(0)",[`${u}:hover &, &:active, &:focus, &:hover`]:{opacity:1,transform:"scale(1)",outline:"none",transition:"none",color:t.colors.bodyText}}}),"")},91075:(e,t,n)=>{"use strict";n.d(t,{E:()=>m});var r=n(72176),o=n(40252),i=n(271);const a={animationDuration:"750ms",animationName:n(60137).i7`
2
+ var stlite;(()=>{var __webpack_modules__={87330:(e,t,n)=>{"use strict";n.d(t,{DZ:()=>o.D,Yl:()=>r.Y});n(12796);var r=n(45349),o=n(57639)},57639:(e,t,n)=>{"use strict";n.d(t,{D:()=>r});class r{constructor(){this.promise=new Promise(((e,t)=>{this.resolveInternal=e,this.rejectInternal=t}))}resolve(e){this.resolveInternal(e)}reject(e){this.rejectInternal(e)}}},45349:(e,t,n)=>{"use strict";n.d(t,{Y:()=>o});const r=/\s#.*$/;function o(e){return e.split("\n").filter((e=>!e.startsWith("#"))).map((e=>e.replace(r,""))).map((e=>e.trim())).filter((e=>""!==e))}},12796:(e,t,n)=>{"use strict";new RegExp("[[(<=>!~;@]")},58278:(e,t,n)=>{"use strict";n.d(t,{l:()=>H,B$:()=>P,VC:()=>D,rI:()=>b,yp:()=>m,yJ:()=>g,Yr:()=>I,Ke:()=>A,mn:()=>O,PY:()=>w,$m:()=>S,U7:()=>v});var r=n(87330),o=n(8124);function i(e,t){if(function(e){try{return new URL(e),!0}catch{return!1}}(e))return e;if(e.startsWith("./")){if(null==t)throw new Error("baseUrl is null");return o.URLExt.join(t,e)}const n=t?new URL(t).origin:window.location.origin;return o.URLExt.join(n,e)}const a=new Map;class s{constructor(e,t){if(function(e){return e.origin===window.location.origin}(e))console.debug(`Loading a worker script from the same origin: ${e}`),this.worker=t.shared?new SharedWorker(e):new Worker(e);else{console.debug(`Loading a worker script from a different origin: ${e}`);const n=function(e){const t=e.toString(),n=a.get(t);if(n)return console.debug(`Using a cached worker blob URL for ${t}`),n;const r=new Blob([`importScripts("${t}");`],{type:"text/javascript"}),o=URL.createObjectURL(r);return a.set(t,o),o}(e);this.worker=t.shared?new SharedWorker(n):new Worker(n)}}}function l(e){if(!function(e){return"object"===typeof e&&null!=e&&Object.entries(e).every((e=>{let[t,n]=e;return"string"===typeof t&&function(e){return"string"===typeof e||"number"===typeof e||"boolean"===typeof e||null===e||void 0===e}(n)}))}(e))throw new Error(`Invalid streamlitConfig: ${e}`)}const c=n.p+"pypi/stlite_lib-0.1.0-py3-none-any.whl",u=n.p+"pypi/streamlit-1.40.1-cp312-none-any.whl",p=/\/+$/,d=/^\/+/;class b{constructor(e){var t,o,a;if(this._isDisposed=!1,this._loaded=new r.DZ,this.handleWebSocketMessage=null,this.basePath=(null!==(t=e.basePath)&&void 0!==t?t:window.location.pathname).replace(p,"").replace(d,""),this.hostConfigResponse=null!==(o=e.hostConfigResponse)&&void 0!==o?o:{},this.onProgress=e.onProgress,this.onLoad=e.onLoad,this.onError=e.onError,this.onModuleAutoLoad=e.onModuleAutoLoad,e.worker)this._worker=e.worker;else{var b;const t=new s(new URL(n.p+n.u(3209),n.b),{shared:null!==(b=e.sharedWorker)&&void 0!==b&&b});this._worker=t.worker}let f;if(this._worker instanceof SharedWorker?(this._worker.port.start(),this._postMessageTarget=this._worker.port):this._postMessageTarget=this._worker,this._postMessageTarget.onmessage=e=>{const t=e.ports[0];this._processWorkerMessage(e.data,t)},!e.skipStliteWheelsInstall){console.debug("Custom wheel URLs:",{STLITE_LIB_WHEEL:c,STREAMLIT_WHEEL:u});f={stliteLib:i(c,e.wheelBaseUrl),streamlit:i(u,e.wheelBaseUrl)},console.debug("Custom wheel resolved URLs:",f)}null!=e.streamlitConfig&&l(e.streamlitConfig),this._workerInitData={entrypoint:e.entrypoint,files:e.files,archives:e.archives,requirements:e.requirements,prebuiltPackageNames:e.prebuiltPackageNames,pyodideUrl:e.pyodideUrl,wheels:f,streamlitConfig:e.streamlitConfig,idbfsMountpoints:e.idbfsMountpoints,moduleAutoLoad:null!==(a=e.moduleAutoLoad)&&void 0!==a&&a}}get loaded(){return this._loaded.promise}connectWebSocket(e){return this._asyncPostMessage({type:"websocket:connect",data:{path:e}})}sendWebSocketMessage(e){return this._asyncPostMessage({type:"websocket:send",data:{payload:e}})}onWebSocketMessage(e){this.handleWebSocketMessage=e}sendHttpRequest(e){return this._asyncPostMessage({type:"http:request",data:{request:e}},"http:response").then((e=>({...e.response,headers:new Headers(Object.fromEntries(e.response.headers))})))}writeFile(e,t,n){return this._asyncPostMessage({type:"file:write",data:{path:e,data:t,opts:n}})}renameFile(e,t){return this._asyncPostMessage({type:"file:rename",data:{oldPath:e,newPath:t}})}readFile(e,t){return this._asyncPostMessage({type:"file:read",data:{path:e,opts:t}},"reply:file:read").then((e=>e.content))}unlink(e){return this._asyncPostMessage({type:"file:unlink",data:{path:e}})}install(e){return this._asyncPostMessage({type:"install",data:{requirements:e}})}reboot(e){return this._asyncPostMessage({type:"reboot",data:{entrypoint:e}})}_asyncPostMessage(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"reply";return new Promise(((n,r)=>{const o=new MessageChannel;o.port1.onmessage=e=>{o.port1.close();const i=e.data;if(i.error)r(i.error);else{if(i.type!==t)throw new Error(`Unexpected reply type "${i.type}"`);n(i.data)}},this._postMessageTarget.postMessage(e,[o.port2])}))}_processWorkerMessage(e,t){switch(e.type){case"event:start":this._postMessageTarget.postMessage({type:"initData",data:this._workerInitData});break;case"event:progress":this.onProgress&&this.onProgress(e.data.message);break;case"event:error":this.onError&&this.onError(e.data.error);break;case"event:loaded":this._loaded.resolve(),this.onLoad&&this.onLoad();break;case"websocket:message":{const{payload:t}=e.data;this.handleWebSocketMessage&&this.handleWebSocketMessage(t);break}case"event:moduleAutoLoad":if(null==t)throw new Error("Port is required for moduleAutoLoad event");this.onModuleAutoLoad&&this.onModuleAutoLoad(e.data.packagesToLoad,new Promise(((e,n)=>{t.onmessage=r=>{const o=r.data;"moduleAutoLoad:success"===o.type?e(o.data.loadedPackages):n(o.error),t.close()}})))}}get isDisposed(){return this._isDisposed}dispose(){this.isDisposed||(this._worker instanceof SharedWorker?this._worker.port.close():this._worker.terminate(),this._isDisposed=!0)}}var f=n(80812),h=n(72176);const m=h.createContext(void 0),M=m.Provider;function g(e){const{children:t,kernel:n}=e,r=(0,h.useMemo)((()=>({kernel:n})),[n]);return(0,f.jsx)(M,{value:r,children:t})}function O(){const e=(0,h.useContext)(m);if(null==e)throw new Error("useStliteKernel() must be inside <StliteKernelProvider />");return e.kernel}function z(e,t){return e.sendHttpRequest({method:"GET",path:t,headers:{},body:""}).then((e=>{let{statusCode:t,headers:n,body:r}=e;if(200!==t)throw new Error(`Failed to fetch media object: ${t}`);const o=n.get("Content-Type"),i=new Blob([r],o?{type:o}:void 0);return URL.createObjectURL(i)}))}function y(e,t){return t.startsWith("/media")?z(e,t):Promise.resolve(t)}function A(e,t){return Promise.all([y(e,t.image),y(e,t.iconImage)]).then((e=>{let[n,r]=e;return t.image=n,t.iconImage=r,t}))}function v(e){const t=O(),[n,r]=(0,h.useState)(null);return(0,h.useEffect)((()=>{let n=!1;const o=[];return null==e?r(null):A(t,e).then((e=>{n||(o.push(e.image),o.push(e.iconImage),r(e))})),()=>{o.forEach((e=>{URL.revokeObjectURL(e)})),n=!0}}),[t,e]),n}function w(e){const t=O(),[n,r]=(0,h.useState)(e);return(0,h.useEffect)((()=>{if(null==t)return;if(!e.startsWith("/media"))return;let n=!1;const o=[];return z(t,e).then((e=>{n||(o.push(e),r(e))})),()=>{n=!0,o.forEach((e=>{URL.revokeObjectURL(e)}))}}),[t,e]),n}function S(e){const[t,n]=(0,h.useState)(e),r=O();return(0,h.useEffect)((()=>{if(null==r)return;let t=!1;const o=[],i=e.map((e=>null==e.url?e:e.url.startsWith("/media")?z(r,e.url).then((n=>t?e:(o.push(n),{...e,url:n}))):e));return Promise.all(i).then((e=>{t||n(e)})),()=>{t=!0,o.forEach((e=>{URL.revokeObjectURL(e)}))}}),[r,e]),t}const q=/%([0-9A-Fa-f]{2})/g,E=/[^\x20-\x7e\xa0-\xff]/g,_=/\\([\u0000-\u007f])/g,x=/;[\x09\x20]*([!#$%&'*+.0-9A-Z^_`a-z|~-]+)[\x09\x20]*=[\x09\x20]*("(?:[\x20!\x23-\x5b\x5d-\x7e\x80-\xff]|\\[\x20-\x7e])*"|[!#$%&'*+.0-9A-Z^_`a-z|~-]+)[\x09\x20]*/g,T=/^([A-Za-z0-9!#$%&+\-^_`{}~]+)'(?:[A-Za-z]{2,3}(?:-[A-Za-z]{3}){0,3}|[A-Za-z]{4,8}|)'((?:%[0-9A-Fa-f]{2}|[A-Za-z0-9!#$&+.^_`|~-])+)$/,R=/^([!#$%&'*+.0-9A-Z^_`a-z|~-]+)[\x09\x20]*(?:$|;)/,k=e=>String(e).replace(E,"?");class N{constructor(e,t){this.type=e,this.parameters=t}}const C=(e,t)=>String.fromCharCode(Number.parseInt(t,16));function W(e){const t=T.exec(e);if(!t)throw new TypeError("invalid extended field value");const n=t[1].toLowerCase(),r=t[2];let o;switch(n){case"iso-8859-1":o=k(r.replace(q,C));break;case"utf-8":try{o=decodeURIComponent(r)}catch{throw new TypeError("invalid encoded utf-8")}break;default:throw new TypeError("unsupported charset in extended field")}return o}function L(e){const t=function(e){let t=R.exec(e);if(!t)throw new TypeError("invalid type format");let n=t[0].length;const r=t[1].toLowerCase();let o;const i=[],a={};let s;for(n=x.lastIndex=";"===t[0].slice(-1)?n-1:n;t=x.exec(e);){if(t.index!==n)throw new TypeError("invalid parameter format");if(n+=t[0].length,o=t[1].toLowerCase(),s=t[2],-1!==i.indexOf(o))throw new TypeError("invalid duplicate parameter");i.push(o),o.indexOf("*")+1!==o.length?"string"!==typeof a[o]&&('"'===s[0]&&(s=s.slice(1,s.length-1).replace(_,"$1")),a[o]=s):(o=o.slice(0,-1),s=W(s),a[o]=s)}if(-1!==n&&n!==e.length)throw new TypeError("invalid parameter format");return new N(r,a)}(e);if("attachment"!==t.type)return;const n=t.parameters.filename;return"string"===typeof n?n:void 0}function I(e,t){e.sendHttpRequest({method:"GET",path:`${t}?title=${encodeURIComponent(document.title)}`,headers:{},body:""}).then((e=>{var t;let{statusCode:n,headers:r,body:o}=e;if(200!==n)return;const i=r.get("Content-Disposition"),a=null!==(t=i&&L(i))&&void 0!==t?t:"",s=r.get("Content-Type"),l=new Blob([o],s?{type:s}:void 0),c=URL.createObjectURL(l),u=document.createElement("a");u.setAttribute("href",c),u.setAttribute("target","_blank"),u.setAttribute("download",a),u.click(),URL.revokeObjectURL(c),u.remove()}))}const P="xxx",D=99999,B=P+":"+D.toString();function j(e){const t=e.split("/").slice(0,-1).join("/");return t.startsWith("/")?t:"/"+t}function F(e,t,n){const r=j(t);if(!(n.host===e&&n.pathname.startsWith(r)))return null;const o=n.pathname.slice(r.length);return o.startsWith("/")?o.slice(1):o}const U=h.forwardRef(((e,t)=>{let{src:n,...r}=e;const i=O(),[a,s]=(0,h.useState)();(0,h.useEffect)((()=>{if(null==i)return;if(!n.startsWith("/component"))return;let e=!1;return i.sendHttpRequest({method:"GET",path:n,headers:{},body:""}).then((t=>{let{statusCode:n,headers:r,body:o}=t;if(e)return;if(200!==n)return;const i=r.get("Content-Type");new Blob([o],i?{type:i}:void 0).text().then((t=>{e||s(t)}))})),()=>{e=!0}}),[i,n]);const l=(0,h.useCallback)((e=>{var t;const r=null===(t=e.target.contentWindow)||void 0===t?void 0:t.document;null!=r?function(e,t,n){const r=[],i=t.getElementsByTagName("script");for(const s of i){if(""===s.src)continue;const i=F(window.location.host,window.location.pathname,new URL(s.src));if(null==i)continue;const a=o.URLExt.join(n,i),l=e.sendHttpRequest({method:"GET",headers:{},path:a,body:""}).then((e=>{let{statusCode:n,headers:r,body:o}=e;if(200!==n)return;const i=r.get("Content-Type");return new Blob([o],i?{type:i}:void 0).text().then((e=>{const n=t.createElement("script");n.text=e,n.type="text/javascript",n.setAttribute("data-stlite",""),s.replaceWith(n)}))}));r.push(l)}const a=t.querySelectorAll("link[rel=stylesheet]");for(const s of a){const i=F(window.location.host,window.location.pathname,new URL(s.href));if(null==i)continue;const a=o.URLExt.join(n,i),l=e.sendHttpRequest({method:"GET",headers:{},path:a,body:""}).then((e=>{let{statusCode:n,headers:r,body:o}=e;if(200!==n)return;const i=r.get("Content-Type");return new Blob([o],i?{type:i}:void 0).text().then((e=>{const n=t.createElement("style");n.innerHTML=e,n.setAttribute("data-stlite",""),s.replaceWith(n)}))}));r.push(l)}Promise.all(r).then()}(i,r,j(n)):console.warn("document not found in iframe")}),[i,n]);return(0,f.jsx)("iframe",{...r,srcDoc:a,onLoad:l,ref:t})}));U.displayName="InnerIFrame";const V=h.forwardRef(((e,t)=>{const n=function(e,t){const n=(B+"/"+e).replace(/\/$/,""),r=new RegExp(`https?://${n}(/.*?$)`),o=t.match(r);return null==o?null:o[1]}(O().basePath,e.src);return null==n?(0,f.jsx)("iframe",{...e,ref:t}):(0,f.jsx)(U,{...e,src:n,ref:t})}));V.displayName="StliteCustomComponentIFrame";const H=V},2343:(e,t,n)=>{"use strict";n.d(t,{LD:()=>r});const r=3e3===+window.location.port},82398:(e,t,n)=>{"use strict";n.d(t,{A:()=>r});const r=n(72176).createContext(!1)},59834:(e,t,n)=>{"use strict";n.d(t,{A:()=>r});const r=n(72176).createContext(!1)},32057:(e,t,n)=>{"use strict";n.d(t,{n:()=>i});var r=n(72176),o=n(21564);const i=r.createContext({isFullScreen:!1,setFullScreen:()=>{},addScriptFinishedHandler:()=>{},removeScriptFinishedHandler:()=>{},activeTheme:o.$7,setTheme:()=>{},availableThemes:[],addThemes:()=>{},onPageChange:()=>{},currentPageScriptHash:"",libConfig:{},fragmentIdsThisRun:[],locale:window.navigator.language})},46815:(e,t,n)=>{"use strict";n.d(t,{E:()=>r});const r=n(72176).createContext(null)},58263:(e,t,n)=>{"use strict";n.d(t,{A:()=>h,b:()=>f});n(72176);var r=n(60265),o=n(40252),i=n(20052),a=n(45460),s=n(80333),l=n(271),c=n(29847),u=n(37920),p=n(43417);const d=(0,l.A)("div",{target:"e1eexb540"})((e=>{let{theme:t}=e;return{display:"flex",gap:t.spacing.sm,width:"100%",[`${c.Dz}, ${c.vE}, ${p.q}`]:{position:"relative",top:"2px"},[`${u.c3} code`]:{paddingRight:t.spacing.lg}}}),"");var b=n(80812);function f(e){switch(e){case o.Fc.Format.ERROR:return s.b.ERROR;case o.Fc.Format.INFO:return s.b.INFO;case o.Fc.Format.SUCCESS:return s.b.SUCCESS;case o.Fc.Format.WARNING:return s.b.WARNING;default:throw new Error(`Unexpected alert type: ${e}`)}}function h(e){let{icon:t,body:n,kind:o,width:l}=e;const c=(0,r.u)(),u={width:t?`calc(100% - (${c.iconSizes.lg} + ${c.spacing.sm}))`:"100%"};return(0,b.jsx)("div",{className:"stAlert","data-testid":"stAlert",children:(0,b.jsx)(s.A,{width:l,kind:o,children:(0,b.jsxs)(d,{children:[t&&(0,b.jsx)(a.$,{iconValue:t,size:"lg",testid:"stAlertDynamicIcon"}),(0,b.jsx)(i.Ay,{source:n,allowHTML:!1,style:u})]})})})}},9148:(e,t,n)=>{"use strict";n.r(t),n.d(t,{default:()=>U});var r=n(72176),o=n(89575),i=n(24586);function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function s(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?a(Object(n),!0).forEach((function(t){(0,i.A)(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):a(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var l={};function c(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2?arguments[2]:void 0;return function(e){if(0===e.length||1===e.length)return e;var t=e.join(".");return l[t]||(l[t]=function(e){var t=e.length;return 0===t||1===t?e:2===t?[e[0],e[1],"".concat(e[0],".").concat(e[1]),"".concat(e[1],".").concat(e[0])]:3===t?[e[0],e[1],e[2],"".concat(e[0],".").concat(e[1]),"".concat(e[0],".").concat(e[2]),"".concat(e[1],".").concat(e[0]),"".concat(e[1],".").concat(e[2]),"".concat(e[2],".").concat(e[0]),"".concat(e[2],".").concat(e[1]),"".concat(e[0],".").concat(e[1],".").concat(e[2]),"".concat(e[0],".").concat(e[2],".").concat(e[1]),"".concat(e[1],".").concat(e[0],".").concat(e[2]),"".concat(e[1],".").concat(e[2],".").concat(e[0]),"".concat(e[2],".").concat(e[0],".").concat(e[1]),"".concat(e[2],".").concat(e[1],".").concat(e[0])]:t>=4?[e[0],e[1],e[2],e[3],"".concat(e[0],".").concat(e[1]),"".concat(e[0],".").concat(e[2]),"".concat(e[0],".").concat(e[3]),"".concat(e[1],".").concat(e[0]),"".concat(e[1],".").concat(e[2]),"".concat(e[1],".").concat(e[3]),"".concat(e[2],".").concat(e[0]),"".concat(e[2],".").concat(e[1]),"".concat(e[2],".").concat(e[3]),"".concat(e[3],".").concat(e[0]),"".concat(e[3],".").concat(e[1]),"".concat(e[3],".").concat(e[2]),"".concat(e[0],".").concat(e[1],".").concat(e[2]),"".concat(e[0],".").concat(e[1],".").concat(e[3]),"".concat(e[0],".").concat(e[2],".").concat(e[1]),"".concat(e[0],".").concat(e[2],".").concat(e[3]),"".concat(e[0],".").concat(e[3],".").concat(e[1]),"".concat(e[0],".").concat(e[3],".").concat(e[2]),"".concat(e[1],".").concat(e[0],".").concat(e[2]),"".concat(e[1],".").concat(e[0],".").concat(e[3]),"".concat(e[1],".").concat(e[2],".").concat(e[0]),"".concat(e[1],".").concat(e[2],".").concat(e[3]),"".concat(e[1],".").concat(e[3],".").concat(e[0]),"".concat(e[1],".").concat(e[3],".").concat(e[2]),"".concat(e[2],".").concat(e[0],".").concat(e[1]),"".concat(e[2],".").concat(e[0],".").concat(e[3]),"".concat(e[2],".").concat(e[1],".").concat(e[0]),"".concat(e[2],".").concat(e[1],".").concat(e[3]),"".concat(e[2],".").concat(e[3],".").concat(e[0]),"".concat(e[2],".").concat(e[3],".").concat(e[1]),"".concat(e[3],".").concat(e[0],".").concat(e[1]),"".concat(e[3],".").concat(e[0],".").concat(e[2]),"".concat(e[3],".").concat(e[1],".").concat(e[0]),"".concat(e[3],".").concat(e[1],".").concat(e[2]),"".concat(e[3],".").concat(e[2],".").concat(e[0]),"".concat(e[3],".").concat(e[2],".").concat(e[1]),"".concat(e[0],".").concat(e[1],".").concat(e[2],".").concat(e[3]),"".concat(e[0],".").concat(e[1],".").concat(e[3],".").concat(e[2]),"".concat(e[0],".").concat(e[2],".").concat(e[1],".").concat(e[3]),"".concat(e[0],".").concat(e[2],".").concat(e[3],".").concat(e[1]),"".concat(e[0],".").concat(e[3],".").concat(e[1],".").concat(e[2]),"".concat(e[0],".").concat(e[3],".").concat(e[2],".").concat(e[1]),"".concat(e[1],".").concat(e[0],".").concat(e[2],".").concat(e[3]),"".concat(e[1],".").concat(e[0],".").concat(e[3],".").concat(e[2]),"".concat(e[1],".").concat(e[2],".").concat(e[0],".").concat(e[3]),"".concat(e[1],".").concat(e[2],".").concat(e[3],".").concat(e[0]),"".concat(e[1],".").concat(e[3],".").concat(e[0],".").concat(e[2]),"".concat(e[1],".").concat(e[3],".").concat(e[2],".").concat(e[0]),"".concat(e[2],".").concat(e[0],".").concat(e[1],".").concat(e[3]),"".concat(e[2],".").concat(e[0],".").concat(e[3],".").concat(e[1]),"".concat(e[2],".").concat(e[1],".").concat(e[0],".").concat(e[3]),"".concat(e[2],".").concat(e[1],".").concat(e[3],".").concat(e[0]),"".concat(e[2],".").concat(e[3],".").concat(e[0],".").concat(e[1]),"".concat(e[2],".").concat(e[3],".").concat(e[1],".").concat(e[0]),"".concat(e[3],".").concat(e[0],".").concat(e[1],".").concat(e[2]),"".concat(e[3],".").concat(e[0],".").concat(e[2],".").concat(e[1]),"".concat(e[3],".").concat(e[1],".").concat(e[0],".").concat(e[2]),"".concat(e[3],".").concat(e[1],".").concat(e[2],".").concat(e[0]),"".concat(e[3],".").concat(e[2],".").concat(e[0],".").concat(e[1]),"".concat(e[3],".").concat(e[2],".").concat(e[1],".").concat(e[0])]:void 0}(e)),l[t]}(e.filter((function(e){return"token"!==e}))).reduce((function(e,t){return s(s({},e),n[t])}),t)}function u(e){return e.join(" ")}function p(e){var t=e.node,n=e.stylesheet,i=e.style,a=void 0===i?{}:i,l=e.useInlineStyles,d=e.key,b=t.properties,f=t.type,h=t.tagName,m=t.value;if("text"===f)return m;if(h){var M,g=function(e,t){var n=0;return function(r){return n+=1,r.map((function(r,o){return p({node:r,stylesheet:e,useInlineStyles:t,key:"code-segment-".concat(n,"-").concat(o)})}))}}(n,l);if(l){var O=Object.keys(n).reduce((function(e,t){return t.split(".").forEach((function(t){e.includes(t)||e.push(t)})),e}),[]),z=b.className&&b.className.includes("token")?["token"]:[],y=b.className&&z.concat(b.className.filter((function(e){return!O.includes(e)})));M=s(s({},b),{},{className:u(y)||void 0,style:c(b.className,Object.assign({},b.style,a),n)})}else M=s(s({},b),{},{className:u(b.className)});var A=g(t.children);return r.createElement(h,(0,o.A)({key:d},M),A)}}var d=n(39850),b=n(64619);const f=function(e,t){return-1!==e.listLanguages().indexOf(t)};var h=["language","children","style","customStyle","codeTagProps","useInlineStyles","showLineNumbers","showInlineLineNumbers","startingLineNumber","lineNumberContainerStyle","lineNumberStyle","wrapLines","wrapLongLines","lineProps","renderer","PreTag","CodeTag","code","astGenerator"];function m(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function M(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?m(Object(n),!0).forEach((function(t){(0,i.A)(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):m(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var g=/\n/g;function O(e){var t=e.codeString,n=e.codeStyle,o=e.containerStyle,i=void 0===o?{float:"left",paddingRight:"10px"}:o,a=e.numberStyle,s=void 0===a?{}:a,l=e.startingLineNumber;return r.createElement("code",{style:Object.assign({},n,i)},function(e){var t=e.lines,n=e.startingLineNumber,o=e.style;return t.map((function(e,t){var i=t+n;return r.createElement("span",{key:"line-".concat(t),className:"react-syntax-highlighter-line-number",style:"function"===typeof o?o(i):o},"".concat(i,"\n"))}))}({lines:t.replace(/\n$/,"").split("\n"),style:s,startingLineNumber:l}))}function z(e,t){return{type:"element",tagName:"span",properties:{key:"line-number--".concat(e),className:["comment","linenumber","react-syntax-highlighter-line-number"],style:t},children:[{type:"text",value:e}]}}function y(e,t,n){var r,o={display:"inline-block",minWidth:(r=n,"".concat(r.toString().length,".25em")),paddingRight:"1em",textAlign:"right",userSelect:"none"},i="function"===typeof e?e(t):e;return M(M({},o),i)}function A(e){var t=e.children,n=e.lineNumber,r=e.lineNumberStyle,o=e.largestLineNumber,i=e.showInlineLineNumbers,a=e.lineProps,s=void 0===a?{}:a,l=e.className,c=void 0===l?[]:l,u=e.showLineNumbers,p=e.wrapLongLines,d="function"===typeof s?s(n):s;if(d.className=c,n&&i){var b=y(r,n,o);t.unshift(z(n,b))}return p&u&&(d.style=M(M({},d.style),{},{display:"flex"})),{type:"element",tagName:"span",properties:d,children:t}}function v(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],r=0;r<e.length;r++){var o=e[r];if("text"===o.type)n.push(A({children:[o],className:(0,b.A)(new Set(t))}));else if(o.children){var i=t.concat(o.properties.className);v(o.children,i).forEach((function(e){return n.push(e)}))}}return n}function w(e,t,n,r,o,i,a,s,l){var c,u=v(e.value),p=[],d=-1,b=0;function f(e,i){var c=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];return t||c.length>0?function(e,t){return A({children:e,lineNumber:t,lineNumberStyle:s,largestLineNumber:a,showInlineLineNumbers:o,lineProps:n,className:arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],showLineNumbers:r,wrapLongLines:l})}(e,i,c):function(e,t){if(r&&t&&o){var n=y(s,t,a);e.unshift(z(t,n))}return e}(e,i)}for(var h=function(){var e=u[b],t=e.children[0].value;if(t.match(g)){var n=t.split("\n");n.forEach((function(t,o){var a=r&&p.length+i,s={type:"text",value:"".concat(t,"\n")};if(0===o){var l=f(u.slice(d+1,b).concat(A({children:[s],className:e.properties.className})),a);p.push(l)}else if(o===n.length-1){var c=u[b+1]&&u[b+1].children&&u[b+1].children[0],h={type:"text",value:"".concat(t)};if(c){var m=A({children:[h],className:e.properties.className});u.splice(b+1,0,m)}else{var M=f([h],a,e.properties.className);p.push(M)}}else{var g=f([s],a,e.properties.className);p.push(g)}})),d=b}b++};b<u.length;)h();if(d!==u.length-1){var m=u.slice(d+1,u.length);if(m&&m.length){var M=f(m,r&&p.length+i);p.push(M)}}return t?p:(c=[]).concat.apply(c,p)}function S(e){var t=e.rows,n=e.stylesheet,r=e.useInlineStyles;return t.map((function(e,t){return p({node:e,stylesheet:n,useInlineStyles:r,key:"code-segement".concat(t)})}))}function q(e){return e&&"undefined"!==typeof e.highlightAuto}var E=n(13);var _,x,T=(_=n.n(E)(),x={'code[class*="language-"]':{color:"black",background:"none",textShadow:"0 1px white",fontFamily:"Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace",fontSize:"1em",textAlign:"left",whiteSpace:"pre",wordSpacing:"normal",wordBreak:"normal",wordWrap:"normal",lineHeight:"1.5",MozTabSize:"4",OTabSize:"4",tabSize:"4",WebkitHyphens:"none",MozHyphens:"none",msHyphens:"none",hyphens:"none"},'pre[class*="language-"]':{color:"black",background:"#f5f2f0",textShadow:"0 1px white",fontFamily:"Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace",fontSize:"1em",textAlign:"left",whiteSpace:"pre",wordSpacing:"normal",wordBreak:"normal",wordWrap:"normal",lineHeight:"1.5",MozTabSize:"4",OTabSize:"4",tabSize:"4",WebkitHyphens:"none",MozHyphens:"none",msHyphens:"none",hyphens:"none",padding:"1em",margin:".5em 0",overflow:"auto"},'pre[class*="language-"]::-moz-selection':{textShadow:"none",background:"#b3d4fc"},'pre[class*="language-"] ::-moz-selection':{textShadow:"none",background:"#b3d4fc"},'code[class*="language-"]::-moz-selection':{textShadow:"none",background:"#b3d4fc"},'code[class*="language-"] ::-moz-selection':{textShadow:"none",background:"#b3d4fc"},'pre[class*="language-"]::selection':{textShadow:"none",background:"#b3d4fc"},'pre[class*="language-"] ::selection':{textShadow:"none",background:"#b3d4fc"},'code[class*="language-"]::selection':{textShadow:"none",background:"#b3d4fc"},'code[class*="language-"] ::selection':{textShadow:"none",background:"#b3d4fc"},':not(pre) > code[class*="language-"]':{background:"#f5f2f0",padding:".1em",borderRadius:".3em",whiteSpace:"normal"},comment:{color:"slategray"},prolog:{color:"slategray"},doctype:{color:"slategray"},cdata:{color:"slategray"},punctuation:{color:"#999"},namespace:{Opacity:".7"},property:{color:"#905"},tag:{color:"#905"},boolean:{color:"#905"},number:{color:"#905"},constant:{color:"#905"},symbol:{color:"#905"},deleted:{color:"#905"},selector:{color:"#690"},"attr-name":{color:"#690"},string:{color:"#690"},char:{color:"#690"},builtin:{color:"#690"},inserted:{color:"#690"},operator:{color:"#9a6e3a",background:"hsla(0, 0%, 100%, .5)"},entity:{color:"#9a6e3a",background:"hsla(0, 0%, 100%, .5)",cursor:"help"},url:{color:"#9a6e3a",background:"hsla(0, 0%, 100%, .5)"},".language-css .token.string":{color:"#9a6e3a",background:"hsla(0, 0%, 100%, .5)"},".style .token.string":{color:"#9a6e3a",background:"hsla(0, 0%, 100%, .5)"},atrule:{color:"#07a"},"attr-value":{color:"#07a"},keyword:{color:"#07a"},function:{color:"#DD4A68"},"class-name":{color:"#DD4A68"},regex:{color:"#e90"},important:{color:"#e90",fontWeight:"bold"},variable:{color:"#e90"},bold:{fontWeight:"bold"},italic:{fontStyle:"italic"}},function(e){var t=e.language,n=e.children,o=e.style,i=void 0===o?x:o,a=e.customStyle,s=void 0===a?{}:a,l=e.codeTagProps,c=void 0===l?{className:t?"language-".concat(t):void 0,style:M(M({},i['code[class*="language-"]']),i['code[class*="language-'.concat(t,'"]')])}:l,u=e.useInlineStyles,p=void 0===u||u,b=e.showLineNumbers,m=void 0!==b&&b,g=e.showInlineLineNumbers,z=void 0===g||g,y=e.startingLineNumber,A=void 0===y?1:y,v=e.lineNumberContainerStyle,E=e.lineNumberStyle,T=void 0===E?{}:E,R=e.wrapLines,k=e.wrapLongLines,N=void 0!==k&&k,C=e.lineProps,W=void 0===C?{}:C,L=e.renderer,I=e.PreTag,P=void 0===I?"pre":I,D=e.CodeTag,B=void 0===D?"code":D,j=e.code,F=void 0===j?(Array.isArray(n)?n[0]:n)||"":j,U=e.astGenerator,V=(0,d.A)(e,h);U=U||_;var H=m?r.createElement(O,{containerStyle:v,codeStyle:c.style||{},numberStyle:T,startingLineNumber:A,codeString:F}):null,X=i.hljs||i['pre[class*="language-"]']||{backgroundColor:"#fff"},$=q(U)?"hljs":"prismjs",G=p?Object.assign({},V,{style:Object.assign({},X,s)}):Object.assign({},V,{className:V.className?"".concat($," ").concat(V.className):$,style:Object.assign({},s)});if(c.style=M(M({},c.style),{},N?{whiteSpace:"pre-wrap"}:{whiteSpace:"pre"}),!U)return r.createElement(P,G,H,r.createElement(B,c,F));(void 0===R&&L||N)&&(R=!0),L=L||S;var K=[{type:"text",value:F}],Y=function(e){var t=e.astGenerator,n=e.language,r=e.code,o=e.defaultCodeValue;if(q(t)){var i=f(t,n);return"text"===n?{value:o,language:"text"}:i?t.highlight(n,r):t.highlightAuto(r)}try{return n&&"text"!==n?{value:t.highlight(r,n)}:{value:o}}catch(a){return{value:o}}}({astGenerator:U,language:t,code:F,defaultCodeValue:K});null===Y.language&&(Y.value=K);var J=w(Y,R,W,m,z,A,Y.value.length+A,T,N);return r.createElement(P,G,r.createElement(B,c,!z&&H,L({rows:J,stylesheet:i,useInlineStyles:p})))});T.supportedLanguages=["abap","abnf","actionscript","ada","agda","al","antlr4","apacheconf","apex","apl","applescript","aql","arduino","arff","asciidoc","asm6502","asmatmel","aspnet","autohotkey","autoit","avisynth","avro-idl","bash","basic","batch","bbcode","bicep","birb","bison","bnf","brainfuck","brightscript","bro","bsl","c","cfscript","chaiscript","cil","clike","clojure","cmake","cobol","coffeescript","concurnas","coq","cpp","crystal","csharp","cshtml","csp","css-extras","css","csv","cypher","d","dart","dataweave","dax","dhall","diff","django","dns-zone-file","docker","dot","ebnf","editorconfig","eiffel","ejs","elixir","elm","erb","erlang","etlua","excel-formula","factor","false","firestore-security-rules","flow","fortran","fsharp","ftl","gap","gcode","gdscript","gedcom","gherkin","git","glsl","gml","gn","go-module","go","graphql","groovy","haml","handlebars","haskell","haxe","hcl","hlsl","hoon","hpkp","hsts","http","ichigojam","icon","icu-message-format","idris","iecst","ignore","inform7","ini","io","j","java","javadoc","javadoclike","javascript","javastacktrace","jexl","jolie","jq","js-extras","js-templates","jsdoc","json","json5","jsonp","jsstacktrace","jsx","julia","keepalived","keyman","kotlin","kumir","kusto","latex","latte","less","lilypond","liquid","lisp","livescript","llvm","log","lolcode","lua","magma","makefile","markdown","markup-templating","markup","matlab","maxscript","mel","mermaid","mizar","mongodb","monkey","moonscript","n1ql","n4js","nand2tetris-hdl","naniscript","nasm","neon","nevod","nginx","nim","nix","nsis","objectivec","ocaml","opencl","openqasm","oz","parigp","parser","pascal","pascaligo","pcaxis","peoplecode","perl","php-extras","php","phpdoc","plsql","powerquery","powershell","processing","prolog","promql","properties","protobuf","psl","pug","puppet","pure","purebasic","purescript","python","q","qml","qore","qsharp","r","racket","reason","regex","rego","renpy","rest","rip","roboconf","robotframework","ruby","rust","sas","sass","scala","scheme","scss","shell-session","smali","smalltalk","smarty","sml","solidity","solution-file","soy","sparql","splunk-spl","sqf","sql","squirrel","stan","stylus","swift","systemd","t4-cs","t4-templating","t4-vb","tap","tcl","textile","toml","tremor","tsx","tt2","turtle","twig","typescript","typoscript","unrealscript","uorazor","uri","v","vala","vbnet","velocity","verilog","vhdl","vim","visual-basic","warpscript","wasm","web-idl","wiki","wolfram","wren","xeora","xml-doc","xojo","xquery","yaml","yang","zig"];const R=T;var k=n(73668),N=n.n(k),C=n(15360),W=n.n(C);function L(){return L=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},L.apply(this,arguments)}function I(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var P=(0,r.forwardRef)((function(e,t){var n=e.color,o=void 0===n?"currentColor":n,i=e.size,a=void 0===i?24:i,s=I(e,["color","size"]);return r.createElement("svg",L({ref:t,xmlns:"http://www.w3.org/2000/svg",width:a,height:a,viewBox:"0 0 24 24",fill:"none",stroke:o,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},s),r.createElement("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),r.createElement("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"}))}));P.propTypes={color:W().string,size:W().oneOfType([W().string,W().number])},P.displayName="Copy";const D=P;var B=n(37920),j=n(80812);const F=e=>{let{text:t}=e;const n=(0,r.useRef)(null),o=(0,r.useRef)(null);return(0,r.useEffect)((()=>{const e=n.current;var t;null!==e&&(o.current=new(N())(e,{container:null!==(t=e.parentElement)&&void 0!==t?t:void 0}));return()=>{null!==o.current&&o.current.destroy()}}),[]),(0,j.jsx)(B.xd,{"data-testid":"stCodeCopyButton",title:"Copy to clipboard",ref:n,"data-clipboard-text":t,style:{top:0,right:0},children:(0,j.jsx)(D,{size:"16"})})};function U(e){let{language:t,showLineNumbers:n,wrapLines:o,children:i}=e;const a=(0,r.useCallback)((e=>{let{rows:t,stylesheet:n,useInlineStyles:r}=e;return t.map(((e,t)=>{const o=e.children;if(o){const t=o.shift();t&&(e.children=[t,{children:o,properties:{className:[]},tagName:"span",type:"element"}])}return p({node:e,stylesheet:n,useInlineStyles:r,key:t})}))}),[]);return(0,j.jsxs)(B.c3,{className:"stCode","data-testid":"stCode",children:[(0,j.jsx)(B.rs,{children:(0,j.jsx)(R,{language:t,PreTag:"div",customStyle:{backgroundColor:"transparent"},style:{},lineNumberStyle:{},showLineNumbers:n,wrapLongLines:o,renderer:n&&o?a:void 0,children:i})}),"string"===typeof i&&""!==i.trim()&&(0,j.jsx)(B.Wh,{children:(0,j.jsx)(F,{text:i})})]})}},37920:(e,t,n)=>{"use strict";n.d(t,{Wh:()=>c,c3:()=>u,m7:()=>i,pR:()=>s,rs:()=>l,xd:()=>p});var r=n(271);const o={"a > &":{color:"inherit"}},i=(0,r.A)("code",{target:"e1ycw9pz5"})((e=>{let{theme:t}=e;return{padding:"0.2em 0.4em",wordWrap:"break-word",margin:0,borderRadius:t.radii.md,background:t.colors.codeHighlightColor,color:t.colors.codeTextColor,fontFamily:t.genericFonts.codeFont,fontSize:"0.75em",...o}}),""),a=e=>({background:"transparent",border:0,color:"inherit",display:"inline",fontSize:e.fontSizes.sm,lineHeight:"inherit",margin:0,overflowX:"auto",padding:0,whiteSpace:"pre",wordBreak:"normal",wordWrap:"normal",...o}),s=(0,r.A)("code",{target:"e1ycw9pz4"})((e=>{let{theme:t}=e;return{...a(t)}}),""),l=(0,r.A)("pre",{target:"e1ycw9pz3"})((e=>{let{theme:t}=e;return{background:t.colors.codeHighlightColor,borderRadius:t.radii.default,color:t.colors.bodyText,fontSize:t.fontSizes.twoSm,display:"block",margin:0,msOverflowStyle:"scrollbar",overflow:"auto",padding:t.spacing.lg,paddingRight:t.iconSizes.threeXL,code:{...a(t)},".comment.linenumber":{color:t.colors.fadedText40,fontSize:t.fontSizes.twoSm,alignSelf:"center",minWidth:`${t.spacing.threeXL} !important`},".token.comment, .token.prolog, .token.doctype, .token.cdata":{color:t.colors.gray70},".token.punctuation":{color:t.colors.gray70},".namespace":{opacity:.7},".token.attr-name, .token.property, .token.variable":{color:t.colors.lightBlue80},".token.boolean, .token.constant, .token.symbol":{color:t.colors.green70},".token.number, .token.regex":{color:t.colors.blueGreen80},".token.string, .token.char, .token.attr-value":{color:t.colors.green80},".token.operator, .token.entity":{color:t.colors.orange90},".token.url":{color:t.colors.purple80},".token.decorator, .token.atrule":{color:t.colors.orange90},".token.keyword, .token.tag":{color:t.colors.blue70},".token.function, .token.class-name, .token.selector":{color:t.colors.blue70,fontWeight:t.fontWeights.extrabold},".token.important":{color:t.colors.red70,fontWeight:t.fontWeights.extrabold},".token.comment":{color:t.colors.gray70,fontStyle:"italic"},".token.italic":{fontStyle:"italic"},".token.entity":{cursor:"help"},".token.deleted.line, .token.deleted.prefix":{color:t.colors.red70},".token.inserted.line, .token.inserted.prefix":{color:t.colors.green70},".token.unchanged.line":{color:t.colors.gray70}}}),""),c=(0,r.A)("div",{target:"e1ycw9pz2"})((e=>{let{theme:t}=e;return{opacity:0,padding:`${t.spacing.sm} ${t.spacing.sm} 0 0`,top:0,right:0,position:"absolute",width:"100%",height:"100%",backgroundColor:t.colors.transparent,zIndex:t.zIndices.sidebar+1,display:"flex",justifyContent:"flex-end",alignItems:"flex-start",transition:"opacity 300ms 150ms",pointerEvents:"none"}}),""),u=(0,r.A)("div",{target:"e1ycw9pz1"})((e=>{let{theme:t}=e;return{position:"relative",marginLeft:t.spacing.none,marginRight:t.spacing.none,marginTop:t.spacing.none,marginBottom:void 0,"&:hover":{[`${c}`]:{opacity:1}}}}),""),p=(0,r.A)("button",{target:"e1ycw9pz0"})((e=>{let{theme:t}=e;return{pointerEvents:"auto",height:t.iconSizes.threeXL,width:t.iconSizes.threeXL,padding:t.spacing.none,border:"none",backgroundColor:t.colors.transparent,color:t.colors.fadedText60,transform:"scale(0)",[`${u}:hover &, &:active, &:focus, &:hover`]:{opacity:1,transform:"scale(1)",outline:"none",transition:"none",color:t.colors.bodyText}}}),"")},91075:(e,t,n)=>{"use strict";n.d(t,{E:()=>m});var r=n(72176),o=n(40252),i=n(271);const a={animationDuration:"750ms",animationName:n(60137).i7`
3
3
  0%, 100% {
4
4
  opacity: 0.5;
5
5
  }
@@ -25,5 +25,5 @@ var stlite;(()=>{var __webpack_modules__={87330:(e,t,n)=>{"use strict";n.d(t,{DZ
25
25
  }
26
26
  100% {
27
27
  opacity: 0;
28
- }`,Wp=(0,z.A)("div",{target:"e7qru6u0"})((e=>{let{theme:t}=e;return{position:"fixed",display:"flex",justifyContent:"center",alignItems:"center",top:0,left:0,width:t.sizes.full,height:t.sizes.full,fontSize:"40vh",color:t.colors.red,fontWeight:t.fontWeights.bold,opacity:"0.8",textShadow:`1px 1px 10px ${t.colors.darkGray}`,transition:"opacity 0.3s ease-in-out",animation:`${Cp} 1s`}}),""),Lp=e=>{let{countdown:n,endCallback:r}=e;const[o,i]=(0,t.useState)(n);return(0,h.jsx)(Wp,{"data-testid":"stCountdown",onAnimationEnd:()=>{const e=o-1;e>=0&&i(e),0===e&&r()},children:(0,h.jsx)("span",{children:o})},`frame${o}`)};const Ip=function(e){class n extends t.PureComponent{constructor(){super(...arguments),this.recorder=void 0,this.state={fileName:"streamlit-screencast",recordAudio:!1,currentState:this.props.testOverride||"OFF"},this.toggleRecordAudio=()=>{const{recordAudio:e}=this.state;this.setState({recordAudio:!e})},this.showDialog=e=>{const{currentState:t}=this.state;nc.isSupportedBrowser()?"OFF"===t?this.setState({fileName:e,currentState:"SETUP"}):this.stopRecording().catch((e=>(0,ce.FF)(`withScreencast.stopRecording threw an error: ${e}`))):this.setState({currentState:"UNSUPPORTED"})},this.startRecording=async()=>{const{recordAudio:e}=this.state;this.recorder=new nc({recordAudio:e,onErrorOrStop:()=>this.stopRecording()});try{await this.recorder.initialize()}catch(t){return(0,ce.FF)(`ScreenCastRecorder.initialize error: ${t}`),void this.setState({currentState:"UNSUPPORTED"})}this.setState({currentState:"COUNTDOWN"})},this.stopRecording=async()=>{let e;const{currentState:t}=this.state;"OFF"===t||(0,se.hX)(this.recorder)||("COUNTDOWN"===t&&this.setState({currentState:"OFF"}),"RECORDING"===t&&("inactive"===this.recorder.getState()?this.setState({currentState:"OFF"}):(e=await this.recorder.stop(),this.setState({outputBlob:e,currentState:"PREVIEW_FILE"}))))},this.onCountdownEnd=async()=>{if((0,se.hX)(this.recorder))throw new Error("Countdown finished but recorder is null");this.recorder.start()?this.setState({currentState:"RECORDING"}):this.stopRecording().catch((e=>(0,ce.FF)(`withScreencast.stopRecording threw an error: ${e}`)))},this.getScreenCastProps=()=>({currentState:this.state.currentState,toggleRecordAudio:this.toggleRecordAudio,startRecording:this.showDialog,stopRecording:this.stopRecording}),this.closeDialog=()=>{this.setState({currentState:"OFF"})},this.render=()=>{const{outputBlob:t,fileName:n,recordAudio:r,currentState:o}=this.state;return(0,h.jsxs)("div",{className:"withScreencast","data-testid":"stScreencast",children:[(0,h.jsx)(e,{...this.props,screenCast:this.getScreenCastProps()}),"UNSUPPORTED"===o&&(0,h.jsx)(Np,{onClose:this.closeDialog}),"SETUP"===o&&(0,h.jsx)(zp,{recordAudio:r,onClose:this.closeDialog,startRecording:this.startRecording,toggleRecordAudio:this.toggleRecordAudio}),"COUNTDOWN"===o&&(0,h.jsx)(Lp,{countdown:3,endCallback:this.onCountdownEnd}),"PREVIEW_FILE"===o&&t&&(0,h.jsx)(_p,{onClose:this.closeDialog,videoBlob:t,fileName:n})]})}}}return n.displayName=`withScreencast(${e.displayName||e.name})`,vo()(n,e)};function Pp(e){return e||"Streamlit"}class Dp{constructor(e){this.appPages=void 0,this.currentPageScriptHash=void 0,this.hideSidebarNav=void 0,this.appNav=void 0,this.appNav=e,this.appPages=[],this.currentPageScriptHash=null,this.hideSidebarNav=null}handleNewSession(e){var t,n,r,o,i;this.appPages=e.appPages,this.currentPageScriptHash=e.pageScriptHash,this.hideSidebarNav=null!==(t=null===(n=e.config)||void 0===n?void 0:n.hideSidebarNav)&&void 0!==t&&t;const a=this.appPages[0],s=null!==(r=a.urlPathname)&&void 0!==r?r:"",l=null!==(o=null===(i=this.appPages.find((e=>e.pageScriptHash===this.currentPageScriptHash)))||void 0===i?void 0:i.urlPathname)&&void 0!==o?o:"",c=a.pageScriptHash===this.currentPageScriptHash;return this.appNav.onUpdatePageUrl(s,l,c),document.title=Pp(null!==l&&void 0!==l?l:""),[{hideSidebarNav:this.hideSidebarNav,appPages:this.appPages,currentPageScriptHash:this.currentPageScriptHash},()=>{this.appNav.hostCommunicationMgr.sendMessageToHost({type:"SET_APP_PAGES",appPages:this.appPages}),this.appNav.hostCommunicationMgr.sendMessageToHost({type:"SET_CURRENT_PAGE_NAME",currentPageName:c?"":l,currentPageScriptHash:this.currentPageScriptHash})}]}handlePagesChanged(e){const{appPages:t}=e;return[{appPages:t},()=>{this.appNav.hostCommunicationMgr.sendMessageToHost({type:"SET_APP_PAGES",appPages:t})}]}handlePageNotFound(e){var t,n;const{pageName:r}=e;this.appNav.onPageNotFound(r);const o=null!==(t=null===(n=this.appPages[0])||void 0===n?void 0:n.pageScriptHash)&&void 0!==t?t:"";return this.currentPageScriptHash=o,[{currentPageScriptHash:o},()=>{this.appNav.hostCommunicationMgr.sendMessageToHost({type:"SET_CURRENT_PAGE_NAME",currentPageName:"",currentPageScriptHash:o})}]}handleNavigation(e){}findPageByUrlPath(e){var t;return 0===this.appPages.length?null:null!==(t=this.appPages.find((t=>e.endsWith("/"+t.urlPathname))))&&void 0!==t?t:this.appPages[0]}clearPageElements(e,t,n){return xe.empty(t,!1,n,e.logo)}}class Bp{constructor(e){this.appNav=void 0,this.mainScriptHash=void 0,this.appPages=void 0,this.mainPage=void 0,this.hideSidebarNav=void 0,this.appNav=e,this.mainScriptHash=null,this.appPages=[],this.mainPage=null,this.hideSidebarNav=null}handleNewSession(e){var t,n,r;(this.mainScriptHash=e.mainScriptHash,null===this.hideSidebarNav)&&(this.hideSidebarNav=null!==(n=null===(r=e.config)||void 0===r?void 0:r.hideSidebarNav)&&void 0!==n?n:null);return document.title=Pp(""),[{hideSidebarNav:null!==(t=this.hideSidebarNav)&&void 0!==t&&t},()=>{}]}handlePagesChanged(e){}handlePageNotFound(e){var t;const{pageName:n}=e;return this.appNav.onPageNotFound(n),[{currentPageScriptHash:null!==(t=this.mainScriptHash)&&void 0!==t?t:""},()=>{var e;this.appNav.hostCommunicationMgr.sendMessageToHost({type:"SET_CURRENT_PAGE_NAME",currentPageName:"",currentPageScriptHash:null!==(e=this.mainScriptHash)&&void 0!==e?e:""})}]}handleNavigation(e){var t,n;const{sections:r,position:o,appPages:i}=e;this.appPages=i,this.hideSidebarNav=o===ae.Vx.Position.HIDDEN;const a=e.pageScriptHash,s=i.find((e=>e.pageScriptHash===a)),l=i.find((e=>e.isDefault));this.mainPage=l;const c=s.urlPathname;if(!this.appNav.isPageTitleSet){var u;const e=Pp(s.pageName);document.title=e,this.appNav.hostCommunicationMgr.sendMessageToHost({type:"SET_PAGE_TITLE",title:null!==(u=s.pageName)&&void 0!==u?u:""})}return!this.appNav.isPageIconSet&&s.icon&&this.appNav.onPageIconChange(s.icon),this.appNav.onUpdatePageUrl(null!==(t=l.urlPathname)&&void 0!==t?t:"",c,null!==(n=s.isDefault)&&void 0!==n&&n),[{appPages:i,navSections:r,hideSidebarNav:this.hideSidebarNav,expandSidebarNav:e.expanded,currentPageScriptHash:a},()=>{this.appNav.hostCommunicationMgr.sendMessageToHost({type:"SET_APP_PAGES",appPages:i}),this.appNav.hostCommunicationMgr.sendMessageToHost({type:"SET_CURRENT_PAGE_NAME",currentPageName:s.isDefault?"":c,currentPageScriptHash:a})}]}findPageByUrlPath(e){var t;return null!==(t=this.appPages.find((t=>e.endsWith("/"+t.urlPathname))))&&void 0!==t?t:this.mainPage}clearPageElements(e,t,n){return e.filterMainScriptElements(t)}}class jp{constructor(e,t,n,r){this.hostCommunicationMgr=void 0,this.onUpdatePageUrl=void 0,this.onPageNotFound=void 0,this.onPageIconChange=void 0,this.isPageTitleSet=void 0,this.isPageIconSet=void 0,this.strategy=void 0,this.hostCommunicationMgr=e,this.onUpdatePageUrl=t,this.onPageNotFound=n,this.onPageIconChange=r,this.isPageIconSet=!1,this.isPageTitleSet=!1,this.strategy=new Dp(this)}handleNewSession(e){return this.isPageTitleSet=!1,this.isPageIconSet=!1,this.strategy.handleNewSession(e)}handleNavigation(e){return this.strategy instanceof Dp&&(this.strategy=new Bp(this)),this.strategy.handleNavigation(e)}handlePagesChanged(e){return this.strategy.handlePagesChanged(e)}handlePageNotFound(e){return this.strategy.handlePageNotFound(e)}findPageByUrlPath(e){return this.strategy.findPageByUrlPath(e)}handlePageConfigChanged(e){this.isPageIconSet=Boolean(e.favicon),this.isPageTitleSet=Boolean(e.title)}clearPageElements(e,t,n){return this.strategy.clearPageElements(e,t,n)}}const Fp="<null>",Up=(e,t)=>t==ae.TS.ToolbarMode.DEVELOPER||ae.TS.ToolbarMode.VIEWER!=t&&ae.TS.ToolbarMode.MINIMAL!=t&&(e||hc());class Vp extends t.PureComponent{constructor(e){var t;super(e),t=this,this.endpoints=void 0,this.sessionInfo=new le,this.metricsMgr=new hp(this.sessionInfo),this.sessionEventDispatcher=new np,this.connectionManager=void 0,this.widgetMgr=void 0,this.hostCommunicationMgr=void 0,this.uploadClient=void 0,this.pendingElementsBuffer=void 0,this.pendingElementsTimerRunning=void 0,this.componentRegistry=void 0,this.embeddingId=(0,se.cv)(),this.appNavigation=void 0,this.context=void 0,this.showDeployError=(e,t,n)=>{this.openDialog({type:Qu.DEPLOY_ERROR,title:e,msg:t,onContinue:n,onClose:()=>{},onTryAgain:this.sendLoadGitInfoBackMsg})},this.handleThemeMessage=(e,t)=>{const[,n,r]=(0,o.Ef)(),i=(0,o.tl)(this.props.theme.activeTheme);e===n.name&&i?this.props.theme.setTheme(n):e===r.name&&i?this.props.theme.setTheme(r):t&&this.props.theme.setImportedTheme(t)},this.handleConnectionStateChanged=e=>{if((0,ce.OG)(`Connection state changed from ${this.state.connectionState} to ${e}`),e===Dl.CONNECTED){(0,ce.OG)("Reconnected to server.");const e=this.state.scriptRunState===ue.RERUN_REQUESTED||this.state.scriptRunState===ue.RUNNING;this.sessionInfo.last&&!e||((0,ce.OG)("Requesting a script run."),this.widgetMgr.sendUpdateWidgetsMessage(void 0),this.setState({dialog:null})),this.hostCommunicationMgr.sendMessageToHost({type:"WEBSOCKET_CONNECTED"})}else this.state.connectionState===Dl.CONNECTED&&this.hostCommunicationMgr.sendMessageToHost({type:"WEBSOCKET_DISCONNECTED",attemptingToReconnect:e!==Dl.DISCONNECTED_FOREVER}),this.sessionInfo.isSet&&this.sessionInfo.clearCurrent();this.setState({connectionState:e})},this.handleGitInfoChanged=e=>{this.setState({gitInfo:e})},this.handleCustomParentMessage=e=>{this.state.appConfig.enableCustomParentMessages?this.hostCommunicationMgr.sendMessageToHost({type:"CUSTOM_PARENT_MESSAGE",message:e.message}):(0,ce.vV)("Sending messages to the host is disabled in line with the platform policy.")},this.handleMessage=e=>{try{((e,t,n)=>{const r=e[t];if(r in n)return n[r](e[r]);throw new Error(`Cannot handle ${t} "${r}".`)})(e,"type",{newSession:e=>this.handleNewSession(e),sessionStatusChanged:e=>this.handleSessionStatusChanged(e),sessionEvent:e=>this.handleSessionEvent(e),delta:t=>this.handleDeltaMsg(t,e.metadata),pageConfigChanged:e=>this.handlePageConfigChanged(e),pageInfoChanged:e=>this.handlePageInfoChanged(e),pagesChanged:e=>this.handlePagesChanged(e),pageNotFound:e=>this.handlePageNotFound(e),gitInfoChanged:e=>this.handleGitInfoChanged(e),scriptFinished:e=>this.handleScriptFinished(e),pageProfile:e=>this.handlePageProfileMsg(e),autoRerun:e=>this.handleAutoRerun(e),fileUrlsResponse:e=>this.uploadClient.onFileURLsResponse(e),parentMessage:e=>this.handleCustomParentMessage(e),logo:t=>this.handleLogo(t,e.metadata),navigation:e=>this.handleNavigation(e)})}catch(t){const e=(0,pe.$)(t);(0,ce.vV)(e),this.showError("Bad message format",e.message)}},this.handleLogo=(e,t)=>{const n={activeScriptHash:t.activeScriptHash,scriptRunId:this.state.scriptRunId};this.setState({elements:this.pendingElementsBuffer.appRootWithLogo(e,n)},(()=>{this.pendingElementsBuffer=this.state.elements}))},this.handlePageConfigChanged=e=>{const{title:t,favicon:n,layout:r,initialSidebarState:o,menuItems:i}=e;this.appNavigation.handlePageConfigChanged(e),t&&(this.hostCommunicationMgr.sendMessageToHost({type:"SET_PAGE_TITLE",title:t}),document.title=t),n&&this.onPageIconChanged(n),r!==this.state.layout&&this.setState((e=>({layout:r,userSettings:{...e.userSettings,wideMode:r===ae.wF.Layout.WIDE}}))),o!==this.state.initialSidebarState&&this.setState((()=>({initialSidebarState:o}))),this.setState({menuItems:i})},this.handlePageInfoChanged=e=>{const{queryString:t}=e,n=document.location.pathname+(t?`?${t}`:"");window.history.pushState({},"",n),this.hostCommunicationMgr.sendMessageToHost({type:"SET_QUERY_PARAM",queryParams:t?`?${t}`:""})},this.onPageNotFound=e=>{const t=e?`You have requested page /${e}, but no corresponding file was found in the app's pages/ directory`:"The page that you have requested does not seem to exist";this.showError("Page not found",`${t}. Running the app's main page.`)},this.handlePageNotFound=e=>{this.maybeSetState(this.appNavigation.handlePageNotFound(e))},this.onPageIconChanged=e=>{me(e,this.hostCommunicationMgr.sendMessageToHost,this.endpoints)},this.handlePagesChanged=e=>{this.maybeSetState(this.appNavigation.handlePagesChanged(e))},this.handleNavigation=e=>{this.maybeSetState(this.appNavigation.handleNavigation(e))},this.handlePageProfileMsg=e=>{var t,n,r;const o=ae.FR.toObject(e),i=Wt();this.metricsMgr.enqueue("pageProfile",{...o,isFragmentRun:Boolean(o.isFragmentRun),appId:this.sessionInfo.current.appId,numPages:null===(t=this.state.appPages)||void 0===t?void 0:t.length,sessionId:this.sessionInfo.current.sessionId,pythonVersion:this.sessionInfo.current.pythonVersion,pageScriptHash:this.state.currentPageScriptHash,activeTheme:null===(n=this.props.theme)||void 0===n||null===(r=n.activeTheme)||void 0===r?void 0:r.name,totalLoadTime:Math.round(1e3*(performance.now()-this.state.latestRunTime)),browserInfo:i})},this.handleAutoRerun=e=>{const t=setInterval((()=>{this.widgetMgr.sendUpdateWidgetsMessage(e.fragmentId,!0)}),1e3*e.interval);this.setState((e=>({autoReruns:[...e.autoReruns,t]})))},this.handleSessionStatusChanged=e=>{this.setState((t=>{let{scriptRunState:n}=t,{dialog:r}=t;return e.scriptIsRunning&&t.scriptRunState!==ue.STOP_REQUESTED?(n=ue.RUNNING,(0,se.se)(r)&&r.type===Qu.SCRIPT_COMPILE_ERROR&&(r=void 0)):e.scriptIsRunning||t.scriptRunState===ue.RERUN_REQUESTED||t.scriptRunState===ue.COMPILATION_ERROR||(n=ue.NOT_RUNNING),{userSettings:{...t.userSettings,runOnSave:Boolean(e.runOnSave)},dialog:r,scriptRunState:n}}))},this.handleSessionEvent=e=>{if(this.sessionEventDispatcher.handleSessionEventMsg(e),"scriptCompilationException"===e.type){this.setState({scriptRunState:ue.COMPILATION_ERROR});const t={type:Qu.SCRIPT_COMPILE_ERROR,exception:e.scriptCompilationException,onClose:()=>{}};this.openDialog(t)}},this.maybeUpdatePageUrl=(e,t,n)=>{const r=this.getBaseUriParts();if(r){const{basePath:o}=r,i=(0,se.gu)(document.location.pathname,o);if((""===i?e:i)!==t){const e=n?"":t,r=(0,se.U5)(),i=`${o?`/${o}`:""}/${e}${r?`?${r}`:""}`,a=i.endsWith("/")&&"/"!==i?i.slice(0,-1):i;window.history.pushState({},"",a)}}},this.handleNewSession=e=>{const t=e.initialize;if(this.hasStreamlitVersionChanged(t))return void window.location.reload();this.sessionInfo.isSet||this.handleOneTimeInitialization(e);const{appHash:n,currentPageScriptHash:r}=this.state,{scriptRunId:o,name:i,mainScriptPath:a,fragmentIdsThisRun:s,pageScriptHash:l,mainScriptHash:c}=e;if(s.length)this.setState({fragmentIdsThisRun:s,latestRunTime:performance.now()});else{this.cleanupAutoReruns();const t=e.config,n=e.customTheme;this.processThemeInput(n),this.setState({allowRunOnSave:t.allowRunOnSave,hideTopBar:t.hideTopBar,toolbarMode:t.toolbarMode,latestRunTime:performance.now(),mainScriptHash:c,fragmentIdsThisRun:s}),this.maybeSetState(this.appNavigation.handleNewSession(e)),this.onPageIconChanged("./favicon.png")}const u=(0,se.YZ)(this.sessionInfo.current.installationId+a);this.metricsMgr.setMetadata(this.state.deployedAppMetadata),this.metricsMgr.setAppHash(u),this.metricsMgr.enqueue("updateReport"),n===u&&r===l?this.setState({scriptRunId:o}):this.clearAppState(u,o,i,c)},this.handleOneTimeInitialization=e=>{const t=e.initialize,n=e.config;this.sessionInfo.setCurrent(le.propsFromNewSessionMessage(e)),this.metricsMgr.initialize({gatherUsageStats:n.gatherUsageStats,sendMessageToHost:this.hostCommunicationMgr.sendMessageToHost}),this.handleSessionStatusChanged(t.sessionStatus)},this.onHistoryChange=()=>{const{currentPageScriptHash:e}=this.state,t=this.appNavigation.findPageByUrlPath(document.location.pathname),n=document.location.toString().includes("#"),r=(null===t||void 0===t?void 0:t.pageScriptHash)===e;(0,se.hX)(t)||n&&r||this.onPageChange(t.pageScriptHash)},this.setAndSendTheme=e=>{this.props.theme.setTheme(e),this.hostCommunicationMgr.sendMessageToHost({type:"SET_THEME_CONFIG",themeInfo:(0,o.sR)(e.emotion)})},this.createThemeHash=e=>{if(!e)return"hash_for_undefined_custom_theme";const t=Object.entries(e);return t.sort(),(0,se.YZ)(t.join(":"))},this.closeDialog=()=>{this.setState({dialog:void 0})},this.saveSettings=e=>{const{runOnSave:t}=this.state.userSettings,{runOnSave:n}=e;if(this.setState({userSettings:e}),t!==n&&this.isServerConnected()){const e=new ae.$4({setRunOnSave:n});e.type="setRunOnSave",this.sendBackMsg(e)}},this.handleDeltaMsg=(e,t)=>{if(this.pendingElementsBuffer=this.pendingElementsBuffer.applyDelta(this.state.scriptRunId,e,t),!this.pendingElementsTimerRunning){this.pendingElementsTimerRunning=!0;const e=this.state.scriptRunState===ue.RUNNING;setTimeout((()=>{this.pendingElementsTimerRunning=!1,e&&this.setState({elements:this.pendingElementsBuffer})}),10)}},this.debugShutdownRuntime=()=>{if(this.isServerConnected()){const e=new ae.$4({debugShutdownRuntime:!0});e.type="debugShutdownRuntime",this.sendBackMsg(e)}},this.debugDisconnectWebsocket=()=>{if(this.isServerConnected()){const e=new ae.$4({debugDisconnectWebsocket:!0});e.type="debugDisconnectWebsocket",this.sendBackMsg(e)}},this.debugClearForwardMsgCache=()=>{var e,t;hc()&&(null===(e=this.connectionManager)||void 0===e||null===(t=e.connection)||void 0===t||t.cache.messages.clear())},this.cleanupAutoReruns=()=>{this.state.autoReruns.forEach((e=>{clearInterval(e)})),this.setState({autoReruns:[]})},this.rerunScript=function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];t.closeDialog(),t.isServerConnected()?t.state.scriptRunState!==ue.RUNNING&&t.state.scriptRunState!==ue.RERUN_REQUESTED&&(t.setState({scriptRunState:ue.RERUN_REQUESTED}),!0===e&&t.saveSettings({...t.state.userSettings,runOnSave:!0}),t.widgetMgr.sendUpdateWidgetsMessage(void 0)):(0,ce.vV)("Cannot rerun script when disconnected from server.")},this.sendLoadGitInfoBackMsg=()=>{this.isServerConnected()?this.sendBackMsg(new ae.$4({loadGitInfo:!0})):(0,ce.vV)("Cannot load git information when disconnected from server.")},this.onPageChange=e=>{const{elements:t,mainScriptHash:n}=this.state;this.cleanupAutoReruns();const r=this.appNavigation.clearPageElements(t,n,void 0),o=new Set(Array.from(r.getElements()).map((e=>(0,se.Id)(e))).filter(se.q3));this.sendRerunBackMsg(this.widgetMgr.getActiveWidgetStates(o),void 0,e)},this.isAppInReadyState=e=>this.state.connectionState===Dl.CONNECTED&&this.state.scriptRunState===ue.NOT_RUNNING&&e.scriptRunState===ue.RUNNING&&e.connectionState===Dl.CONNECTED,this.sendRerunBackMsg=(e,t,n,r)=>{const o=this.getBaseUriParts();if(!o)return void(0,ce.vV)("Cannot send rerun backMessage when disconnected from server.");const{currentPageScriptHash:i}=this.state,{basePath:a}=o;let s=this.getQueryString(),l="";n?n!=i&&(s=(0,se.U5)(),this.hostCommunicationMgr.sendMessageToHost({type:"SET_QUERY_PARAM",queryParams:s})):i?n=i:(l=(0,se.gu)(document.location.pathname,a),n=""),this.sendBackMsg(new ae.$4({rerunScript:{queryString:s,widgetStates:e,pageScriptHash:n,pageName:l,fragmentId:t,isAutoRerun:r}})),we.record({name:"RequestedRerun",scriptRunState:this.state.scriptRunState})},this.stopScript=()=>{if(!this.isServerConnected())return void(0,ce.vV)("Cannot stop app when disconnected from server.");if(this.state.scriptRunState===ue.NOT_RUNNING||this.state.scriptRunState===ue.STOP_REQUESTED)return;const e=new ae.$4({stopScript:!0});e.type="stopScript",this.sendBackMsg(e),this.setState({scriptRunState:ue.STOP_REQUESTED})},this.openClearCacheDialog=()=>{if(this.isServerConnected()){const e={type:Qu.CLEAR_CACHE,confirmCallback:this.clearCache,defaultAction:this.clearCache,onClose:()=>{}};this.openDialog(e)}else(0,ce.vV)("Cannot clear cache: disconnected from server")},this.openDeployDialog=()=>{var e;const t={type:Qu.DEPLOY_DIALOG,onClose:this.closeDialog,showDeployError:this.showDeployError,isDeployErrorModalOpen:(null===(e=this.state.dialog)||void 0===e?void 0:e.type)===Qu.DEPLOY_ERROR,metricsMgr:this.metricsMgr};this.openDialog(t)},this.openThemeCreatorDialog=()=>{this.metricsMgr.enqueue("menuClick",{label:"editTheme"});const e={type:Qu.THEME_CREATOR,backToSettings:this.settingsCallback,onClose:this.closeDialog,metricsMgr:this.metricsMgr};this.openDialog(e)},this.clearCache=()=>{if(this.closeDialog(),this.isServerConnected()){const e=new ae.$4({clearCache:!0});e.type="clearCache",this.sendBackMsg(e)}else(0,ce.vV)("Cannot clear cache: disconnected from server")},this.sendAppHeartbeat=()=>{if(this.isServerConnected()){const e=new ae.$4({appHeartbeat:!0});e.type="appHeartbeat",this.sendBackMsg(e)}else(0,ce.vV)("Cannot send app heartbeat: disconnected from server")},this.sendBackMsg=e=>{this.connectionManager?((0,ce.OG)(e),this.connectionManager.sendMessage(e)):(0,ce.vV)(`Not connected. Cannot send back message: ${e}`)},this.handleConnectionError=e=>{this.showError("Connection error",e)},this.isServerConnected=()=>!!this.connectionManager&&this.connectionManager.isConnected(),this.settingsCallback=function(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];const n={type:Qu.SETTINGS,isServerConnected:t.isServerConnected(),settings:t.state.userSettings,allowRunOnSave:t.state.allowRunOnSave,onSave:t.saveSettings,onClose:()=>{},developerMode:Up(t.state.isOwner,t.state.toolbarMode),openThemeCreator:t.openThemeCreatorDialog,animateModal:e,metricsMgr:t.metricsMgr};t.openDialog(n)},this.aboutCallback=()=>{const{menuItems:e}=this.state,t={type:Qu.ABOUT,sessionInfo:this.sessionInfo,onClose:this.closeDialog,aboutSectionMd:null===e||void 0===e?void 0:e.aboutSectionMd};this.openDialog(t)},this.printCallback=()=>{const{scriptRunState:e}=this.state;if(e!==ue.NOT_RUNNING)return void setTimeout(this.printCallback,500);let t;try{const e=(0,se.ky)(this.embeddingId);t=e&&e.contentWindow?e.contentWindow.window:window}catch(n){t=window}finally{t||(t=window),t.print()}},this.screencastCallback=()=>{const{scriptName:e}=this.state,{startRecording:t}=this.props.screenCast;t(`streamlit-${e}-${E()().format("YYYY-MM-DD-HH-MM-SS")}`)},this.handleFullScreen=e=>{this.setState({isFullScreen:e})},this.setLibConfig=e=>{this.setState({libConfig:e})},this.setAppConfig=e=>{this.setState({appConfig:e})},this.addScriptFinishedHandler=e=>{this.setState(((t,n)=>({scriptFinishedHandlers:t.scriptFinishedHandlers.concat(e)})))},this.removeScriptFinishedHandler=e=>{this.setState(((t,n)=>({scriptFinishedHandlers:ie()(t.scriptFinishedHandlers,e)})))},this.getBaseUriParts=()=>this.connectionManager?this.connectionManager.getBaseUriParts():void 0,this.getQueryString=()=>{const{queryParams:e}=this.state,t=e&&e.length>0?e:document.location.search;return t.startsWith("?")?t.substring(1):t},this.isInCloudEnvironment=()=>{const{hostMenuItems:e}=this.state;return e&&(null===e||void 0===e?void 0:e.length)>0},this.showDeployButton=()=>Up(this.state.isOwner,this.state.toolbarMode)&&!this.isInCloudEnvironment()&&this.sessionInfo.isSet&&!this.sessionInfo.isHello,this.deployButtonClicked=()=>{this.metricsMgr.enqueue("menuClick",{label:"deployButtonInApp"}),this.sendLoadGitInfoBackMsg(),this.openDeployDialog()},this.requestFileURLs=(e,t)=>{if(this.isServerConnected()){const n=new ae.$4({fileUrlsRequest:{requestId:e,fileNames:t.map((e=>e.name)),sessionId:this.sessionInfo.current.sessionId}});n.type="fileUrlsRequest",this.sendBackMsg(n)}},this.handleKeyDown=e=>{switch(e){case"c":Up(this.state.isOwner,this.state.toolbarMode)&&this.openClearCacheDialog();break;case"r":this.rerunScript()}},this.handleKeyUp=e=>{"esc"===e&&this.props.screenCast.stopRecording()},(0,te.Xu)();let n=this.createThemeHash();(0,o.tl)(e.theme.activeTheme)||(n=this.createThemeHash((0,o.hf)(e.theme.activeTheme.emotion))),this.state={connectionState:Dl.INITIAL,elements:xe.empty("",!0),isFullScreen:!1,scriptName:"",scriptRunId:Fp,appHash:null,scriptRunState:ue.NOT_RUNNING,userSettings:{wideMode:!1,runOnSave:!1},layout:ae.wF.Layout.CENTERED,initialSidebarState:ae.wF.SidebarState.AUTO,menuItems:void 0,allowRunOnSave:!0,scriptFinishedHandlers:[],themeHash:n,gitInfo:null,formsData:ke(),appPages:[],navSections:[],currentPageScriptHash:"",mainScriptHash:"",hideTopBar:!0,hideSidebarNav:!0,expandSidebarNav:!1,toolbarMode:ae.TS.ToolbarMode.MINIMAL,latestRunTime:performance.now(),fragmentIdsThisRun:[],isOwner:!1,hostMenuItems:[],hostToolbarItems:[],hostHideSidebarNav:!1,sidebarChevronDownshift:0,pageLinkBaseUrl:"",queryParams:"",deployedAppMetadata:{},libConfig:{},appConfig:{},autoReruns:[],inputsDisabled:!1},this.connectionManager=null,this.widgetMgr=new We({sendRerunBackMsg:this.sendRerunBackMsg,formsDataChanged:e=>this.setState({formsData:e})}),this.hostCommunicationMgr=new Ue({streamlitExecutionStartedAt:e.streamlitExecutionStartedAt,sendRerunBackMsg:this.sendRerunBackMsg,closeModal:this.closeDialog,stopScript:this.stopScript,rerunScript:this.rerunScript,clearCache:this.clearCache,sendAppHeartbeat:this.sendAppHeartbeat,setInputsDisabled:e=>{this.setState({inputsDisabled:e})},themeChanged:this.handleThemeMessage,pageChanged:this.onPageChange,isOwnerChanged:e=>this.setState({isOwner:e}),jwtHeaderChanged:e=>{let{jwtHeaderName:t,jwtHeaderValue:n}=e;void 0!==this.endpoints.setJWTHeader&&this.state.appConfig.useExternalAuthToken&&this.endpoints.setJWTHeader({jwtHeaderName:t,jwtHeaderValue:n})},hostMenuItemsChanged:e=>{this.setState({hostMenuItems:e})},hostToolbarItemsChanged:e=>{this.setState({hostToolbarItems:e})},hostHideSidebarNavChanged:e=>{this.setState({hostHideSidebarNav:e})},sidebarChevronDownshiftChanged:e=>{this.setState({sidebarChevronDownshift:e})},pageLinkBaseUrlChanged:e=>{this.setState({pageLinkBaseUrl:e})},queryParamsChanged:e=>{this.setState({queryParams:e})},deployedAppMetadataChanged:e=>{this.setState({deployedAppMetadata:e})},restartWebsocketConnection:()=>{this.connectionManager||this.initializeConnectionManager()},terminateWebsocketConnection:()=>{var e;null===(e=this.connectionManager)||void 0===e||e.disconnect(),this.connectionManager=null}}),this.endpoints=new op({getServerUri:this.getBaseUriParts,csrfEnabled:!0}),this.uploadClient=new Tt({sessionInfo:this.sessionInfo,endpoints:this.endpoints,formsWithPendingRequestsChanged:e=>this.widgetMgr.setFormsWithUploadsInProgress(e),requestFileURLs:this.requestFileURLs}),this.componentRegistry=new Rt(this.endpoints),this.pendingElementsTimerRunning=!1,this.pendingElementsBuffer=this.state.elements,this.appNavigation=new jp(this.hostCommunicationMgr,this.maybeUpdatePageUrl,this.onPageNotFound,this.onPageIconChanged),window.streamlitDebug={clearForwardMsgCache:this.debugClearForwardMsgCache,disconnectWebsocket:this.debugDisconnectWebsocket,shutdownRuntime:this.debugShutdownRuntime}}initializeConnectionManager(){var e;const t=null===(e=this.context)||void 0===e?void 0:e.kernel;if(null==t)throw new Error("Kernel is not set in the context.");this.connectionManager=new tp({kernel:t,sessionInfo:this.sessionInfo,endpoints:this.endpoints,onMessage:this.handleMessage,onConnectionError:this.handleConnectionError,connectionStateChanged:this.handleConnectionStateChanged,claimHostAuthToken:this.hostCommunicationMgr.claimAuthToken,resetHostAuthToken:this.hostCommunicationMgr.resetAuthToken,onHostConfigResp:e=>{const{allowedOrigins:t,useExternalAuthToken:n,disableFullscreenMode:r,enableCustomParentMessages:o,mapboxToken:i,enforceDownloadInNewTab:a,metricsUrl:s}=e,l={allowedOrigins:t,useExternalAuthToken:n,enableCustomParentMessages:o},c={mapboxToken:i,disableFullscreenMode:r,enforceDownloadInNewTab:a};this.metricsMgr.setMetricsConfig(s),this.hostCommunicationMgr.setAllowedOrigins(l),this.setAppConfig(l),this.setLibConfig(c)}})}componentDidMount(){var e;const t=null===(e=this.context)||void 0===e?void 0:e.kernel;if(null==t)throw new Error("Kernel is not set in the context.");this.initializeConnectionManager(),this.hostCommunicationMgr.sendMessageToHost({type:"SCRIPT_RUN_STATE_CHANGED",scriptRunState:this.state.scriptRunState}),this.uploadClient.setKernel(t),(0,se.Az)()&&document.body.classList.add("embedded"),(0,se.hU)()&&(window.iFrameResizer={heightCalculationMethod:()=>{const e=document.querySelectorAll("[data-iframe-height]"),t=Array.from(e).map((e=>Math.ceil(e.getBoundingClientRect().bottom)));return Math.max(0,...t)}},__webpack_require__.e(5885).then(__webpack_require__.t.bind(__webpack_require__,25885,23))),this.hostCommunicationMgr.sendMessageToHost({type:"SET_THEME_CONFIG",themeInfo:(0,o.sR)(this.props.theme.activeTheme.emotion)}),this.metricsMgr.enqueue("viewReport"),window.addEventListener("popstate",this.onHistoryChange,!1)}componentDidUpdate(e,t){!1===window.prerenderReady&&this.isAppInReadyState(t)&&(window.prerenderReady=!0),this.state.scriptRunState!==t.scriptRunState&&this.hostCommunicationMgr.sendMessageToHost({type:"SCRIPT_RUN_STATE_CHANGED",scriptRunState:this.state.scriptRunState})}componentWillUnmount(){var e;null===(e=this.connectionManager)||void 0===e||e.disconnect(),this.hostCommunicationMgr.closeHostCommunication(),window.removeEventListener("popstate",this.onHistoryChange,!1)}showError(e,t){(0,ce.vV)(t);const n={type:Qu.WARNING,title:e,msg:t,onClose:()=>{}};this.openDialog(n)}hasStreamlitVersionChanged(e){if(this.sessionInfo.isSet){const t=this.sessionInfo.current.streamlitVersion,{environmentInfo:n}=e;if((0,se.se)(n)&&(0,se.se)(n.streamlitVersion))return t!=n.streamlitVersion}return!1}maybeSetState(e){if(e){const[t,n]=e;this.setState(t,n)}}processThemeInput(e){const t=this.createThemeHash(e);if(t===this.state.themeHash)return;this.setState({themeHash:t});const n=!(0,o.tl)(this.props.theme.activeTheme);if(e){const t=(0,o.an)(o.kQ,e);this.props.theme.addThemes([t]);(null===(0,o.YY)()||n)&&this.setAndSendTheme(t)}else this.props.theme.addThemes([]),n&&this.setAndSendTheme((0,o.Y_)())}handleScriptFinished(e){if(e===ae.zo.ScriptFinishedStatus.FINISHED_SUCCESSFULLY||e===ae.zo.ScriptFinishedStatus.FINISHED_EARLY_FOR_RERUN||e===ae.zo.ScriptFinishedStatus.FINISHED_FRAGMENT_RUN_SUCCESSFULLY){if(window.setTimeout((()=>{this.state.scriptFinishedHandlers.map((e=>e()))}),0),e===ae.zo.ScriptFinishedStatus.FINISHED_SUCCESSFULLY||e===ae.zo.ScriptFinishedStatus.FINISHED_FRAGMENT_RUN_SUCCESSFULLY){this.setState((e=>{let{scriptRunId:t,fragmentIdsThisRun:n}=e;return{elements:this.pendingElementsBuffer.clearStaleNodes(t,n)}}),(()=>{this.pendingElementsBuffer=this.state.elements}));const e=new Set(Array.from(this.state.elements.getElements()).map((e=>(0,se.Id)(e))).filter(se.q3));this.widgetMgr.removeInactive(e)}null!==this.connectionManager&&e!==ae.zo.ScriptFinishedStatus.FINISHED_EARLY_FOR_RERUN&&this.sessionInfo.isSet&&this.connectionManager.incrementMessageCacheRunCount(this.sessionInfo.current.maxCachedMessageAge)}}clearAppState(e,t,n,r){const{hideSidebarNav:o,elements:i}=this.state,a=o&&i.sidebar||void 0;this.setState({scriptRunId:t,scriptName:n,appHash:e,elements:this.appNavigation.clearPageElements(this.pendingElementsBuffer,r,a)},(()=>{this.pendingElementsBuffer=this.state.elements;const e=new Set(Array.from(this.state.elements.getElements()).map((e=>(0,se.Id)(e))).filter(se.q3));this.widgetMgr.removeInactive(e)}))}openDialog(e){this.setState({dialog:e})}render(){const{allowRunOnSave:e,connectionState:t,dialog:n,elements:r,initialSidebarState:o,menuItems:i,isFullScreen:a,scriptRunId:s,scriptRunState:l,userSettings:c,hideTopBar:u,hideSidebarNav:p,expandSidebarNav:d,currentPageScriptHash:b,hostHideSidebarNav:f,pageLinkBaseUrl:m,sidebarChevronDownshift:M,hostMenuItems:g,hostToolbarItems:O,libConfig:z,appConfig:y,inputsDisabled:A,appPages:v,navSections:w}=this.state,S=Up(this.state.isOwner,this.state.toolbarMode),q=re()("stApp",(0,se.M$)(this.embeddingId),{"streamlit-embedded":(0,se.yR)(),"streamlit-wide":c.wideMode}),E=n?ep({...n,onClose:this.closeDialog}):null,_=A||t!==Dl.CONNECTED;return(0,h.jsx)(Lt.Provider,{value:{initialSidebarState:o,wideMode:c.wideMode,embedded:(0,se.yR)(),showPadding:!(0,se.yR)()||(0,se.Rg)(),disableScrolling:(0,se.Az)(),showToolbar:!(0,se.yR)()||(0,se.v4)(),showColoredLine:!(0,se.yR)()||(0,se._d)(),pageLinkBaseUrl:m,sidebarChevronDownshift:M,gitInfo:this.state.gitInfo,appConfig:y},children:(0,h.jsx)(kt.n.Provider,{value:{isFullScreen:a,setFullScreen:this.handleFullScreen,addScriptFinishedHandler:this.addScriptFinishedHandler,removeScriptFinishedHandler:this.removeScriptFinishedHandler,activeTheme:this.props.theme.activeTheme,setTheme:this.setAndSendTheme,availableThemes:this.props.theme.availableThemes,addThemes:this.props.theme.addThemes,onPageChange:this.onPageChange,currentPageScriptHash:b,libConfig:z,fragmentIdsThisRun:this.state.fragmentIdsThisRun,locale:window.navigator.language},children:(0,h.jsx)(ee,{keyName:"r,c,esc",onKeyDown:this.handleKeyDown,onKeyUp:this.handleKeyUp,children:(0,h.jsxs)(mp,{className:q,"data-testid":"stApp","data-test-script-state":s==Fp?"initial":l,"data-test-connection-state":t,children:[(0,h.jsxs)(Tc,{children:[!u&&(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(Jl,{connectionState:t,sessionEventDispatcher:this.sessionEventDispatcher,scriptRunState:l,rerunScript:this.rerunScript,stopScript:this.stopScript,allowRunOnSave:e}),(0,h.jsx)(wc,{hostToolbarItems:O,sendMessageToHost:this.hostCommunicationMgr.sendMessageToHost,metricsMgr:this.metricsMgr})]}),this.showDeployButton()&&(0,h.jsx)(qc,{onClick:this.deployButtonClicked.bind(this)}),(0,h.jsx)(Oc,{isServerConnected:this.isServerConnected(),quickRerunCallback:this.rerunScript,clearCacheCallback:this.openClearCacheDialog,settingsCallback:this.settingsCallback,aboutCallback:this.aboutCallback,printCallback:this.printCallback,screencastCallback:this.screencastCallback,screenCastState:this.props.screenCast.currentState,hostMenuItems:g,developmentMode:S,sendMessageToHost:this.hostCommunicationMgr.sendMessageToHost,menuItems:i,metricsMgr:this.metricsMgr,toolbarMode:this.state.toolbarMode})]}),(0,h.jsx)(Ml,{endpoints:this.endpoints,sessionInfo:this.sessionInfo,sendMessageToHost:this.hostCommunicationMgr.sendMessageToHost,elements:r,scriptRunId:s,scriptRunState:l,widgetMgr:this.widgetMgr,widgetsDisabled:_,uploadClient:this.uploadClient,componentRegistry:this.componentRegistry,formsData:this.state.formsData,appLogo:r.logo,appPages:v,navSections:w,onPageChange:this.onPageChange,currentPageScriptHash:b,hideSidebarNav:p||f,expandSidebarNav:d}),E]})})})})}}Vp.contextType=r.yp;const Hp=Ip(Vp);const Xp=e=>{let{streamlitExecutionStartedAt:n}=e;const[r,i]=function(){const e=(0,o.x0)(),[n,r]=(0,t.useState)(e),[i,a]=(0,t.useState)([]),[s,l]=(0,t.useState)([...(0,o.Ef)(),...(0,o.tl)(e)?[]:[e]]),c=(0,t.useCallback)((e=>{e!==n&&(r(e),e.name===o.QM?(0,o.E9)():(0,o.Iu)(e))}),[r,n]),u=(0,t.useCallback)((()=>{n.name===o.QM&&c((0,o.Y_)());const e=s.filter((e=>e.name!==o.QM));l([(0,o.DK)(),...e])}),[n.name,s,c]),p=(0,t.useCallback)((e=>{e.fontFaces&&a(e.fontFaces);const t=new ae.tc(e),n=(0,o.an)(o.kQ,t);c(n)}),[a,c]);return(0,t.useEffect)((()=>{const e=window.matchMedia("(prefers-color-scheme: dark)");return e.addEventListener("change",u),window.addEventListener("afterprint",u),()=>{window.removeEventListener("afterprint",u),e.removeEventListener("change",u)}}),[n,s,u]),[{setTheme:c,activeTheme:n,addThemes:e=>{l([...(0,o.Ef)(),...e])},availableThemes:s,setImportedTheme:p},i]}(),{activeTheme:a}=r,s=a.name===o.kQ&&i.length>0;return(0,h.jsx)(g,{theme:a,children:(0,h.jsx)(S,{children:(0,h.jsxs)(v,{children:[s&&(0,h.jsx)(O,{fontFaces:i}),(0,h.jsx)(Hp,{theme:r,streamlitExecutionStartedAt:n})]})})})};class $p{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";this.prefix=e,this.count=0,this.offset=374,this.msb=1295,this.power=2}next(){const e=this.increment().toString(36);return this.prefix?`${this.prefix}${e}`:e}increment(){const e=this.count+this.offset;return e===this.msb&&(this.offset+=9*(this.msb+1),this.msb=Math.pow(36,++this.power)-1),this.count++,e}}const Gp=/(!?\(\s*min(-device-)?-width).+\(\s*max(-device)?-width/i,Kp=/(!?\(\s*max(-device)?-width).+\(\s*min(-device)?-width/i,Yp=ad(Gp,Kp,/\(\s*min(-device)?-width/i),Jp=ad(Kp,Gp,/\(\s*max(-device)?-width/i),Zp=/(!?\(\s*min(-device)?-height).+\(\s*max(-device)?-height/i,Qp=/(!?\(\s*max(-device)?-height).+\(\s*min(-device)?-height/i,ed=ad(Zp,Qp,/\(\s*min(-device)?-height/i),td=ad(Qp,Zp,/\(\s*max(-device)?-height/i),nd=/print/i,rd=/^print$/i,od=Number.MAX_VALUE;function id(e){const t=/(-?\d*\.?\d+)(ch|em|ex|px|rem)/.exec(e);if(null===t)return od;let n=t[1];switch(t[2]){case"ch":n=8.8984375*parseFloat(n);break;case"em":case"rem":n=16*parseFloat(n);break;case"ex":n=8.296875*parseFloat(n);break;case"px":n=parseFloat(n)}return+n}function ad(e,t,n){return function(r){return!!e.test(r)||!t.test(r)&&n.test(r)}}function sd(e,t){if(""===e)return-1;if(""===t)return 1;const n=function(e,t){const n=nd.test(e),r=rd.test(e),o=nd.test(t),i=rd.test(t);return n&&o?!r&&i?1:r&&!i?-1:e.localeCompare(t):n?1:o?-1:null}(e,t);if(null!==n)return n;const r=Yp(e)||ed(e),o=Jp(e)||td(e),i=Yp(t)||ed(t),a=Jp(t)||td(t);if(r&&a)return-1;if(o&&i)return 1;const s=id(e),l=id(t);return s===od&&l===od?e.localeCompare(t):s===od?1:l===od?-1:s>l?o?-1:1:s<l?o?1:-1:e.localeCompare(t)}class ld{constructor(e,t,n){this.idGenerator=e,this.onNewCache=t,this.onNewValue=n,this.sortedCacheKeys=[],this.caches={}}getCache(e){if(!this.caches[e]){const t=new cd(this.idGenerator,this.onNewValue);t.key=e,this.sortedCacheKeys.push(e),this.sortedCacheKeys.sort(sd);const n=this.sortedCacheKeys.indexOf(e),r=n<this.sortedCacheKeys.length-1?this.sortedCacheKeys[n+1]:void 0;this.caches[e]=t,this.onNewCache(e,t,r)}return this.caches[e]}getSortedCacheKeys(){return this.sortedCacheKeys}}class cd{constructor(e,t){this.cache={},this.idGenerator=e,this.onNewValue=t}addValue(e,t){const n=this.cache[e];if(n)return n;const r=this.idGenerator.next();return this.cache[e]=r,this.onNewValue(this,r,t),r}}const ud=/[A-Z]/g,pd=/^ms-/,dd={};function bd(e){return e in dd?dd[e]:dd[e]=e.replace(ud,"-$&").toLowerCase().replace(pd,"-ms-")}function fd(e){return e.charAt(0).toUpperCase()+e.slice(1)}function hd(e,t,n){if(e.hasOwnProperty(t)){for(var r={},o=e[t],i=fd(t),a=Object.keys(n),s=0;s<a.length;s++){var l=a[s];if(l===t)for(var c=0;c<o.length;c++)r[o[c]+i]=n[t];r[l]=n[l]}return r}return n}function md(e,t,n,r,o){for(var i=0,a=e.length;i<a;++i){var s=e[i](t,n,r,o);if(s)return s}}function Md(e,t){-1===e.indexOf(t)&&e.push(t)}function gd(e,t){if(Array.isArray(t))for(var n=0,r=t.length;n<r;++n)Md(e,t[n]);else Md(e,t)}function Od(e){return e instanceof Object&&!Array.isArray(e)}var zd=["Webkit"],yd=["ms"],Ad=["Webkit","ms"];const vd={plugins:[],prefixMap:{appearance:["Webkit","Moz"],textEmphasisPosition:zd,textEmphasis:zd,textEmphasisStyle:zd,textEmphasisColor:zd,boxDecorationBreak:zd,maskImage:zd,maskMode:zd,maskRepeat:zd,maskPosition:zd,maskClip:zd,maskOrigin:zd,maskSize:zd,maskComposite:zd,mask:zd,maskBorderSource:zd,maskBorderMode:zd,maskBorderSlice:zd,maskBorderWidth:zd,maskBorderOutset:zd,maskBorderRepeat:zd,maskBorder:zd,maskType:zd,textDecorationStyle:zd,textDecorationSkip:zd,textDecorationLine:zd,textDecorationColor:zd,userSelect:["Webkit","Moz","ms"],backdropFilter:zd,fontKerning:zd,scrollSnapType:Ad,scrollSnapPointsX:Ad,scrollSnapPointsY:Ad,scrollSnapDestination:Ad,scrollSnapCoordinate:Ad,clipPath:zd,shapeImageThreshold:zd,shapeImageMargin:zd,shapeImageOutside:zd,filter:zd,hyphens:Ad,flowInto:Ad,flowFrom:Ad,breakBefore:Ad,breakAfter:Ad,breakInside:Ad,regionFragment:Ad,writingMode:Ad,textOrientation:zd,tabSize:["Moz"],fontFeatureSettings:zd,columnCount:zd,columnFill:zd,columnGap:zd,columnRule:zd,columnRuleColor:zd,columnRuleStyle:zd,columnRuleWidth:zd,columns:zd,columnSpan:zd,columnWidth:zd,wrapFlow:yd,wrapThrough:yd,wrapMargin:yd,textSizeAdjust:Ad}};var wd=["-webkit-","-moz-",""],Sd={"zoom-in":!0,"zoom-out":!0,grab:!0,grabbing:!0};var qd=__webpack_require__(55218),Ed=__webpack_require__.n(qd),_d=["-webkit-",""];var xd=["-webkit-",""];var Td={flex:["-webkit-box","-moz-box","-ms-flexbox","-webkit-flex","flex"],"inline-flex":["-webkit-inline-box","-moz-inline-box","-ms-inline-flexbox","-webkit-inline-flex","inline-flex"]};var Rd={"space-around":"justify","space-between":"justify","flex-start":"start","flex-end":"end","wrap-reverse":"multiple",wrap:"multiple"},kd={alignItems:"WebkitBoxAlign",justifyContent:"WebkitBoxPack",flexWrap:"WebkitBoxLines",flexGrow:"WebkitBoxFlex"};var Nd=["-webkit-","-moz-",""],Cd=/linear-gradient|radial-gradient|repeating-linear-gradient|repeating-radial-gradient/gi;var Wd=function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var n=[],r=!0,o=!1,i=void 0;try{for(var a,s=e[Symbol.iterator]();!(r=(a=s.next()).done)&&(n.push(a.value),!t||n.length!==t);r=!0);}catch(l){o=!0,i=l}finally{try{!r&&s.return&&s.return()}finally{if(o)throw i}}return n}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")};function Ld(e){return"number"===typeof e&&!isNaN(e)}function Id(e){return"string"===typeof e&&e.includes("/")}var Pd=["center","end","start","stretch"],Dd={"inline-grid":["-ms-inline-grid","inline-grid"],grid:["-ms-grid","grid"]},Bd={alignSelf:function(e,t){Pd.indexOf(e)>-1&&(t.msGridRowAlign=e)},gridColumn:function(e,t){if(Ld(e))t.msGridColumn=e;else if(Id(e)){var n=e.split("/"),r=Wd(n,2),o=r[0],i=r[1];Bd.gridColumnStart(+o,t);var a=i.split(/ ?span /),s=Wd(a,2),l=s[0],c=s[1];""===l?Bd.gridColumnEnd(+o+ +c,t):Bd.gridColumnEnd(+i,t)}else Bd.gridColumnStart(e,t)},gridColumnEnd:function(e,t){var n=t.msGridColumn;Ld(e)&&Ld(n)&&(t.msGridColumnSpan=e-n)},gridColumnStart:function(e,t){Ld(e)&&(t.msGridColumn=e)},gridRow:function(e,t){if(Ld(e))t.msGridRow=e;else if(Id(e)){var n=e.split("/"),r=Wd(n,2),o=r[0],i=r[1];Bd.gridRowStart(+o,t);var a=i.split(/ ?span /),s=Wd(a,2),l=s[0],c=s[1];""===l?Bd.gridRowEnd(+o+ +c,t):Bd.gridRowEnd(+i,t)}else Bd.gridRowStart(e,t)},gridRowEnd:function(e,t){var n=t.msGridRow;Ld(e)&&Ld(n)&&(t.msGridRowSpan=e-n)},gridRowStart:function(e,t){Ld(e)&&(t.msGridRow=e)},gridTemplateColumns:function(e,t){t.msGridColumns=e},gridTemplateRows:function(e,t){t.msGridRows=e},justifySelf:function(e,t){Pd.indexOf(e)>-1&&(t.msGridColumnAlign=e)}};var jd=["-webkit-",""];var Fd={marginBlockStart:["WebkitMarginBefore"],marginBlockEnd:["WebkitMarginAfter"],marginInlineStart:["WebkitMarginStart","MozMarginStart"],marginInlineEnd:["WebkitMarginEnd","MozMarginEnd"],paddingBlockStart:["WebkitPaddingBefore"],paddingBlockEnd:["WebkitPaddingAfter"],paddingInlineStart:["WebkitPaddingStart","MozPaddingStart"],paddingInlineEnd:["WebkitPaddingEnd","MozPaddingEnd"],borderBlockStart:["WebkitBorderBefore"],borderBlockStartColor:["WebkitBorderBeforeColor"],borderBlockStartStyle:["WebkitBorderBeforeStyle"],borderBlockStartWidth:["WebkitBorderBeforeWidth"],borderBlockEnd:["WebkitBorderAfter"],borderBlockEndColor:["WebkitBorderAfterColor"],borderBlockEndStyle:["WebkitBorderAfterStyle"],borderBlockEndWidth:["WebkitBorderAfterWidth"],borderInlineStart:["WebkitBorderStart","MozBorderStart"],borderInlineStartColor:["WebkitBorderStartColor","MozBorderStartColor"],borderInlineStartStyle:["WebkitBorderStartStyle","MozBorderStartStyle"],borderInlineStartWidth:["WebkitBorderStartWidth","MozBorderStartWidth"],borderInlineEnd:["WebkitBorderEnd","MozBorderEnd"],borderInlineEndColor:["WebkitBorderEndColor","MozBorderEndColor"],borderInlineEndStyle:["WebkitBorderEndStyle","MozBorderEndStyle"],borderInlineEndWidth:["WebkitBorderEndWidth","MozBorderEndWidth"]};var Ud=["-webkit-","-moz-",""],Vd={maxHeight:!0,maxWidth:!0,width:!0,height:!0,columnWidth:!0,minWidth:!0,minHeight:!0},Hd={"min-content":!0,"max-content":!0,"fill-available":!0,"fit-content":!0,"contain-floats":!0};var Xd=__webpack_require__(32629),$d=__webpack_require__.n(Xd),Gd={transition:!0,transitionProperty:!0,WebkitTransition:!0,WebkitTransitionProperty:!0,MozTransition:!0,MozTransitionProperty:!0},Kd={Webkit:"-webkit-",Moz:"-moz-",ms:"-ms-"};var Yd=function(e){var t=e.prefixMap,n=e.plugins;return function e(r){for(var o in r){var i=r[o];if(Od(i))r[o]=e(i);else if(Array.isArray(i)){for(var a=[],s=0,l=i.length;s<l;++s){gd(a,md(n,o,i[s],r,t)||i[s])}a.length>0&&(r[o]=a)}else{var c=md(n,o,i,r,t);c&&(r[o]=c),r=hd(t,o,r)}}return r}}({prefixMap:vd.prefixMap,plugins:[function(e,t){if("string"===typeof t&&"text"===t)return["-webkit-text","text"]},function(e,t){if("string"===typeof t&&!Ed()(t)&&t.indexOf("cross-fade(")>-1)return _d.map((function(e){return t.replace(/cross-fade\(/g,e+"cross-fade(")}))},function(e,t){if("cursor"===e&&Sd.hasOwnProperty(t))return wd.map((function(e){return e+t}))},function(e,t){if("string"===typeof t&&!Ed()(t)&&t.indexOf("filter(")>-1)return xd.map((function(e){return t.replace(/filter\(/g,e+"filter(")}))},function(e,t,n){"flexDirection"===e&&"string"===typeof t&&(t.indexOf("column")>-1?n.WebkitBoxOrient="vertical":n.WebkitBoxOrient="horizontal",t.indexOf("reverse")>-1?n.WebkitBoxDirection="reverse":n.WebkitBoxDirection="normal"),kd.hasOwnProperty(e)&&(n[kd[e]]=Rd[t]||t)},function(e,t){if("string"===typeof t&&!Ed()(t)&&Cd.test(t))return Nd.map((function(e){return t.replace(Cd,(function(t){return e+t}))}))},function(e,t,n){if("display"===e&&t in Dd)return Dd[t];e in Bd&&(0,Bd[e])(t,n)},function(e,t){if("string"===typeof t&&!Ed()(t)&&t.indexOf("image-set(")>-1)return jd.map((function(e){return t.replace(/image-set\(/g,e+"image-set(")}))},function(e,t,n){if(Object.prototype.hasOwnProperty.call(Fd,e))for(var r=Fd[e],o=0,i=r.length;o<i;++o)n[r[o]]=t},function(e,t){if("position"===e&&"sticky"===t)return["-webkit-sticky","sticky"]},function(e,t){if(Vd.hasOwnProperty(e)&&Hd.hasOwnProperty(t))return Ud.map((function(e){return e+t}))},function(e,t,n,r){if("string"===typeof t&&Gd.hasOwnProperty(e)){var o=function(e,t){if(Ed()(e))return e;for(var n=e.split(/,(?![^()]*(?:\([^()]*\))?\))/g),r=0,o=n.length;r<o;++r){var i=n[r],a=[i];for(var s in t){var l=$d()(s);if(i.indexOf(l)>-1&&"order"!==l)for(var c=t[s],u=0,p=c.length;u<p;++u)a.unshift(i.replace(l,Kd[c[u]]+l))}n[r]=a.join(",")}return n.join(",")}(t,r),i=o.split(/,(?![^()]*(?:\([^()]*\))?\))/g).filter((function(e){return!/-moz-|-ms-/.test(e)})).join(",");if(e.indexOf("Webkit")>-1)return i;var a=o.split(/,(?![^()]*(?:\([^()]*\))?\))/g).filter((function(e){return!/-webkit-|-ms-/.test(e)})).join(",");return e.indexOf("Moz")>-1?a:(n["Webkit"+fd(e)]=i,n["Moz"+fd(e)]=a,o)}},function(e,t){if("display"===e&&Td.hasOwnProperty(t))return Td[t]}]});function Jd(e,t,n,r){const o=e.getCache(n);let i="";for(const a in t){const s=t[a];if(void 0!==s&&null!==s)if("object"!==typeof s){0;const e=`${bd(a)}:${s}`,t=`${r}${e}`,n=o.cache[t];if(void 0!==n){i+=" "+n;continue}{let n="";const l=Yd({[a]:s});for(const t in l){const r=l[t],o=typeof r;if("string"===o||"number"===o){const o=`${bd(t)}:${r}`;o!==e&&(n+=`${o};`)}else if(Array.isArray(r)){const o=bd(t);for(let t=0;t<r.length;t++){const i=`${o}:${r[t]}`;i!==e&&(n+=`${i};`)}}}n+=e;i+=" "+o.addValue(t,{pseudo:r,block:n})}}else":"===a[0]?i+=" "+Jd(e,s,n,r+a):"@media"===a.substring(0,6)&&(i+=" "+Jd(e,s,a.substr(7),r))}return i.slice(1)}function Zd(e){let t="";for(const n in e)t+=`${n}{${Qd(e[n])}}`;return t}function Qd(e){let t="";for(const n in e){const r=e[n];"string"!==typeof r&&"number"!==typeof r||(t+=`${bd(n)}:${r};`)}return t.slice(0,-1)}const eb=/\.([^{:]+)(:[^{]+)?{(?:[^}]*;)?([^}]*?)}/g,tb=/@keyframes ([^{]+){((?:(?:from|to|(?:\d+\.?\d*%))\{(?:[^}])*})*)}/g,nb=/@font-face\{font-family:([^;]+);([^}]*)\}/g;function rb(e,t,n){let r;for(;r=t.exec(n);){const[,t,n,o]=r;0;const i=n?`${n}${o}`:o;e.cache[i]=t,e.idGenerator.increment()}}function ob(e,t,n){let r;for(;r=t.exec(n);){const[,t,n]=r;0,e.cache[n]=t,e.idGenerator.increment()}}const ib=class{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.styleElements={};const t=new $p(e.prefix),n=(e,t,n)=>{const{pseudo:r,block:o}=n,i=this.styleElements[e.key].sheet,a=function(e,t){let n=`.${e}`;return t&&(n+=t),n}(t,r),s=function(e,t){return`${e}{${t}}`}(a,o);try{i.insertRule(s,i.cssRules.length)}catch(l){0}};if(this.styleCache=new ld(t,((e,t,n)=>{const r=document.createElement("style");if(r.media=e,void 0===n)this.container.appendChild(r);else{const e=function(e,t){let n=0;for(;n<e.length;n++){const r=e[n];if("STYLE"===r.tagName&&r.media===t)return n}return-1}(this.container.children,n);this.container.insertBefore(r,this.container.children[e])}this.styleElements[e]=r}),n),this.keyframesCache=new cd(new $p(e.prefix),((e,t,n)=>{this.styleCache.getCache("");const r=this.styleElements[""].sheet,o=function(e,t){return`@keyframes ${e}{${t}}`}(t,Zd(n));try{r.insertRule(o,r.cssRules.length)}catch(i){0}})),this.fontFaceCache=new cd(new $p(e.prefix),((e,t,n)=>{this.styleCache.getCache("");const r=this.styleElements[""].sheet,o=function(e,t){return`@font-face{font-family:${e};${t}}`}(t,Qd(n));try{r.insertRule(o,r.cssRules.length)}catch(i){0}})),e.container&&(this.container=e.container),e.hydrate&&e.hydrate.length>0){if(!this.container){const t=e.hydrate[0].parentElement;null!==t&&void 0!==t&&(this.container=t)}for(let r=0;r<e.hydrate.length;r++){const o=e.hydrate[r],i=o.getAttribute("data-hydrate");if("font-face"===i){ob(this.fontFaceCache,nb,o.textContent);continue}if("keyframes"===i){ob(this.keyframesCache,tb,o.textContent);continue}const a=o.media?o.media:"";this.styleElements[a]=o;const s=new cd(t,n);s.key=a,rb(s,eb,o.textContent),this.styleCache.sortedCacheKeys.push(a),this.styleCache.caches[a]=s}}if(!this.container){if(null===document.head)throw new Error("No container provided and `document.head` was null");this.container=document.head}}renderStyle(e){return Jd(this.styleCache,e,"","")}renderFontFace(e){const t=Qd(e);return this.fontFaceCache.addValue(t,e)}renderKeyframes(e){const t=Zd(e);return this.keyframesCache.addValue(t,e)}};var ab=__webpack_require__(68515);const sb=new ib({prefix:"st-"}),lb=Date.now();const cb=function(e){return(0,h.jsx)(r.yJ,{kernel:e.kernel,children:(0,h.jsx)(ab.Kq,{value:sb,children:(0,h.jsx)(Xp,{streamlitExecutionStartedAt:lb})})})};function ub(e){return new URL(e,window.location.href).href}const pb="streamlit_app.py";function db(e){if("string"===typeof e){return{kernelOptions:{entrypoint:pb,files:{[pb]:{data:e}},archives:[],requirements:[],prebuiltPackageNames:[]},toastCallbackOptions:{disableProgressToasts:!1,disableErrorToasts:!1}}}const t=function(e){if(null==e)return{};const t={};return Object.keys(e).forEach((n=>{const r=e[n];if("string"!==typeof r&&!ArrayBuffer.isView(r)){if("object"===typeof r){if("data"in r)return void(t[n]=r);if("url"in r)return void(t[n]={...r,url:ub(r.url)})}throw new Error(`Invalid file value: ${r}`)}t[n]={data:r}})),t}(e.files),n=function(e){return null==e?[]:e.map((e=>"buffer"in e?e:{...e,url:ub(e.url)}))}(e.archives),r=e.entrypoint;if(null==r)throw new Error("The `entrypoint` field is required.");return{kernelOptions:{entrypoint:r,files:t,archives:n,requirements:e.requirements||[],prebuiltPackageNames:e.prebuiltPackageNames||[],hostConfigResponse:e.hostConfig,pyodideUrl:e.pyodideUrl,streamlitConfig:e.streamlitConfig,idbfsMountpoints:e.idbfsMountpoints},toastCallbackOptions:{disableProgressToasts:e.disableProgressToasts||!1,disableErrorToasts:e.disableErrorToasts||!1}}}function bb(e){var t,n,r="";if("string"==typeof e||"number"==typeof e)r+=e;else if("object"==typeof e)if(Array.isArray(e))for(t=0;t<e.length;t++)e[t]&&(n=bb(e[t]))&&(r&&(r+=" "),r+=n);else for(t in e)e[t]&&(r&&(r+=" "),r+=t);return r}const fb=function(){for(var e,t,n=0,r="";n<arguments.length;)(e=arguments[n++])&&(t=bb(e))&&(r&&(r+=" "),r+=t);return r},hb=e=>"number"==typeof e&&!isNaN(e),mb=e=>"string"==typeof e,Mb=e=>"function"==typeof e,gb=e=>mb(e)||Mb(e)?e:null,Ob=e=>(0,t.isValidElement)(e)||mb(e)||Mb(e)||hb(e);function zb(e){let{enter:n,exit:r,appendPosition:o=!1,collapse:i=!0,collapseDuration:a=300}=e;return function(e){let{children:s,position:l,preventExitTransition:c,done:u,nodeRef:p,isIn:d}=e;const b=o?`${n}--${l}`:n,f=o?`${r}--${l}`:r,h=(0,t.useRef)(0);return(0,t.useLayoutEffect)((()=>{const e=p.current,t=b.split(" "),n=r=>{r.target===p.current&&(e.dispatchEvent(new Event("d")),e.removeEventListener("animationend",n),e.removeEventListener("animationcancel",n),0===h.current&&"animationcancel"!==r.type&&e.classList.remove(...t))};e.classList.add(...t),e.addEventListener("animationend",n),e.addEventListener("animationcancel",n)}),[]),(0,t.useEffect)((()=>{const e=p.current,t=()=>{e.removeEventListener("animationend",t),i?function(e,t,n){void 0===n&&(n=300);const{scrollHeight:r,style:o}=e;requestAnimationFrame((()=>{o.minHeight="initial",o.height=r+"px",o.transition=`all ${n}ms`,requestAnimationFrame((()=>{o.height="0",o.padding="0",o.margin="0",setTimeout(t,n)}))}))}(e,u,a):u()};d||(c?t():(h.current=1,e.className+=` ${f}`,e.addEventListener("animationend",t)))}),[d]),t.createElement(t.Fragment,null,s)}}function yb(e,t){return null!=e?{content:e.content,containerId:e.props.containerId,id:e.props.toastId,theme:e.props.theme,type:e.props.type,data:e.props.data||{},isLoading:e.props.isLoading,icon:e.props.icon,status:t}:{}}const Ab={list:new Map,emitQueue:new Map,on(e,t){return this.list.has(e)||this.list.set(e,[]),this.list.get(e).push(t),this},off(e,t){if(t){const n=this.list.get(e).filter((e=>e!==t));return this.list.set(e,n),this}return this.list.delete(e),this},cancelEmit(e){const t=this.emitQueue.get(e);return t&&(t.forEach(clearTimeout),this.emitQueue.delete(e)),this},emit(e){this.list.has(e)&&this.list.get(e).forEach((t=>{const n=setTimeout((()=>{t(...[].slice.call(arguments,1))}),0);this.emitQueue.has(e)||this.emitQueue.set(e,[]),this.emitQueue.get(e).push(n)}))}},vb=e=>{let{theme:n,type:r,...o}=e;return t.createElement("svg",{viewBox:"0 0 24 24",width:"100%",height:"100%",fill:"colored"===n?"currentColor":`var(--toastify-icon-color-${r})`,...o})},wb={info:function(e){return t.createElement(vb,{...e},t.createElement("path",{d:"M12 0a12 12 0 1012 12A12.013 12.013 0 0012 0zm.25 5a1.5 1.5 0 11-1.5 1.5 1.5 1.5 0 011.5-1.5zm2.25 13.5h-4a1 1 0 010-2h.75a.25.25 0 00.25-.25v-4.5a.25.25 0 00-.25-.25h-.75a1 1 0 010-2h1a2 2 0 012 2v4.75a.25.25 0 00.25.25h.75a1 1 0 110 2z"}))},warning:function(e){return t.createElement(vb,{...e},t.createElement("path",{d:"M23.32 17.191L15.438 2.184C14.728.833 13.416 0 11.996 0c-1.42 0-2.733.833-3.443 2.184L.533 17.448a4.744 4.744 0 000 4.368C1.243 23.167 2.555 24 3.975 24h16.05C22.22 24 24 22.044 24 19.632c0-.904-.251-1.746-.68-2.44zm-9.622 1.46c0 1.033-.724 1.823-1.698 1.823s-1.698-.79-1.698-1.822v-.043c0-1.028.724-1.822 1.698-1.822s1.698.79 1.698 1.822v.043zm.039-12.285l-.84 8.06c-.057.581-.408.943-.897.943-.49 0-.84-.367-.896-.942l-.84-8.065c-.057-.624.25-1.095.779-1.095h1.91c.528.005.84.476.784 1.1z"}))},success:function(e){return t.createElement(vb,{...e},t.createElement("path",{d:"M12 0a12 12 0 1012 12A12.014 12.014 0 0012 0zm6.927 8.2l-6.845 9.289a1.011 1.011 0 01-1.43.188l-4.888-3.908a1 1 0 111.25-1.562l4.076 3.261 6.227-8.451a1 1 0 111.61 1.183z"}))},error:function(e){return t.createElement(vb,{...e},t.createElement("path",{d:"M11.983 0a12.206 12.206 0 00-8.51 3.653A11.8 11.8 0 000 12.207 11.779 11.779 0 0011.8 24h.214A12.111 12.111 0 0024 11.791 11.766 11.766 0 0011.983 0zM10.5 16.542a1.476 1.476 0 011.449-1.53h.027a1.527 1.527 0 011.523 1.47 1.475 1.475 0 01-1.449 1.53h-.027a1.529 1.529 0 01-1.523-1.47zM11 12.5v-6a1 1 0 012 0v6a1 1 0 11-2 0z"}))},spinner:function(){return t.createElement("div",{className:"Toastify__spinner"})}};function Sb(e){const[,n]=(0,t.useReducer)((e=>e+1),0),[r,o]=(0,t.useState)([]),i=(0,t.useRef)(null),a=(0,t.useRef)(new Map).current,s=e=>-1!==r.indexOf(e),l=(0,t.useRef)({toastKey:1,displayedToast:0,count:0,queue:[],props:e,containerId:null,isToastActive:s,getToast:e=>a.get(e)}).current;function c(e){let{containerId:t}=e;const{limit:n}=l.props;!n||t&&l.containerId!==t||(l.count-=l.queue.length,l.queue=[])}function u(e){o((t=>null==e?[]:t.filter((t=>t!==e))))}function p(){const{toastContent:e,toastProps:t,staleId:n}=l.queue.shift();b(e,t,n)}function d(e,r){let{delay:o,staleId:s,...c}=r;if(!Ob(e)||function(e){return!i.current||l.props.enableMultiContainer&&e.containerId!==l.props.containerId||a.has(e.toastId)&&null==e.updateId}(c))return;const{toastId:d,updateId:f,data:h}=c,{props:m}=l,M=()=>u(d),g=null==f;g&&l.count++;const O={...m,style:m.toastStyle,key:l.toastKey++,...Object.fromEntries(Object.entries(c).filter((e=>{let[t,n]=e;return null!=n}))),toastId:d,updateId:f,data:h,closeToast:M,isIn:!1,className:gb(c.className||m.toastClassName),bodyClassName:gb(c.bodyClassName||m.bodyClassName),progressClassName:gb(c.progressClassName||m.progressClassName),autoClose:!c.isLoading&&(z=c.autoClose,y=m.autoClose,!1===z||hb(z)&&z>0?z:y),deleteToast(){const e=yb(a.get(d),"removed");a.delete(d),Ab.emit(4,e);const t=l.queue.length;if(l.count=null==d?l.count-l.displayedToast:l.count-1,l.count<0&&(l.count=0),t>0){const e=null==d?l.props.limit:1;if(1===t||1===e)l.displayedToast++,p();else{const n=e>t?t:e;l.displayedToast=n;for(let e=0;e<n;e++)p()}}else n()}};var z,y;O.iconOut=function(e){let{theme:n,type:r,isLoading:o,icon:i}=e,a=null;const s={theme:n,type:r};return!1===i||(Mb(i)?a=i(s):(0,t.isValidElement)(i)?a=(0,t.cloneElement)(i,s):mb(i)||hb(i)?a=i:o?a=wb.spinner():(e=>e in wb)(r)&&(a=wb[r](s))),a}(O),Mb(c.onOpen)&&(O.onOpen=c.onOpen),Mb(c.onClose)&&(O.onClose=c.onClose),O.closeButton=m.closeButton,!1===c.closeButton||Ob(c.closeButton)?O.closeButton=c.closeButton:!0===c.closeButton&&(O.closeButton=!Ob(m.closeButton)||m.closeButton);let A=e;(0,t.isValidElement)(e)&&!mb(e.type)?A=(0,t.cloneElement)(e,{closeToast:M,toastProps:O,data:h}):Mb(e)&&(A=e({closeToast:M,toastProps:O,data:h})),m.limit&&m.limit>0&&l.count>m.limit&&g?l.queue.push({toastContent:A,toastProps:O,staleId:s}):hb(o)?setTimeout((()=>{b(A,O,s)}),o):b(A,O,s)}function b(e,t,n){const{toastId:r}=t;n&&a.delete(n);const i={content:e,props:t};a.set(r,i),o((e=>[...e,r].filter((e=>e!==n)))),Ab.emit(4,yb(i,null==i.props.updateId?"added":"updated"))}return(0,t.useEffect)((()=>(l.containerId=e.containerId,Ab.cancelEmit(3).on(0,d).on(1,(e=>i.current&&u(e))).on(5,c).emit(2,l),()=>{a.clear(),Ab.emit(3,l)})),[]),(0,t.useEffect)((()=>{l.props=e,l.isToastActive=s,l.displayedToast=r.length})),{getToastToRender:function(t){const n=new Map,r=Array.from(a.values());return e.newestOnTop&&r.reverse(),r.forEach((e=>{const{position:t}=e.props;n.has(t)||n.set(t,[]),n.get(t).push(e)})),Array.from(n,(e=>t(e[0],e[1])))},containerRef:i,isToastActive:s}}function qb(e){return e.targetTouches&&e.targetTouches.length>=1?e.targetTouches[0].clientX:e.clientX}function Eb(e){return e.targetTouches&&e.targetTouches.length>=1?e.targetTouches[0].clientY:e.clientY}function _b(e){const[n,r]=(0,t.useState)(!1),[o,i]=(0,t.useState)(!1),a=(0,t.useRef)(null),s=(0,t.useRef)({start:0,x:0,y:0,delta:0,removalDistance:0,canCloseOnClick:!0,canDrag:!1,boundingRect:null,didMove:!1}).current,l=(0,t.useRef)(e),{autoClose:c,pauseOnHover:u,closeToast:p,onClick:d,closeOnClick:b}=e;function f(t){if(e.draggable){"touchstart"===t.nativeEvent.type&&t.nativeEvent.preventDefault(),s.didMove=!1,document.addEventListener("mousemove",g),document.addEventListener("mouseup",O),document.addEventListener("touchmove",g),document.addEventListener("touchend",O);const n=a.current;s.canCloseOnClick=!0,s.canDrag=!0,s.boundingRect=n.getBoundingClientRect(),n.style.transition="",s.x=qb(t.nativeEvent),s.y=Eb(t.nativeEvent),"x"===e.draggableDirection?(s.start=s.x,s.removalDistance=n.offsetWidth*(e.draggablePercent/100)):(s.start=s.y,s.removalDistance=n.offsetHeight*(80===e.draggablePercent?1.5*e.draggablePercent:e.draggablePercent/100))}}function h(t){if(s.boundingRect){const{top:n,bottom:r,left:o,right:i}=s.boundingRect;"touchend"!==t.nativeEvent.type&&e.pauseOnHover&&s.x>=o&&s.x<=i&&s.y>=n&&s.y<=r?M():m()}}function m(){r(!0)}function M(){r(!1)}function g(t){const r=a.current;s.canDrag&&r&&(s.didMove=!0,n&&M(),s.x=qb(t),s.y=Eb(t),s.delta="x"===e.draggableDirection?s.x-s.start:s.y-s.start,s.start!==s.x&&(s.canCloseOnClick=!1),r.style.transform=`translate${e.draggableDirection}(${s.delta}px)`,r.style.opacity=""+(1-Math.abs(s.delta/s.removalDistance)))}function O(){document.removeEventListener("mousemove",g),document.removeEventListener("mouseup",O),document.removeEventListener("touchmove",g),document.removeEventListener("touchend",O);const t=a.current;if(s.canDrag&&s.didMove&&t){if(s.canDrag=!1,Math.abs(s.delta)>s.removalDistance)return i(!0),void e.closeToast();t.style.transition="transform 0.2s, opacity 0.2s",t.style.transform=`translate${e.draggableDirection}(0)`,t.style.opacity="1"}}(0,t.useEffect)((()=>{l.current=e})),(0,t.useEffect)((()=>(a.current&&a.current.addEventListener("d",m,{once:!0}),Mb(e.onOpen)&&e.onOpen((0,t.isValidElement)(e.children)&&e.children.props),()=>{const e=l.current;Mb(e.onClose)&&e.onClose((0,t.isValidElement)(e.children)&&e.children.props)})),[]),(0,t.useEffect)((()=>(e.pauseOnFocusLoss&&(document.hasFocus()||M(),window.addEventListener("focus",m),window.addEventListener("blur",M)),()=>{e.pauseOnFocusLoss&&(window.removeEventListener("focus",m),window.removeEventListener("blur",M))})),[e.pauseOnFocusLoss]);const z={onMouseDown:f,onTouchStart:f,onMouseUp:h,onTouchEnd:h};return c&&u&&(z.onMouseEnter=M,z.onMouseLeave=m),b&&(z.onClick=e=>{d&&d(e),s.canCloseOnClick&&p()}),{playToast:m,pauseToast:M,isRunning:n,preventExitTransition:o,toastRef:a,eventHandlers:z}}function xb(e){let{closeToast:n,theme:r,ariaLabel:o="close"}=e;return t.createElement("button",{className:`Toastify__close-button Toastify__close-button--${r}`,type:"button",onClick:e=>{e.stopPropagation(),n(e)},"aria-label":o},t.createElement("svg",{"aria-hidden":"true",viewBox:"0 0 14 16"},t.createElement("path",{fillRule:"evenodd",d:"M7.71 8.23l3.75 3.75-1.48 1.48-3.75-3.75-3.75 3.75L1 11.98l3.75-3.75L1 4.48 2.48 3l3.75 3.75L9.98 3l1.48 1.48-3.75 3.75z"})))}function Tb(e){let{delay:n,isRunning:r,closeToast:o,type:i="default",hide:a,className:s,style:l,controlledProgress:c,progress:u,rtl:p,isIn:d,theme:b}=e;const f=a||c&&0===u,h={...l,animationDuration:`${n}ms`,animationPlayState:r?"running":"paused",opacity:f?0:1};c&&(h.transform=`scaleX(${u})`);const m=fb("Toastify__progress-bar",c?"Toastify__progress-bar--controlled":"Toastify__progress-bar--animated",`Toastify__progress-bar-theme--${b}`,`Toastify__progress-bar--${i}`,{"Toastify__progress-bar--rtl":p}),M=Mb(s)?s({rtl:p,type:i,defaultClassName:m}):fb(m,s);return t.createElement("div",{role:"progressbar","aria-hidden":f?"true":"false","aria-label":"notification timer",className:M,style:h,[c&&u>=1?"onTransitionEnd":"onAnimationEnd"]:c&&u<1?null:()=>{d&&o()}})}const Rb=e=>{const{isRunning:n,preventExitTransition:r,toastRef:o,eventHandlers:i}=_b(e),{closeButton:a,children:s,autoClose:l,onClick:c,type:u,hideProgressBar:p,closeToast:d,transition:b,position:f,className:h,style:m,bodyClassName:M,bodyStyle:g,progressClassName:O,progressStyle:z,updateId:y,role:A,progress:v,rtl:w,toastId:S,deleteToast:q,isIn:E,isLoading:_,iconOut:x,closeOnClick:T,theme:R}=e,k=fb("Toastify__toast",`Toastify__toast-theme--${R}`,`Toastify__toast--${u}`,{"Toastify__toast--rtl":w},{"Toastify__toast--close-on-click":T}),N=Mb(h)?h({rtl:w,position:f,type:u,defaultClassName:k}):fb(k,h),C=!!v||!l,W={closeToast:d,type:u,theme:R};let L=null;return!1===a||(L=Mb(a)?a(W):(0,t.isValidElement)(a)?(0,t.cloneElement)(a,W):xb(W)),t.createElement(b,{isIn:E,done:q,position:f,preventExitTransition:r,nodeRef:o},t.createElement("div",{id:S,onClick:c,className:N,...i,style:m,ref:o},t.createElement("div",{...E&&{role:A},className:Mb(M)?M({type:u}):fb("Toastify__toast-body",M),style:g},null!=x&&t.createElement("div",{className:fb("Toastify__toast-icon",{"Toastify--animate-icon Toastify__zoom-enter":!_})},x),t.createElement("div",null,s)),L,t.createElement(Tb,{...y&&!C?{key:`pb-${y}`}:{},rtl:w,theme:R,delay:l,isRunning:n,isIn:E,closeToast:d,hide:p,type:u,style:z,className:O,controlledProgress:C,progress:v||0})))},kb=function(e,t){return void 0===t&&(t=!1),{enter:`Toastify--animate Toastify__${e}-enter`,exit:`Toastify--animate Toastify__${e}-exit`,appendPosition:t}},Nb=zb(kb("bounce",!0)),Cb=zb(kb("slide",!0)),Wb=(zb(kb("zoom")),zb(kb("flip")),(0,t.forwardRef)(((e,n)=>{const{getToastToRender:r,containerRef:o,isToastActive:i}=Sb(e),{className:a,style:s,rtl:l,containerId:c}=e;function u(e){const t=fb("Toastify__toast-container",`Toastify__toast-container--${e}`,{"Toastify__toast-container--rtl":l});return Mb(a)?a({position:e,rtl:l,defaultClassName:t}):fb(t,gb(a))}return(0,t.useEffect)((()=>{n&&(n.current=o.current)}),[]),t.createElement("div",{ref:o,className:"Toastify",id:c},r(((e,n)=>{const r=n.length?{...s}:{...s,pointerEvents:"none"};return t.createElement("div",{className:u(e),style:r,key:`container-${e}`},n.map(((e,r)=>{let{content:o,props:a}=e;return t.createElement(Rb,{...a,isIn:i(a.toastId),style:{...a.style,"--nth":r+1,"--len":n.length},key:`toast-${a.key}`},o)})))})))})));Wb.displayName="ToastContainer",Wb.defaultProps={position:"top-right",transition:Nb,autoClose:5e3,closeButton:xb,pauseOnHover:!0,pauseOnFocusLoss:!0,closeOnClick:!0,draggable:!0,draggablePercent:80,draggableDirection:"x",role:"alert",theme:"light"};let Lb,Ib=new Map,Pb=[],Db=1;function Bb(){return""+Db++}function jb(e){return e&&(mb(e.toastId)||hb(e.toastId))?e.toastId:Bb()}function Fb(e,t){return Ib.size>0?Ab.emit(0,e,t):Pb.push({content:e,options:t}),t.toastId}function Ub(e,t){return{...t,type:t&&t.type||e,toastId:jb(t)}}function Vb(e){return(t,n)=>Fb(t,Ub(e,n))}function Hb(e,t){return Fb(e,Ub("default",t))}Hb.loading=(e,t)=>Fb(e,Ub("default",{isLoading:!0,autoClose:!1,closeOnClick:!1,closeButton:!1,draggable:!1,...t})),Hb.promise=function(e,t,n){let r,{pending:o,error:i,success:a}=t;o&&(r=mb(o)?Hb.loading(o,n):Hb.loading(o.render,{...n,...o}));const s={isLoading:null,autoClose:null,closeOnClick:null,closeButton:null,draggable:null},l=(e,t,o)=>{if(null==t)return void Hb.dismiss(r);const i={type:e,...s,...n,data:o},a=mb(t)?{render:t}:t;return r?Hb.update(r,{...i,...a}):Hb(a.render,{...i,...a}),o},c=Mb(e)?e():e;return c.then((e=>l("success",a,e))).catch((e=>l("error",i,e))),c},Hb.success=Vb("success"),Hb.info=Vb("info"),Hb.error=Vb("error"),Hb.warning=Vb("warning"),Hb.warn=Hb.warning,Hb.dark=(e,t)=>Fb(e,Ub("default",{theme:"dark",...t})),Hb.dismiss=e=>{Ib.size>0?Ab.emit(1,e):Pb=Pb.filter((t=>null!=e&&t.options.toastId!==e))},Hb.clearWaitingQueue=function(e){return void 0===e&&(e={}),Ab.emit(5,e)},Hb.isActive=e=>{let t=!1;return Ib.forEach((n=>{n.isToastActive&&n.isToastActive(e)&&(t=!0)})),t},Hb.update=function(e,t){void 0===t&&(t={}),setTimeout((()=>{const n=function(e,t){let{containerId:n}=t;const r=Ib.get(n||Lb);return r&&r.getToast(e)}(e,t);if(n){const{props:r,content:o}=n,i={delay:100,...r,...t,toastId:t.toastId||e,updateId:Bb()};i.toastId!==e&&(i.staleId=e);const a=i.render||o;delete i.render,Fb(a,i)}}),0)},Hb.done=e=>{Hb.update(e,{progress:1})},Hb.onChange=e=>(Ab.on(4,e),()=>{Ab.off(4,e)}),Hb.POSITION={TOP_LEFT:"top-left",TOP_RIGHT:"top-right",TOP_CENTER:"top-center",BOTTOM_LEFT:"bottom-left",BOTTOM_RIGHT:"bottom-right",BOTTOM_CENTER:"bottom-center"},Hb.TYPE={INFO:"info",SUCCESS:"success",WARNING:"warning",ERROR:"error",DEFAULT:"default"},Ab.on(2,(e=>{Lb=e.containerId||e,Ib.set(Lb,e),Pb.forEach((e=>{Ab.emit(0,e.content,e.options)})),Pb=[]})).on(3,(e=>{Ib.delete(e.containerId||e),0===Ib.size&&Ab.off(0).off(1).off(5)}));const Xb=function(e){const t=e;return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)("p",{children:t.message}),t.error&&(0,h.jsx)("pre",{style:{overflow:"scroll",maxHeight:300},children:(0,h.jsx)("code",{children:t.error.message})})]})};function $b(e){const{disableProgressToasts:t=!1,disableErrorToasts:n=!1}=null!==e&&void 0!==e?e:{};let r=null;const o=[];return{onProgress:e=>{if(t)return;const n=Hb(e,{position:Hb.POSITION.BOTTOM_RIGHT,transition:Cb,isLoading:!0,hideProgressBar:!0,closeButton:!1});o.push(n),r&&Hb.update(r,{isLoading:!1,autoClose:3e3}),r=n},onLoad:()=>{o.forEach((e=>Hb.dismiss(e)))},onError:e=>{n||Hb((0,h.jsx)(Xb,{message:"Error during booting up",error:e}),{position:Hb.POSITION.BOTTOM_RIGHT,type:Hb.TYPE.ERROR,autoClose:!1,closeOnClick:!1})}}}function Gb(e,t){const n=t.error;return Hb.promise(e,{pending:t.pending,success:t.success,error:"string"===typeof n?{render(e){let{data:t}=e;return t?(0,h.jsx)(Xb,{message:n,error:t}):(0,h.jsx)(h.Fragment,{children:"messages.error"})},autoClose:!1,closeOnClick:!1}:n},{hideProgressBar:!0,position:Hb.POSITION.BOTTOM_RIGHT})}class Kb{constructor(e,t){this.kernel=e,e.onModuleAutoLoad=(e,n)=>{null!==t&&void 0!==t&&t.onModuleAutoLoad&&t.onModuleAutoLoad(e,n),Gb(n,{success:{render(e){let{data:t}=e;return"Auto-loaded"+(t?": "+t.map((e=>e.name)).join(", "):" packages")}},error:"Failed to auto-load packages",pending:"Auto-loading packages"})}}writeFile(){return Gb(this.kernel.writeFile(...arguments),{error:"Failed to write the file"})}renameFile(){return Gb(this.kernel.renameFile(...arguments),{error:"Failed to rename the file"})}unlink(){return Gb(this.kernel.unlink(...arguments),{error:"Failed to remove the file"})}readFile(){return Gb(this.kernel.readFile(...arguments),{error:"Failed to read the file"})}install(){return Gb(this.kernel.install(...arguments),{pending:"Installing",success:"Successfully installed",error:"Failed to install"})}reboot(){return Gb(this.kernel.reboot(...arguments),{pending:"Rebooting",success:"Successfully rebooted",error:"Failed to reboot"})}}function Yb(){const e=(0,o.x0)().name;return e===o.QM?window.matchMedia("(prefers-color-scheme: dark)").matches:e===su.a5.name}const Jb=function(){return(0,h.jsx)(Wb,{style:{zIndex:999999},theme:Yb()?"dark":"light"})};let Zb;if(("."===__webpack_require__.p||__webpack_require__.p.startsWith("./"))&&document.currentScript&&"src"in document.currentScript){const e=function(e){const t=e.split("/").slice(0,-1).join("/")+"/";try{return new URL(t).toString()}catch{return new URL(t,window.location.origin).toString()}}(document.currentScript.src);__webpack_require__.p=e,Zb=e}function Qb(e){let o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:document.body;const{kernelOptions:i,toastCallbackOptions:a}=db(e),s=new r.rI({...i,wheelBaseUrl:Zb,...$b(a)});n.render((0,h.jsxs)(t.StrictMode,{children:[(0,h.jsx)(cb,{kernel:s}),(0,h.jsx)(Jb,{})]}),o);const l=new Kb(s);return{unmount:()=>{s.dispose(),n.unmountComponentAtNode(o)},install:e=>l.install(e),writeFile:(e,t,n)=>l.writeFile(e,t,n),renameFile:(e,t)=>l.renameFile(e,t),unlink:e=>l.unlink(e),readFile:(e,t)=>l.readFile(e,t)}}var ef=__webpack_require__(87330);const tf={object(){return this.string(function(e){for(var t=e[0],n=1,r=arguments.length;n<r;n++)t+=arguments[n]+e[n];return t}(...arguments))},string(e){for(const t of e.split(/[\r\n]+/))if(t.trim().length){/^(\s+)/.test(t)&&(e=e.replace(new RegExp("^"+RegExp.$1,"gm"),""));break}return e}},nf=function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return tf[typeof e](e,...n)};document.addEventListener("DOMContentLoaded",(()=>{!function(e){class t extends HTMLElement{constructor(){super(...arguments),this._controller=null,this.parseOptions=()=>{let e=null;const t={};let n="";const r=[],o=[];if(this.childNodes.forEach((i=>{if(i instanceof Text){const e=i.textContent;if(null==e)return;if(""===e.replace(/\s*/g,""))return;o.push(e)}else if(i instanceof HTMLElement)switch(i.tagName){case"APP-FILE":{const n=i.getAttribute("name");if(!n)throw new Error("Attribute 'name' is required for <app-file>");if(t[n])throw new Error(`File with name '${n}' already exists`);const r=i.getAttribute("url"),o=i.getAttribute("encoding");if(r)return void(t[n]={url:r,opts:o?{encoding:o}:void 0});if(t[n]=i.textContent?nf(i.textContent):"",i.hasAttribute("entrypoint")){if(e)throw new Error("Multiple entrypoints are not allowed");e=n}return}case"APP-REQUIREMENTS":return void(n+=i.textContent?nf(i.textContent):"");case"APP-ARCHIVE":{const e=i.getAttribute("url"),t=i.getAttribute("format");if(!e||!t)throw new Error("Attributes 'url' and 'format' are required for <app-archive>");return void r.push({url:e,format:t})}}})),null===e){if(0===o.length)throw new Error("No content found");e="streamlit_app.py",t[e]=nf(o[0])}if(!e)throw new Error("Entrypoint is required");return{entrypoint:e,files:t,requirements:(0,ef.Yl)(n),archives:r,streamlitConfig:{}}}}connectedCallback(){const t=this.parseOptions(),n=document.createElement("div");n.classList.add("stlite-app-container"),this.appendChild(n),this._controller=e(t,n),this.style.display="block"}disconnectedCallback(){var e;null===(e=this._controller)||void 0===e||e.unmount()}}customElements.define("streamlit-app",t)}(Qb)}))})(),stlite=__webpack_exports__})();
28
+ }`,Wp=(0,z.A)("div",{target:"e7qru6u0"})((e=>{let{theme:t}=e;return{position:"fixed",display:"flex",justifyContent:"center",alignItems:"center",top:0,left:0,width:t.sizes.full,height:t.sizes.full,fontSize:"40vh",color:t.colors.red,fontWeight:t.fontWeights.bold,opacity:"0.8",textShadow:`1px 1px 10px ${t.colors.darkGray}`,transition:"opacity 0.3s ease-in-out",animation:`${Cp} 1s`}}),""),Lp=e=>{let{countdown:n,endCallback:r}=e;const[o,i]=(0,t.useState)(n);return(0,h.jsx)(Wp,{"data-testid":"stCountdown",onAnimationEnd:()=>{const e=o-1;e>=0&&i(e),0===e&&r()},children:(0,h.jsx)("span",{children:o})},`frame${o}`)};const Ip=function(e){class n extends t.PureComponent{constructor(){super(...arguments),this.recorder=void 0,this.state={fileName:"streamlit-screencast",recordAudio:!1,currentState:this.props.testOverride||"OFF"},this.toggleRecordAudio=()=>{const{recordAudio:e}=this.state;this.setState({recordAudio:!e})},this.showDialog=e=>{const{currentState:t}=this.state;nc.isSupportedBrowser()?"OFF"===t?this.setState({fileName:e,currentState:"SETUP"}):this.stopRecording().catch((e=>(0,ce.FF)(`withScreencast.stopRecording threw an error: ${e}`))):this.setState({currentState:"UNSUPPORTED"})},this.startRecording=async()=>{const{recordAudio:e}=this.state;this.recorder=new nc({recordAudio:e,onErrorOrStop:()=>this.stopRecording()});try{await this.recorder.initialize()}catch(t){return(0,ce.FF)(`ScreenCastRecorder.initialize error: ${t}`),void this.setState({currentState:"UNSUPPORTED"})}this.setState({currentState:"COUNTDOWN"})},this.stopRecording=async()=>{let e;const{currentState:t}=this.state;"OFF"===t||(0,se.hX)(this.recorder)||("COUNTDOWN"===t&&this.setState({currentState:"OFF"}),"RECORDING"===t&&("inactive"===this.recorder.getState()?this.setState({currentState:"OFF"}):(e=await this.recorder.stop(),this.setState({outputBlob:e,currentState:"PREVIEW_FILE"}))))},this.onCountdownEnd=async()=>{if((0,se.hX)(this.recorder))throw new Error("Countdown finished but recorder is null");this.recorder.start()?this.setState({currentState:"RECORDING"}):this.stopRecording().catch((e=>(0,ce.FF)(`withScreencast.stopRecording threw an error: ${e}`)))},this.getScreenCastProps=()=>({currentState:this.state.currentState,toggleRecordAudio:this.toggleRecordAudio,startRecording:this.showDialog,stopRecording:this.stopRecording}),this.closeDialog=()=>{this.setState({currentState:"OFF"})},this.render=()=>{const{outputBlob:t,fileName:n,recordAudio:r,currentState:o}=this.state;return(0,h.jsxs)("div",{className:"withScreencast","data-testid":"stScreencast",children:[(0,h.jsx)(e,{...this.props,screenCast:this.getScreenCastProps()}),"UNSUPPORTED"===o&&(0,h.jsx)(Np,{onClose:this.closeDialog}),"SETUP"===o&&(0,h.jsx)(zp,{recordAudio:r,onClose:this.closeDialog,startRecording:this.startRecording,toggleRecordAudio:this.toggleRecordAudio}),"COUNTDOWN"===o&&(0,h.jsx)(Lp,{countdown:3,endCallback:this.onCountdownEnd}),"PREVIEW_FILE"===o&&t&&(0,h.jsx)(_p,{onClose:this.closeDialog,videoBlob:t,fileName:n})]})}}}return n.displayName=`withScreencast(${e.displayName||e.name})`,vo()(n,e)};function Pp(e){return e||"Streamlit"}class Dp{constructor(e){this.appPages=void 0,this.currentPageScriptHash=void 0,this.hideSidebarNav=void 0,this.appNav=void 0,this.appNav=e,this.appPages=[],this.currentPageScriptHash=null,this.hideSidebarNav=null}handleNewSession(e){var t,n,r,o,i;this.appPages=e.appPages,this.currentPageScriptHash=e.pageScriptHash,this.hideSidebarNav=null!==(t=null===(n=e.config)||void 0===n?void 0:n.hideSidebarNav)&&void 0!==t&&t;const a=this.appPages[0],s=null!==(r=a.urlPathname)&&void 0!==r?r:"",l=null!==(o=null===(i=this.appPages.find((e=>e.pageScriptHash===this.currentPageScriptHash)))||void 0===i?void 0:i.urlPathname)&&void 0!==o?o:"",c=a.pageScriptHash===this.currentPageScriptHash;return this.appNav.onUpdatePageUrl(s,l,c),document.title=Pp(null!==l&&void 0!==l?l:""),[{hideSidebarNav:this.hideSidebarNav,appPages:this.appPages,currentPageScriptHash:this.currentPageScriptHash},()=>{this.appNav.hostCommunicationMgr.sendMessageToHost({type:"SET_APP_PAGES",appPages:this.appPages}),this.appNav.hostCommunicationMgr.sendMessageToHost({type:"SET_CURRENT_PAGE_NAME",currentPageName:c?"":l,currentPageScriptHash:this.currentPageScriptHash})}]}handlePagesChanged(e){const{appPages:t}=e;return[{appPages:t},()=>{this.appNav.hostCommunicationMgr.sendMessageToHost({type:"SET_APP_PAGES",appPages:t})}]}handlePageNotFound(e){var t,n;const{pageName:r}=e;this.appNav.onPageNotFound(r);const o=null!==(t=null===(n=this.appPages[0])||void 0===n?void 0:n.pageScriptHash)&&void 0!==t?t:"";return this.currentPageScriptHash=o,[{currentPageScriptHash:o},()=>{this.appNav.hostCommunicationMgr.sendMessageToHost({type:"SET_CURRENT_PAGE_NAME",currentPageName:"",currentPageScriptHash:o})}]}handleNavigation(e){}findPageByUrlPath(e){var t;return 0===this.appPages.length?null:null!==(t=this.appPages.find((t=>e.endsWith("/"+t.urlPathname))))&&void 0!==t?t:this.appPages[0]}clearPageElements(e,t,n){return xe.empty(t,!1,n,e.logo)}}class Bp{constructor(e){this.appNav=void 0,this.mainScriptHash=void 0,this.appPages=void 0,this.mainPage=void 0,this.hideSidebarNav=void 0,this.appNav=e,this.mainScriptHash=null,this.appPages=[],this.mainPage=null,this.hideSidebarNav=null}handleNewSession(e){var t,n,r;(this.mainScriptHash=e.mainScriptHash,null===this.hideSidebarNav)&&(this.hideSidebarNav=null!==(n=null===(r=e.config)||void 0===r?void 0:r.hideSidebarNav)&&void 0!==n?n:null);return document.title=Pp(""),[{hideSidebarNav:null!==(t=this.hideSidebarNav)&&void 0!==t&&t},()=>{}]}handlePagesChanged(e){}handlePageNotFound(e){var t;const{pageName:n}=e;return this.appNav.onPageNotFound(n),[{currentPageScriptHash:null!==(t=this.mainScriptHash)&&void 0!==t?t:""},()=>{var e;this.appNav.hostCommunicationMgr.sendMessageToHost({type:"SET_CURRENT_PAGE_NAME",currentPageName:"",currentPageScriptHash:null!==(e=this.mainScriptHash)&&void 0!==e?e:""})}]}handleNavigation(e){var t,n;const{sections:r,position:o,appPages:i}=e;this.appPages=i,this.hideSidebarNav=o===ae.Vx.Position.HIDDEN;const a=e.pageScriptHash,s=i.find((e=>e.pageScriptHash===a)),l=i.find((e=>e.isDefault));this.mainPage=l;const c=s.urlPathname;if(!this.appNav.isPageTitleSet){var u;const e=Pp(s.pageName);document.title=e,this.appNav.hostCommunicationMgr.sendMessageToHost({type:"SET_PAGE_TITLE",title:null!==(u=s.pageName)&&void 0!==u?u:""})}return!this.appNav.isPageIconSet&&s.icon&&this.appNav.onPageIconChange(s.icon),this.appNav.onUpdatePageUrl(null!==(t=l.urlPathname)&&void 0!==t?t:"",c,null!==(n=s.isDefault)&&void 0!==n&&n),[{appPages:i,navSections:r,hideSidebarNav:this.hideSidebarNav,expandSidebarNav:e.expanded,currentPageScriptHash:a},()=>{this.appNav.hostCommunicationMgr.sendMessageToHost({type:"SET_APP_PAGES",appPages:i}),this.appNav.hostCommunicationMgr.sendMessageToHost({type:"SET_CURRENT_PAGE_NAME",currentPageName:s.isDefault?"":c,currentPageScriptHash:a})}]}findPageByUrlPath(e){var t;return null!==(t=this.appPages.find((t=>e.endsWith("/"+t.urlPathname))))&&void 0!==t?t:this.mainPage}clearPageElements(e,t,n){return e.filterMainScriptElements(t)}}class jp{constructor(e,t,n,r){this.hostCommunicationMgr=void 0,this.onUpdatePageUrl=void 0,this.onPageNotFound=void 0,this.onPageIconChange=void 0,this.isPageTitleSet=void 0,this.isPageIconSet=void 0,this.strategy=void 0,this.hostCommunicationMgr=e,this.onUpdatePageUrl=t,this.onPageNotFound=n,this.onPageIconChange=r,this.isPageIconSet=!1,this.isPageTitleSet=!1,this.strategy=new Dp(this)}handleNewSession(e){return this.isPageTitleSet=!1,this.isPageIconSet=!1,this.strategy.handleNewSession(e)}handleNavigation(e){return this.strategy instanceof Dp&&(this.strategy=new Bp(this)),this.strategy.handleNavigation(e)}handlePagesChanged(e){return this.strategy.handlePagesChanged(e)}handlePageNotFound(e){return this.strategy.handlePageNotFound(e)}findPageByUrlPath(e){return this.strategy.findPageByUrlPath(e)}handlePageConfigChanged(e){this.isPageIconSet=Boolean(e.favicon),this.isPageTitleSet=Boolean(e.title)}clearPageElements(e,t,n){return this.strategy.clearPageElements(e,t,n)}}const Fp="<null>",Up=(e,t)=>t==ae.TS.ToolbarMode.DEVELOPER||ae.TS.ToolbarMode.VIEWER!=t&&ae.TS.ToolbarMode.MINIMAL!=t&&(e||hc());class Vp extends t.PureComponent{constructor(e){var t;super(e),t=this,this.endpoints=void 0,this.sessionInfo=new le,this.metricsMgr=new hp(this.sessionInfo),this.sessionEventDispatcher=new np,this.connectionManager=void 0,this.widgetMgr=void 0,this.hostCommunicationMgr=void 0,this.uploadClient=void 0,this.pendingElementsBuffer=void 0,this.pendingElementsTimerRunning=void 0,this.componentRegistry=void 0,this.embeddingId=(0,se.cv)(),this.appNavigation=void 0,this.context=void 0,this.showDeployError=(e,t,n)=>{this.openDialog({type:Qu.DEPLOY_ERROR,title:e,msg:t,onContinue:n,onClose:()=>{},onTryAgain:this.sendLoadGitInfoBackMsg})},this.handleThemeMessage=(e,t)=>{const[,n,r]=(0,o.Ef)(),i=(0,o.tl)(this.props.theme.activeTheme);e===n.name&&i?this.props.theme.setTheme(n):e===r.name&&i?this.props.theme.setTheme(r):t&&this.props.theme.setImportedTheme(t)},this.handleConnectionStateChanged=e=>{if((0,ce.OG)(`Connection state changed from ${this.state.connectionState} to ${e}`),e===Dl.CONNECTED){(0,ce.OG)("Reconnected to server.");const e=this.state.scriptRunState===ue.RERUN_REQUESTED||this.state.scriptRunState===ue.RUNNING;this.sessionInfo.last&&!e||((0,ce.OG)("Requesting a script run."),this.widgetMgr.sendUpdateWidgetsMessage(void 0),this.setState({dialog:null})),this.hostCommunicationMgr.sendMessageToHost({type:"WEBSOCKET_CONNECTED"})}else this.state.connectionState===Dl.CONNECTED&&this.hostCommunicationMgr.sendMessageToHost({type:"WEBSOCKET_DISCONNECTED",attemptingToReconnect:e!==Dl.DISCONNECTED_FOREVER}),this.sessionInfo.isSet&&this.sessionInfo.clearCurrent();this.setState({connectionState:e})},this.handleGitInfoChanged=e=>{this.setState({gitInfo:e})},this.handleCustomParentMessage=e=>{this.state.appConfig.enableCustomParentMessages?this.hostCommunicationMgr.sendMessageToHost({type:"CUSTOM_PARENT_MESSAGE",message:e.message}):(0,ce.vV)("Sending messages to the host is disabled in line with the platform policy.")},this.handleMessage=e=>{try{((e,t,n)=>{const r=e[t];if(r in n)return n[r](e[r]);throw new Error(`Cannot handle ${t} "${r}".`)})(e,"type",{newSession:e=>this.handleNewSession(e),sessionStatusChanged:e=>this.handleSessionStatusChanged(e),sessionEvent:e=>this.handleSessionEvent(e),delta:t=>this.handleDeltaMsg(t,e.metadata),pageConfigChanged:e=>this.handlePageConfigChanged(e),pageInfoChanged:e=>this.handlePageInfoChanged(e),pagesChanged:e=>this.handlePagesChanged(e),pageNotFound:e=>this.handlePageNotFound(e),gitInfoChanged:e=>this.handleGitInfoChanged(e),scriptFinished:e=>this.handleScriptFinished(e),pageProfile:e=>this.handlePageProfileMsg(e),autoRerun:e=>this.handleAutoRerun(e),fileUrlsResponse:e=>this.uploadClient.onFileURLsResponse(e),parentMessage:e=>this.handleCustomParentMessage(e),logo:t=>this.handleLogo(t,e.metadata),navigation:e=>this.handleNavigation(e)})}catch(t){const e=(0,pe.$)(t);(0,ce.vV)(e),this.showError("Bad message format",e.message)}},this.handleLogo=(e,t)=>{const n={activeScriptHash:t.activeScriptHash,scriptRunId:this.state.scriptRunId};this.setState({elements:this.pendingElementsBuffer.appRootWithLogo(e,n)},(()=>{this.pendingElementsBuffer=this.state.elements}))},this.handlePageConfigChanged=e=>{const{title:t,favicon:n,layout:r,initialSidebarState:o,menuItems:i}=e;this.appNavigation.handlePageConfigChanged(e),t&&(this.hostCommunicationMgr.sendMessageToHost({type:"SET_PAGE_TITLE",title:t}),document.title=t),n&&this.onPageIconChanged(n),r!==this.state.layout&&this.setState((e=>({layout:r,userSettings:{...e.userSettings,wideMode:r===ae.wF.Layout.WIDE}}))),o!==this.state.initialSidebarState&&this.setState((()=>({initialSidebarState:o}))),this.setState({menuItems:i})},this.handlePageInfoChanged=e=>{const{queryString:t}=e,n=document.location.pathname+(t?`?${t}`:"");window.history.pushState({},"",n),this.hostCommunicationMgr.sendMessageToHost({type:"SET_QUERY_PARAM",queryParams:t?`?${t}`:""})},this.onPageNotFound=e=>{const t=e?`You have requested page /${e}, but no corresponding file was found in the app's pages/ directory`:"The page that you have requested does not seem to exist";this.showError("Page not found",`${t}. Running the app's main page.`)},this.handlePageNotFound=e=>{this.maybeSetState(this.appNavigation.handlePageNotFound(e))},this.onPageIconChanged=e=>{me(e,this.hostCommunicationMgr.sendMessageToHost,this.endpoints)},this.handlePagesChanged=e=>{this.maybeSetState(this.appNavigation.handlePagesChanged(e))},this.handleNavigation=e=>{this.maybeSetState(this.appNavigation.handleNavigation(e))},this.handlePageProfileMsg=e=>{var t,n,r;const o=ae.FR.toObject(e),i=Wt();this.metricsMgr.enqueue("pageProfile",{...o,isFragmentRun:Boolean(o.isFragmentRun),appId:this.sessionInfo.current.appId,numPages:null===(t=this.state.appPages)||void 0===t?void 0:t.length,sessionId:this.sessionInfo.current.sessionId,pythonVersion:this.sessionInfo.current.pythonVersion,pageScriptHash:this.state.currentPageScriptHash,activeTheme:null===(n=this.props.theme)||void 0===n||null===(r=n.activeTheme)||void 0===r?void 0:r.name,totalLoadTime:Math.round(1e3*(performance.now()-this.state.latestRunTime)),browserInfo:i})},this.handleAutoRerun=e=>{const t=setInterval((()=>{this.widgetMgr.sendUpdateWidgetsMessage(e.fragmentId,!0)}),1e3*e.interval);this.setState((e=>({autoReruns:[...e.autoReruns,t]})))},this.handleSessionStatusChanged=e=>{this.setState((t=>{let{scriptRunState:n}=t,{dialog:r}=t;return e.scriptIsRunning&&t.scriptRunState!==ue.STOP_REQUESTED?(n=ue.RUNNING,(0,se.se)(r)&&r.type===Qu.SCRIPT_COMPILE_ERROR&&(r=void 0)):e.scriptIsRunning||t.scriptRunState===ue.RERUN_REQUESTED||t.scriptRunState===ue.COMPILATION_ERROR||(n=ue.NOT_RUNNING),{userSettings:{...t.userSettings,runOnSave:Boolean(e.runOnSave)},dialog:r,scriptRunState:n}}))},this.handleSessionEvent=e=>{if(this.sessionEventDispatcher.handleSessionEventMsg(e),"scriptCompilationException"===e.type){this.setState({scriptRunState:ue.COMPILATION_ERROR});const t={type:Qu.SCRIPT_COMPILE_ERROR,exception:e.scriptCompilationException,onClose:()=>{}};this.openDialog(t)}},this.maybeUpdatePageUrl=(e,t,n)=>{const r=this.getBaseUriParts();if(r){const{basePath:o}=r,i=(0,se.gu)(document.location.pathname,o);if((""===i?e:i)!==t){const e=n?"":t,r=(0,se.U5)(),i=`${o?`/${o}`:""}/${e}${r?`?${r}`:""}`,a=i.endsWith("/")&&"/"!==i?i.slice(0,-1):i;window.history.pushState({},"",a)}}},this.handleNewSession=e=>{const t=e.initialize;if(this.hasStreamlitVersionChanged(t))return void window.location.reload();this.sessionInfo.isSet||this.handleOneTimeInitialization(e);const{appHash:n,currentPageScriptHash:r}=this.state,{scriptRunId:o,name:i,mainScriptPath:a,fragmentIdsThisRun:s,pageScriptHash:l,mainScriptHash:c}=e;if(s.length)this.setState({fragmentIdsThisRun:s,latestRunTime:performance.now()});else{this.cleanupAutoReruns();const t=e.config,n=e.customTheme;this.processThemeInput(n),this.setState({allowRunOnSave:t.allowRunOnSave,hideTopBar:t.hideTopBar,toolbarMode:t.toolbarMode,latestRunTime:performance.now(),mainScriptHash:c,fragmentIdsThisRun:s}),this.maybeSetState(this.appNavigation.handleNewSession(e)),this.onPageIconChanged("./favicon.png")}const u=(0,se.YZ)(this.sessionInfo.current.installationId+a);this.metricsMgr.setMetadata(this.state.deployedAppMetadata),this.metricsMgr.setAppHash(u),this.metricsMgr.enqueue("updateReport"),n===u&&r===l?this.setState({scriptRunId:o}):this.clearAppState(u,o,i,c)},this.handleOneTimeInitialization=e=>{const t=e.initialize,n=e.config;this.sessionInfo.setCurrent(le.propsFromNewSessionMessage(e)),this.metricsMgr.initialize({gatherUsageStats:n.gatherUsageStats,sendMessageToHost:this.hostCommunicationMgr.sendMessageToHost}),this.handleSessionStatusChanged(t.sessionStatus)},this.onHistoryChange=()=>{const{currentPageScriptHash:e}=this.state,t=this.appNavigation.findPageByUrlPath(document.location.pathname),n=document.location.toString().includes("#"),r=(null===t||void 0===t?void 0:t.pageScriptHash)===e;(0,se.hX)(t)||n&&r||this.onPageChange(t.pageScriptHash)},this.setAndSendTheme=e=>{this.props.theme.setTheme(e),this.hostCommunicationMgr.sendMessageToHost({type:"SET_THEME_CONFIG",themeInfo:(0,o.sR)(e.emotion)})},this.createThemeHash=e=>{if(!e)return"hash_for_undefined_custom_theme";const t=Object.entries(e);return t.sort(),(0,se.YZ)(t.join(":"))},this.closeDialog=()=>{this.setState({dialog:void 0})},this.saveSettings=e=>{const{runOnSave:t}=this.state.userSettings,{runOnSave:n}=e;if(this.setState({userSettings:e}),t!==n&&this.isServerConnected()){const e=new ae.$4({setRunOnSave:n});e.type="setRunOnSave",this.sendBackMsg(e)}},this.handleDeltaMsg=(e,t)=>{if(this.pendingElementsBuffer=this.pendingElementsBuffer.applyDelta(this.state.scriptRunId,e,t),!this.pendingElementsTimerRunning){this.pendingElementsTimerRunning=!0;const e=this.state.scriptRunState===ue.RUNNING;setTimeout((()=>{this.pendingElementsTimerRunning=!1,e&&this.setState({elements:this.pendingElementsBuffer})}),10)}},this.debugShutdownRuntime=()=>{if(this.isServerConnected()){const e=new ae.$4({debugShutdownRuntime:!0});e.type="debugShutdownRuntime",this.sendBackMsg(e)}},this.debugDisconnectWebsocket=()=>{if(this.isServerConnected()){const e=new ae.$4({debugDisconnectWebsocket:!0});e.type="debugDisconnectWebsocket",this.sendBackMsg(e)}},this.debugClearForwardMsgCache=()=>{var e,t;hc()&&(null===(e=this.connectionManager)||void 0===e||null===(t=e.connection)||void 0===t||t.cache.messages.clear())},this.cleanupAutoReruns=()=>{this.state.autoReruns.forEach((e=>{clearInterval(e)})),this.setState({autoReruns:[]})},this.rerunScript=function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];t.closeDialog(),t.isServerConnected()?t.state.scriptRunState!==ue.RUNNING&&t.state.scriptRunState!==ue.RERUN_REQUESTED&&(t.setState({scriptRunState:ue.RERUN_REQUESTED}),!0===e&&t.saveSettings({...t.state.userSettings,runOnSave:!0}),t.widgetMgr.sendUpdateWidgetsMessage(void 0)):(0,ce.vV)("Cannot rerun script when disconnected from server.")},this.sendLoadGitInfoBackMsg=()=>{this.isServerConnected()?this.sendBackMsg(new ae.$4({loadGitInfo:!0})):(0,ce.vV)("Cannot load git information when disconnected from server.")},this.onPageChange=e=>{const{elements:t,mainScriptHash:n}=this.state;this.cleanupAutoReruns();const r=this.appNavigation.clearPageElements(t,n,void 0),o=new Set(Array.from(r.getElements()).map((e=>(0,se.Id)(e))).filter(se.q3));this.sendRerunBackMsg(this.widgetMgr.getActiveWidgetStates(o),void 0,e)},this.isAppInReadyState=e=>this.state.connectionState===Dl.CONNECTED&&this.state.scriptRunState===ue.NOT_RUNNING&&e.scriptRunState===ue.RUNNING&&e.connectionState===Dl.CONNECTED,this.sendRerunBackMsg=(e,t,n,r)=>{const o=this.getBaseUriParts();if(!o)return void(0,ce.vV)("Cannot send rerun backMessage when disconnected from server.");const{currentPageScriptHash:i}=this.state,{basePath:a}=o;let s=this.getQueryString(),l="";n?n!=i&&(s=(0,se.U5)(),this.hostCommunicationMgr.sendMessageToHost({type:"SET_QUERY_PARAM",queryParams:s})):i?n=i:(l=(0,se.gu)(document.location.pathname,a),n=""),this.sendBackMsg(new ae.$4({rerunScript:{queryString:s,widgetStates:e,pageScriptHash:n,pageName:l,fragmentId:t,isAutoRerun:r}})),we.record({name:"RequestedRerun",scriptRunState:this.state.scriptRunState})},this.stopScript=()=>{if(!this.isServerConnected())return void(0,ce.vV)("Cannot stop app when disconnected from server.");if(this.state.scriptRunState===ue.NOT_RUNNING||this.state.scriptRunState===ue.STOP_REQUESTED)return;const e=new ae.$4({stopScript:!0});e.type="stopScript",this.sendBackMsg(e),this.setState({scriptRunState:ue.STOP_REQUESTED})},this.openClearCacheDialog=()=>{if(this.isServerConnected()){const e={type:Qu.CLEAR_CACHE,confirmCallback:this.clearCache,defaultAction:this.clearCache,onClose:()=>{}};this.openDialog(e)}else(0,ce.vV)("Cannot clear cache: disconnected from server")},this.openDeployDialog=()=>{var e;const t={type:Qu.DEPLOY_DIALOG,onClose:this.closeDialog,showDeployError:this.showDeployError,isDeployErrorModalOpen:(null===(e=this.state.dialog)||void 0===e?void 0:e.type)===Qu.DEPLOY_ERROR,metricsMgr:this.metricsMgr};this.openDialog(t)},this.openThemeCreatorDialog=()=>{this.metricsMgr.enqueue("menuClick",{label:"editTheme"});const e={type:Qu.THEME_CREATOR,backToSettings:this.settingsCallback,onClose:this.closeDialog,metricsMgr:this.metricsMgr};this.openDialog(e)},this.clearCache=()=>{if(this.closeDialog(),this.isServerConnected()){const e=new ae.$4({clearCache:!0});e.type="clearCache",this.sendBackMsg(e)}else(0,ce.vV)("Cannot clear cache: disconnected from server")},this.sendAppHeartbeat=()=>{if(this.isServerConnected()){const e=new ae.$4({appHeartbeat:!0});e.type="appHeartbeat",this.sendBackMsg(e)}else(0,ce.vV)("Cannot send app heartbeat: disconnected from server")},this.sendBackMsg=e=>{this.connectionManager?((0,ce.OG)(e),this.connectionManager.sendMessage(e)):(0,ce.vV)(`Not connected. Cannot send back message: ${e}`)},this.handleConnectionError=e=>{this.showError("Connection error",e)},this.isServerConnected=()=>!!this.connectionManager&&this.connectionManager.isConnected(),this.settingsCallback=function(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];const n={type:Qu.SETTINGS,isServerConnected:t.isServerConnected(),settings:t.state.userSettings,allowRunOnSave:t.state.allowRunOnSave,onSave:t.saveSettings,onClose:()=>{},developerMode:Up(t.state.isOwner,t.state.toolbarMode),openThemeCreator:t.openThemeCreatorDialog,animateModal:e,metricsMgr:t.metricsMgr};t.openDialog(n)},this.aboutCallback=()=>{const{menuItems:e}=this.state,t={type:Qu.ABOUT,sessionInfo:this.sessionInfo,onClose:this.closeDialog,aboutSectionMd:null===e||void 0===e?void 0:e.aboutSectionMd};this.openDialog(t)},this.printCallback=()=>{const{scriptRunState:e}=this.state;if(e!==ue.NOT_RUNNING)return void setTimeout(this.printCallback,500);let t;try{const e=(0,se.ky)(this.embeddingId);t=e&&e.contentWindow?e.contentWindow.window:window}catch(n){t=window}finally{t||(t=window),t.print()}},this.screencastCallback=()=>{const{scriptName:e}=this.state,{startRecording:t}=this.props.screenCast;t(`streamlit-${e}-${E()().format("YYYY-MM-DD-HH-MM-SS")}`)},this.handleFullScreen=e=>{this.setState({isFullScreen:e})},this.setLibConfig=e=>{this.setState({libConfig:e})},this.setAppConfig=e=>{this.setState({appConfig:e})},this.addScriptFinishedHandler=e=>{this.setState(((t,n)=>({scriptFinishedHandlers:t.scriptFinishedHandlers.concat(e)})))},this.removeScriptFinishedHandler=e=>{this.setState(((t,n)=>({scriptFinishedHandlers:ie()(t.scriptFinishedHandlers,e)})))},this.getBaseUriParts=()=>this.connectionManager?this.connectionManager.getBaseUriParts():void 0,this.getQueryString=()=>{const{queryParams:e}=this.state,t=e&&e.length>0?e:document.location.search;return t.startsWith("?")?t.substring(1):t},this.isInCloudEnvironment=()=>{const{hostMenuItems:e}=this.state;return e&&(null===e||void 0===e?void 0:e.length)>0},this.showDeployButton=()=>Up(this.state.isOwner,this.state.toolbarMode)&&!this.isInCloudEnvironment()&&this.sessionInfo.isSet&&!this.sessionInfo.isHello,this.deployButtonClicked=()=>{this.metricsMgr.enqueue("menuClick",{label:"deployButtonInApp"}),this.sendLoadGitInfoBackMsg(),this.openDeployDialog()},this.requestFileURLs=(e,t)=>{if(this.isServerConnected()){const n=new ae.$4({fileUrlsRequest:{requestId:e,fileNames:t.map((e=>e.name)),sessionId:this.sessionInfo.current.sessionId}});n.type="fileUrlsRequest",this.sendBackMsg(n)}},this.handleKeyDown=e=>{switch(e){case"c":Up(this.state.isOwner,this.state.toolbarMode)&&this.openClearCacheDialog();break;case"r":this.rerunScript()}},this.handleKeyUp=e=>{"esc"===e&&this.props.screenCast.stopRecording()},(0,te.Xu)();let n=this.createThemeHash();(0,o.tl)(e.theme.activeTheme)||(n=this.createThemeHash((0,o.hf)(e.theme.activeTheme.emotion))),this.state={connectionState:Dl.INITIAL,elements:xe.empty("",!0),isFullScreen:!1,scriptName:"",scriptRunId:Fp,appHash:null,scriptRunState:ue.NOT_RUNNING,userSettings:{wideMode:!1,runOnSave:!1},layout:ae.wF.Layout.CENTERED,initialSidebarState:ae.wF.SidebarState.AUTO,menuItems:void 0,allowRunOnSave:!0,scriptFinishedHandlers:[],themeHash:n,gitInfo:null,formsData:ke(),appPages:[],navSections:[],currentPageScriptHash:"",mainScriptHash:"",hideTopBar:!0,hideSidebarNav:!0,expandSidebarNav:!1,toolbarMode:ae.TS.ToolbarMode.MINIMAL,latestRunTime:performance.now(),fragmentIdsThisRun:[],isOwner:!1,hostMenuItems:[],hostToolbarItems:[],hostHideSidebarNav:!1,sidebarChevronDownshift:0,pageLinkBaseUrl:"",queryParams:"",deployedAppMetadata:{},libConfig:{},appConfig:{},autoReruns:[],inputsDisabled:!1},this.connectionManager=null,this.widgetMgr=new We({sendRerunBackMsg:this.sendRerunBackMsg,formsDataChanged:e=>this.setState({formsData:e})}),this.hostCommunicationMgr=new Ue({streamlitExecutionStartedAt:e.streamlitExecutionStartedAt,sendRerunBackMsg:this.sendRerunBackMsg,closeModal:this.closeDialog,stopScript:this.stopScript,rerunScript:this.rerunScript,clearCache:this.clearCache,sendAppHeartbeat:this.sendAppHeartbeat,setInputsDisabled:e=>{this.setState({inputsDisabled:e})},themeChanged:this.handleThemeMessage,pageChanged:this.onPageChange,isOwnerChanged:e=>this.setState({isOwner:e}),jwtHeaderChanged:e=>{let{jwtHeaderName:t,jwtHeaderValue:n}=e;void 0!==this.endpoints.setJWTHeader&&this.state.appConfig.useExternalAuthToken&&this.endpoints.setJWTHeader({jwtHeaderName:t,jwtHeaderValue:n})},hostMenuItemsChanged:e=>{this.setState({hostMenuItems:e})},hostToolbarItemsChanged:e=>{this.setState({hostToolbarItems:e})},hostHideSidebarNavChanged:e=>{this.setState({hostHideSidebarNav:e})},sidebarChevronDownshiftChanged:e=>{this.setState({sidebarChevronDownshift:e})},pageLinkBaseUrlChanged:e=>{this.setState({pageLinkBaseUrl:e})},queryParamsChanged:e=>{this.setState({queryParams:e})},deployedAppMetadataChanged:e=>{this.setState({deployedAppMetadata:e})},restartWebsocketConnection:()=>{this.connectionManager||this.initializeConnectionManager()},terminateWebsocketConnection:()=>{var e;null===(e=this.connectionManager)||void 0===e||e.disconnect(),this.connectionManager=null}}),this.endpoints=new op({getServerUri:this.getBaseUriParts,csrfEnabled:!0}),this.uploadClient=new Tt({sessionInfo:this.sessionInfo,endpoints:this.endpoints,formsWithPendingRequestsChanged:e=>this.widgetMgr.setFormsWithUploadsInProgress(e),requestFileURLs:this.requestFileURLs}),this.componentRegistry=new Rt(this.endpoints),this.pendingElementsTimerRunning=!1,this.pendingElementsBuffer=this.state.elements,this.appNavigation=new jp(this.hostCommunicationMgr,this.maybeUpdatePageUrl,this.onPageNotFound,this.onPageIconChanged),window.streamlitDebug={clearForwardMsgCache:this.debugClearForwardMsgCache,disconnectWebsocket:this.debugDisconnectWebsocket,shutdownRuntime:this.debugShutdownRuntime}}initializeConnectionManager(){var e;const t=null===(e=this.context)||void 0===e?void 0:e.kernel;if(null==t)throw new Error("Kernel is not set in the context.");this.connectionManager=new tp({kernel:t,sessionInfo:this.sessionInfo,endpoints:this.endpoints,onMessage:this.handleMessage,onConnectionError:this.handleConnectionError,connectionStateChanged:this.handleConnectionStateChanged,claimHostAuthToken:this.hostCommunicationMgr.claimAuthToken,resetHostAuthToken:this.hostCommunicationMgr.resetAuthToken,onHostConfigResp:e=>{const{allowedOrigins:t,useExternalAuthToken:n,disableFullscreenMode:r,enableCustomParentMessages:o,mapboxToken:i,enforceDownloadInNewTab:a,metricsUrl:s}=e,l={allowedOrigins:t,useExternalAuthToken:n,enableCustomParentMessages:o},c={mapboxToken:i,disableFullscreenMode:r,enforceDownloadInNewTab:a};this.metricsMgr.setMetricsConfig(s),this.hostCommunicationMgr.setAllowedOrigins(l),this.setAppConfig(l),this.setLibConfig(c)}})}componentDidMount(){var e;const t=null===(e=this.context)||void 0===e?void 0:e.kernel;if(null==t)throw new Error("Kernel is not set in the context.");this.initializeConnectionManager(),this.hostCommunicationMgr.sendMessageToHost({type:"SCRIPT_RUN_STATE_CHANGED",scriptRunState:this.state.scriptRunState}),this.uploadClient.setKernel(t),(0,se.Az)()&&document.body.classList.add("embedded"),(0,se.hU)()&&(window.iFrameResizer={heightCalculationMethod:()=>{const e=document.querySelectorAll("[data-iframe-height]"),t=Array.from(e).map((e=>Math.ceil(e.getBoundingClientRect().bottom)));return Math.max(0,...t)}},__webpack_require__.e(5885).then(__webpack_require__.t.bind(__webpack_require__,25885,23))),this.hostCommunicationMgr.sendMessageToHost({type:"SET_THEME_CONFIG",themeInfo:(0,o.sR)(this.props.theme.activeTheme.emotion)}),this.metricsMgr.enqueue("viewReport"),window.addEventListener("popstate",this.onHistoryChange,!1)}componentDidUpdate(e,t){!1===window.prerenderReady&&this.isAppInReadyState(t)&&(window.prerenderReady=!0),this.state.scriptRunState!==t.scriptRunState&&this.hostCommunicationMgr.sendMessageToHost({type:"SCRIPT_RUN_STATE_CHANGED",scriptRunState:this.state.scriptRunState})}componentWillUnmount(){var e;null===(e=this.connectionManager)||void 0===e||e.disconnect(),this.hostCommunicationMgr.closeHostCommunication(),window.removeEventListener("popstate",this.onHistoryChange,!1)}showError(e,t){(0,ce.vV)(t);const n={type:Qu.WARNING,title:e,msg:t,onClose:()=>{}};this.openDialog(n)}hasStreamlitVersionChanged(e){if(this.sessionInfo.isSet){const t=this.sessionInfo.current.streamlitVersion,{environmentInfo:n}=e;if((0,se.se)(n)&&(0,se.se)(n.streamlitVersion))return t!=n.streamlitVersion}return!1}maybeSetState(e){if(e){const[t,n]=e;this.setState(t,n)}}processThemeInput(e){const t=this.createThemeHash(e);if(t===this.state.themeHash)return;this.setState({themeHash:t});const n=!(0,o.tl)(this.props.theme.activeTheme);if(e){const t=(0,o.an)(o.kQ,e);this.props.theme.addThemes([t]);(null===(0,o.YY)()||n)&&this.setAndSendTheme(t)}else this.props.theme.addThemes([]),n&&this.setAndSendTheme((0,o.Y_)())}handleScriptFinished(e){if(e===ae.zo.ScriptFinishedStatus.FINISHED_SUCCESSFULLY||e===ae.zo.ScriptFinishedStatus.FINISHED_EARLY_FOR_RERUN||e===ae.zo.ScriptFinishedStatus.FINISHED_FRAGMENT_RUN_SUCCESSFULLY){if(window.setTimeout((()=>{this.state.scriptFinishedHandlers.map((e=>e()))}),0),e===ae.zo.ScriptFinishedStatus.FINISHED_SUCCESSFULLY||e===ae.zo.ScriptFinishedStatus.FINISHED_FRAGMENT_RUN_SUCCESSFULLY){this.setState((e=>{let{scriptRunId:t,fragmentIdsThisRun:n}=e;return{elements:this.pendingElementsBuffer.clearStaleNodes(t,n)}}),(()=>{this.pendingElementsBuffer=this.state.elements}));const e=new Set(Array.from(this.state.elements.getElements()).map((e=>(0,se.Id)(e))).filter(se.q3));this.widgetMgr.removeInactive(e)}null!==this.connectionManager&&e!==ae.zo.ScriptFinishedStatus.FINISHED_EARLY_FOR_RERUN&&this.sessionInfo.isSet&&this.connectionManager.incrementMessageCacheRunCount(this.sessionInfo.current.maxCachedMessageAge)}}clearAppState(e,t,n,r){const{hideSidebarNav:o,elements:i}=this.state,a=o&&i.sidebar||void 0;this.setState({scriptRunId:t,scriptName:n,appHash:e,elements:this.appNavigation.clearPageElements(this.pendingElementsBuffer,r,a)},(()=>{this.pendingElementsBuffer=this.state.elements;const e=new Set(Array.from(this.state.elements.getElements()).map((e=>(0,se.Id)(e))).filter(se.q3));this.widgetMgr.removeInactive(e)}))}openDialog(e){this.setState({dialog:e})}render(){const{allowRunOnSave:e,connectionState:t,dialog:n,elements:r,initialSidebarState:o,menuItems:i,isFullScreen:a,scriptRunId:s,scriptRunState:l,userSettings:c,hideTopBar:u,hideSidebarNav:p,expandSidebarNav:d,currentPageScriptHash:b,hostHideSidebarNav:f,pageLinkBaseUrl:m,sidebarChevronDownshift:M,hostMenuItems:g,hostToolbarItems:O,libConfig:z,appConfig:y,inputsDisabled:A,appPages:v,navSections:w}=this.state,S=Up(this.state.isOwner,this.state.toolbarMode),q=re()("stApp",(0,se.M$)(this.embeddingId),{"streamlit-embedded":(0,se.yR)(),"streamlit-wide":c.wideMode}),E=n?ep({...n,onClose:this.closeDialog}):null,_=A||t!==Dl.CONNECTED;return(0,h.jsx)(Lt.Provider,{value:{initialSidebarState:o,wideMode:c.wideMode,embedded:(0,se.yR)(),showPadding:!(0,se.yR)()||(0,se.Rg)(),disableScrolling:(0,se.Az)(),showToolbar:!(0,se.yR)()||(0,se.v4)(),showColoredLine:!(0,se.yR)()||(0,se._d)(),pageLinkBaseUrl:m,sidebarChevronDownshift:M,gitInfo:this.state.gitInfo,appConfig:y},children:(0,h.jsx)(kt.n.Provider,{value:{isFullScreen:a,setFullScreen:this.handleFullScreen,addScriptFinishedHandler:this.addScriptFinishedHandler,removeScriptFinishedHandler:this.removeScriptFinishedHandler,activeTheme:this.props.theme.activeTheme,setTheme:this.setAndSendTheme,availableThemes:this.props.theme.availableThemes,addThemes:this.props.theme.addThemes,onPageChange:this.onPageChange,currentPageScriptHash:b,libConfig:z,fragmentIdsThisRun:this.state.fragmentIdsThisRun,locale:window.navigator.language},children:(0,h.jsx)(ee,{keyName:"r,c,esc",onKeyDown:this.handleKeyDown,onKeyUp:this.handleKeyUp,children:(0,h.jsxs)(mp,{className:q,"data-testid":"stApp","data-test-script-state":s==Fp?"initial":l,"data-test-connection-state":t,children:[(0,h.jsxs)(Tc,{children:[!u&&(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(Jl,{connectionState:t,sessionEventDispatcher:this.sessionEventDispatcher,scriptRunState:l,rerunScript:this.rerunScript,stopScript:this.stopScript,allowRunOnSave:e}),(0,h.jsx)(wc,{hostToolbarItems:O,sendMessageToHost:this.hostCommunicationMgr.sendMessageToHost,metricsMgr:this.metricsMgr})]}),this.showDeployButton()&&(0,h.jsx)(qc,{onClick:this.deployButtonClicked.bind(this)}),(0,h.jsx)(Oc,{isServerConnected:this.isServerConnected(),quickRerunCallback:this.rerunScript,clearCacheCallback:this.openClearCacheDialog,settingsCallback:this.settingsCallback,aboutCallback:this.aboutCallback,printCallback:this.printCallback,screencastCallback:this.screencastCallback,screenCastState:this.props.screenCast.currentState,hostMenuItems:g,developmentMode:S,sendMessageToHost:this.hostCommunicationMgr.sendMessageToHost,menuItems:i,metricsMgr:this.metricsMgr,toolbarMode:this.state.toolbarMode})]}),(0,h.jsx)(Ml,{endpoints:this.endpoints,sessionInfo:this.sessionInfo,sendMessageToHost:this.hostCommunicationMgr.sendMessageToHost,elements:r,scriptRunId:s,scriptRunState:l,widgetMgr:this.widgetMgr,widgetsDisabled:_,uploadClient:this.uploadClient,componentRegistry:this.componentRegistry,formsData:this.state.formsData,appLogo:r.logo,appPages:v,navSections:w,onPageChange:this.onPageChange,currentPageScriptHash:b,hideSidebarNav:p||f,expandSidebarNav:d}),E]})})})})}}Vp.contextType=r.yp;const Hp=Ip(Vp);const Xp=e=>{let{streamlitExecutionStartedAt:n}=e;const[r,i]=function(){const e=(0,o.x0)(),[n,r]=(0,t.useState)(e),[i,a]=(0,t.useState)([]),[s,l]=(0,t.useState)([...(0,o.Ef)(),...(0,o.tl)(e)?[]:[e]]),c=(0,t.useCallback)((e=>{e!==n&&(r(e),e.name===o.QM?(0,o.E9)():(0,o.Iu)(e))}),[r,n]),u=(0,t.useCallback)((()=>{n.name===o.QM&&c((0,o.Y_)());const e=s.filter((e=>e.name!==o.QM));l([(0,o.DK)(),...e])}),[n.name,s,c]),p=(0,t.useCallback)((e=>{e.fontFaces&&a(e.fontFaces);const t=new ae.tc(e),n=(0,o.an)(o.kQ,t);c(n)}),[a,c]);return(0,t.useEffect)((()=>{const e=window.matchMedia("(prefers-color-scheme: dark)");return e.addEventListener("change",u),window.addEventListener("afterprint",u),()=>{window.removeEventListener("afterprint",u),e.removeEventListener("change",u)}}),[n,s,u]),[{setTheme:c,activeTheme:n,addThemes:e=>{l([...(0,o.Ef)(),...e])},availableThemes:s,setImportedTheme:p},i]}(),{activeTheme:a}=r,s=a.name===o.kQ&&i.length>0;return(0,h.jsx)(g,{theme:a,children:(0,h.jsx)(S,{children:(0,h.jsxs)(v,{children:[s&&(0,h.jsx)(O,{fontFaces:i}),(0,h.jsx)(Hp,{theme:r,streamlitExecutionStartedAt:n})]})})})};class $p{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";this.prefix=e,this.count=0,this.offset=374,this.msb=1295,this.power=2}next(){const e=this.increment().toString(36);return this.prefix?`${this.prefix}${e}`:e}increment(){const e=this.count+this.offset;return e===this.msb&&(this.offset+=9*(this.msb+1),this.msb=Math.pow(36,++this.power)-1),this.count++,e}}const Gp=/(!?\(\s*min(-device-)?-width).+\(\s*max(-device)?-width/i,Kp=/(!?\(\s*max(-device)?-width).+\(\s*min(-device)?-width/i,Yp=ad(Gp,Kp,/\(\s*min(-device)?-width/i),Jp=ad(Kp,Gp,/\(\s*max(-device)?-width/i),Zp=/(!?\(\s*min(-device)?-height).+\(\s*max(-device)?-height/i,Qp=/(!?\(\s*max(-device)?-height).+\(\s*min(-device)?-height/i,ed=ad(Zp,Qp,/\(\s*min(-device)?-height/i),td=ad(Qp,Zp,/\(\s*max(-device)?-height/i),nd=/print/i,rd=/^print$/i,od=Number.MAX_VALUE;function id(e){const t=/(-?\d*\.?\d+)(ch|em|ex|px|rem)/.exec(e);if(null===t)return od;let n=t[1];switch(t[2]){case"ch":n=8.8984375*parseFloat(n);break;case"em":case"rem":n=16*parseFloat(n);break;case"ex":n=8.296875*parseFloat(n);break;case"px":n=parseFloat(n)}return+n}function ad(e,t,n){return function(r){return!!e.test(r)||!t.test(r)&&n.test(r)}}function sd(e,t){if(""===e)return-1;if(""===t)return 1;const n=function(e,t){const n=nd.test(e),r=rd.test(e),o=nd.test(t),i=rd.test(t);return n&&o?!r&&i?1:r&&!i?-1:e.localeCompare(t):n?1:o?-1:null}(e,t);if(null!==n)return n;const r=Yp(e)||ed(e),o=Jp(e)||td(e),i=Yp(t)||ed(t),a=Jp(t)||td(t);if(r&&a)return-1;if(o&&i)return 1;const s=id(e),l=id(t);return s===od&&l===od?e.localeCompare(t):s===od?1:l===od?-1:s>l?o?-1:1:s<l?o?1:-1:e.localeCompare(t)}class ld{constructor(e,t,n){this.idGenerator=e,this.onNewCache=t,this.onNewValue=n,this.sortedCacheKeys=[],this.caches={}}getCache(e){if(!this.caches[e]){const t=new cd(this.idGenerator,this.onNewValue);t.key=e,this.sortedCacheKeys.push(e),this.sortedCacheKeys.sort(sd);const n=this.sortedCacheKeys.indexOf(e),r=n<this.sortedCacheKeys.length-1?this.sortedCacheKeys[n+1]:void 0;this.caches[e]=t,this.onNewCache(e,t,r)}return this.caches[e]}getSortedCacheKeys(){return this.sortedCacheKeys}}class cd{constructor(e,t){this.cache={},this.idGenerator=e,this.onNewValue=t}addValue(e,t){const n=this.cache[e];if(n)return n;const r=this.idGenerator.next();return this.cache[e]=r,this.onNewValue(this,r,t),r}}const ud=/[A-Z]/g,pd=/^ms-/,dd={};function bd(e){return e in dd?dd[e]:dd[e]=e.replace(ud,"-$&").toLowerCase().replace(pd,"-ms-")}function fd(e){return e.charAt(0).toUpperCase()+e.slice(1)}function hd(e,t,n){if(e.hasOwnProperty(t)){for(var r={},o=e[t],i=fd(t),a=Object.keys(n),s=0;s<a.length;s++){var l=a[s];if(l===t)for(var c=0;c<o.length;c++)r[o[c]+i]=n[t];r[l]=n[l]}return r}return n}function md(e,t,n,r,o){for(var i=0,a=e.length;i<a;++i){var s=e[i](t,n,r,o);if(s)return s}}function Md(e,t){-1===e.indexOf(t)&&e.push(t)}function gd(e,t){if(Array.isArray(t))for(var n=0,r=t.length;n<r;++n)Md(e,t[n]);else Md(e,t)}function Od(e){return e instanceof Object&&!Array.isArray(e)}var zd=["Webkit"],yd=["ms"],Ad=["Webkit","ms"];const vd={plugins:[],prefixMap:{appearance:["Webkit","Moz"],textEmphasisPosition:zd,textEmphasis:zd,textEmphasisStyle:zd,textEmphasisColor:zd,boxDecorationBreak:zd,maskImage:zd,maskMode:zd,maskRepeat:zd,maskPosition:zd,maskClip:zd,maskOrigin:zd,maskSize:zd,maskComposite:zd,mask:zd,maskBorderSource:zd,maskBorderMode:zd,maskBorderSlice:zd,maskBorderWidth:zd,maskBorderOutset:zd,maskBorderRepeat:zd,maskBorder:zd,maskType:zd,textDecorationStyle:zd,textDecorationSkip:zd,textDecorationLine:zd,textDecorationColor:zd,userSelect:["Webkit","Moz","ms"],backdropFilter:zd,fontKerning:zd,scrollSnapType:Ad,scrollSnapPointsX:Ad,scrollSnapPointsY:Ad,scrollSnapDestination:Ad,scrollSnapCoordinate:Ad,clipPath:zd,shapeImageThreshold:zd,shapeImageMargin:zd,shapeImageOutside:zd,filter:zd,hyphens:Ad,flowInto:Ad,flowFrom:Ad,breakBefore:Ad,breakAfter:Ad,breakInside:Ad,regionFragment:Ad,writingMode:Ad,textOrientation:zd,tabSize:["Moz"],fontFeatureSettings:zd,columnCount:zd,columnFill:zd,columnGap:zd,columnRule:zd,columnRuleColor:zd,columnRuleStyle:zd,columnRuleWidth:zd,columns:zd,columnSpan:zd,columnWidth:zd,wrapFlow:yd,wrapThrough:yd,wrapMargin:yd,textSizeAdjust:Ad}};var wd=["-webkit-","-moz-",""],Sd={"zoom-in":!0,"zoom-out":!0,grab:!0,grabbing:!0};var qd=__webpack_require__(55218),Ed=__webpack_require__.n(qd),_d=["-webkit-",""];var xd=["-webkit-",""];var Td={flex:["-webkit-box","-moz-box","-ms-flexbox","-webkit-flex","flex"],"inline-flex":["-webkit-inline-box","-moz-inline-box","-ms-inline-flexbox","-webkit-inline-flex","inline-flex"]};var Rd={"space-around":"justify","space-between":"justify","flex-start":"start","flex-end":"end","wrap-reverse":"multiple",wrap:"multiple"},kd={alignItems:"WebkitBoxAlign",justifyContent:"WebkitBoxPack",flexWrap:"WebkitBoxLines",flexGrow:"WebkitBoxFlex"};var Nd=["-webkit-","-moz-",""],Cd=/linear-gradient|radial-gradient|repeating-linear-gradient|repeating-radial-gradient/gi;var Wd=function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var n=[],r=!0,o=!1,i=void 0;try{for(var a,s=e[Symbol.iterator]();!(r=(a=s.next()).done)&&(n.push(a.value),!t||n.length!==t);r=!0);}catch(l){o=!0,i=l}finally{try{!r&&s.return&&s.return()}finally{if(o)throw i}}return n}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")};function Ld(e){return"number"===typeof e&&!isNaN(e)}function Id(e){return"string"===typeof e&&e.includes("/")}var Pd=["center","end","start","stretch"],Dd={"inline-grid":["-ms-inline-grid","inline-grid"],grid:["-ms-grid","grid"]},Bd={alignSelf:function(e,t){Pd.indexOf(e)>-1&&(t.msGridRowAlign=e)},gridColumn:function(e,t){if(Ld(e))t.msGridColumn=e;else if(Id(e)){var n=e.split("/"),r=Wd(n,2),o=r[0],i=r[1];Bd.gridColumnStart(+o,t);var a=i.split(/ ?span /),s=Wd(a,2),l=s[0],c=s[1];""===l?Bd.gridColumnEnd(+o+ +c,t):Bd.gridColumnEnd(+i,t)}else Bd.gridColumnStart(e,t)},gridColumnEnd:function(e,t){var n=t.msGridColumn;Ld(e)&&Ld(n)&&(t.msGridColumnSpan=e-n)},gridColumnStart:function(e,t){Ld(e)&&(t.msGridColumn=e)},gridRow:function(e,t){if(Ld(e))t.msGridRow=e;else if(Id(e)){var n=e.split("/"),r=Wd(n,2),o=r[0],i=r[1];Bd.gridRowStart(+o,t);var a=i.split(/ ?span /),s=Wd(a,2),l=s[0],c=s[1];""===l?Bd.gridRowEnd(+o+ +c,t):Bd.gridRowEnd(+i,t)}else Bd.gridRowStart(e,t)},gridRowEnd:function(e,t){var n=t.msGridRow;Ld(e)&&Ld(n)&&(t.msGridRowSpan=e-n)},gridRowStart:function(e,t){Ld(e)&&(t.msGridRow=e)},gridTemplateColumns:function(e,t){t.msGridColumns=e},gridTemplateRows:function(e,t){t.msGridRows=e},justifySelf:function(e,t){Pd.indexOf(e)>-1&&(t.msGridColumnAlign=e)}};var jd=["-webkit-",""];var Fd={marginBlockStart:["WebkitMarginBefore"],marginBlockEnd:["WebkitMarginAfter"],marginInlineStart:["WebkitMarginStart","MozMarginStart"],marginInlineEnd:["WebkitMarginEnd","MozMarginEnd"],paddingBlockStart:["WebkitPaddingBefore"],paddingBlockEnd:["WebkitPaddingAfter"],paddingInlineStart:["WebkitPaddingStart","MozPaddingStart"],paddingInlineEnd:["WebkitPaddingEnd","MozPaddingEnd"],borderBlockStart:["WebkitBorderBefore"],borderBlockStartColor:["WebkitBorderBeforeColor"],borderBlockStartStyle:["WebkitBorderBeforeStyle"],borderBlockStartWidth:["WebkitBorderBeforeWidth"],borderBlockEnd:["WebkitBorderAfter"],borderBlockEndColor:["WebkitBorderAfterColor"],borderBlockEndStyle:["WebkitBorderAfterStyle"],borderBlockEndWidth:["WebkitBorderAfterWidth"],borderInlineStart:["WebkitBorderStart","MozBorderStart"],borderInlineStartColor:["WebkitBorderStartColor","MozBorderStartColor"],borderInlineStartStyle:["WebkitBorderStartStyle","MozBorderStartStyle"],borderInlineStartWidth:["WebkitBorderStartWidth","MozBorderStartWidth"],borderInlineEnd:["WebkitBorderEnd","MozBorderEnd"],borderInlineEndColor:["WebkitBorderEndColor","MozBorderEndColor"],borderInlineEndStyle:["WebkitBorderEndStyle","MozBorderEndStyle"],borderInlineEndWidth:["WebkitBorderEndWidth","MozBorderEndWidth"]};var Ud=["-webkit-","-moz-",""],Vd={maxHeight:!0,maxWidth:!0,width:!0,height:!0,columnWidth:!0,minWidth:!0,minHeight:!0},Hd={"min-content":!0,"max-content":!0,"fill-available":!0,"fit-content":!0,"contain-floats":!0};var Xd=__webpack_require__(32629),$d=__webpack_require__.n(Xd),Gd={transition:!0,transitionProperty:!0,WebkitTransition:!0,WebkitTransitionProperty:!0,MozTransition:!0,MozTransitionProperty:!0},Kd={Webkit:"-webkit-",Moz:"-moz-",ms:"-ms-"};var Yd=function(e){var t=e.prefixMap,n=e.plugins;return function e(r){for(var o in r){var i=r[o];if(Od(i))r[o]=e(i);else if(Array.isArray(i)){for(var a=[],s=0,l=i.length;s<l;++s){gd(a,md(n,o,i[s],r,t)||i[s])}a.length>0&&(r[o]=a)}else{var c=md(n,o,i,r,t);c&&(r[o]=c),r=hd(t,o,r)}}return r}}({prefixMap:vd.prefixMap,plugins:[function(e,t){if("string"===typeof t&&"text"===t)return["-webkit-text","text"]},function(e,t){if("string"===typeof t&&!Ed()(t)&&t.indexOf("cross-fade(")>-1)return _d.map((function(e){return t.replace(/cross-fade\(/g,e+"cross-fade(")}))},function(e,t){if("cursor"===e&&Sd.hasOwnProperty(t))return wd.map((function(e){return e+t}))},function(e,t){if("string"===typeof t&&!Ed()(t)&&t.indexOf("filter(")>-1)return xd.map((function(e){return t.replace(/filter\(/g,e+"filter(")}))},function(e,t,n){"flexDirection"===e&&"string"===typeof t&&(t.indexOf("column")>-1?n.WebkitBoxOrient="vertical":n.WebkitBoxOrient="horizontal",t.indexOf("reverse")>-1?n.WebkitBoxDirection="reverse":n.WebkitBoxDirection="normal"),kd.hasOwnProperty(e)&&(n[kd[e]]=Rd[t]||t)},function(e,t){if("string"===typeof t&&!Ed()(t)&&Cd.test(t))return Nd.map((function(e){return t.replace(Cd,(function(t){return e+t}))}))},function(e,t,n){if("display"===e&&t in Dd)return Dd[t];e in Bd&&(0,Bd[e])(t,n)},function(e,t){if("string"===typeof t&&!Ed()(t)&&t.indexOf("image-set(")>-1)return jd.map((function(e){return t.replace(/image-set\(/g,e+"image-set(")}))},function(e,t,n){if(Object.prototype.hasOwnProperty.call(Fd,e))for(var r=Fd[e],o=0,i=r.length;o<i;++o)n[r[o]]=t},function(e,t){if("position"===e&&"sticky"===t)return["-webkit-sticky","sticky"]},function(e,t){if(Vd.hasOwnProperty(e)&&Hd.hasOwnProperty(t))return Ud.map((function(e){return e+t}))},function(e,t,n,r){if("string"===typeof t&&Gd.hasOwnProperty(e)){var o=function(e,t){if(Ed()(e))return e;for(var n=e.split(/,(?![^()]*(?:\([^()]*\))?\))/g),r=0,o=n.length;r<o;++r){var i=n[r],a=[i];for(var s in t){var l=$d()(s);if(i.indexOf(l)>-1&&"order"!==l)for(var c=t[s],u=0,p=c.length;u<p;++u)a.unshift(i.replace(l,Kd[c[u]]+l))}n[r]=a.join(",")}return n.join(",")}(t,r),i=o.split(/,(?![^()]*(?:\([^()]*\))?\))/g).filter((function(e){return!/-moz-|-ms-/.test(e)})).join(",");if(e.indexOf("Webkit")>-1)return i;var a=o.split(/,(?![^()]*(?:\([^()]*\))?\))/g).filter((function(e){return!/-webkit-|-ms-/.test(e)})).join(",");return e.indexOf("Moz")>-1?a:(n["Webkit"+fd(e)]=i,n["Moz"+fd(e)]=a,o)}},function(e,t){if("display"===e&&Td.hasOwnProperty(t))return Td[t]}]});function Jd(e,t,n,r){const o=e.getCache(n);let i="";for(const a in t){const s=t[a];if(void 0!==s&&null!==s)if("object"!==typeof s){0;const e=`${bd(a)}:${s}`,t=`${r}${e}`,n=o.cache[t];if(void 0!==n){i+=" "+n;continue}{let n="";const l=Yd({[a]:s});for(const t in l){const r=l[t],o=typeof r;if("string"===o||"number"===o){const o=`${bd(t)}:${r}`;o!==e&&(n+=`${o};`)}else if(Array.isArray(r)){const o=bd(t);for(let t=0;t<r.length;t++){const i=`${o}:${r[t]}`;i!==e&&(n+=`${i};`)}}}n+=e;i+=" "+o.addValue(t,{pseudo:r,block:n})}}else":"===a[0]?i+=" "+Jd(e,s,n,r+a):"@media"===a.substring(0,6)&&(i+=" "+Jd(e,s,a.substr(7),r))}return i.slice(1)}function Zd(e){let t="";for(const n in e)t+=`${n}{${Qd(e[n])}}`;return t}function Qd(e){let t="";for(const n in e){const r=e[n];"string"!==typeof r&&"number"!==typeof r||(t+=`${bd(n)}:${r};`)}return t.slice(0,-1)}const eb=/\.([^{:]+)(:[^{]+)?{(?:[^}]*;)?([^}]*?)}/g,tb=/@keyframes ([^{]+){((?:(?:from|to|(?:\d+\.?\d*%))\{(?:[^}])*})*)}/g,nb=/@font-face\{font-family:([^;]+);([^}]*)\}/g;function rb(e,t,n){let r;for(;r=t.exec(n);){const[,t,n,o]=r;0;const i=n?`${n}${o}`:o;e.cache[i]=t,e.idGenerator.increment()}}function ob(e,t,n){let r;for(;r=t.exec(n);){const[,t,n]=r;0,e.cache[n]=t,e.idGenerator.increment()}}const ib=class{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.styleElements={};const t=new $p(e.prefix),n=(e,t,n)=>{const{pseudo:r,block:o}=n,i=this.styleElements[e.key].sheet,a=function(e,t){let n=`.${e}`;return t&&(n+=t),n}(t,r),s=function(e,t){return`${e}{${t}}`}(a,o);try{i.insertRule(s,i.cssRules.length)}catch(l){0}};if(this.styleCache=new ld(t,((e,t,n)=>{const r=document.createElement("style");if(r.media=e,void 0===n)this.container.appendChild(r);else{const e=function(e,t){let n=0;for(;n<e.length;n++){const r=e[n];if("STYLE"===r.tagName&&r.media===t)return n}return-1}(this.container.children,n);this.container.insertBefore(r,this.container.children[e])}this.styleElements[e]=r}),n),this.keyframesCache=new cd(new $p(e.prefix),((e,t,n)=>{this.styleCache.getCache("");const r=this.styleElements[""].sheet,o=function(e,t){return`@keyframes ${e}{${t}}`}(t,Zd(n));try{r.insertRule(o,r.cssRules.length)}catch(i){0}})),this.fontFaceCache=new cd(new $p(e.prefix),((e,t,n)=>{this.styleCache.getCache("");const r=this.styleElements[""].sheet,o=function(e,t){return`@font-face{font-family:${e};${t}}`}(t,Qd(n));try{r.insertRule(o,r.cssRules.length)}catch(i){0}})),e.container&&(this.container=e.container),e.hydrate&&e.hydrate.length>0){if(!this.container){const t=e.hydrate[0].parentElement;null!==t&&void 0!==t&&(this.container=t)}for(let r=0;r<e.hydrate.length;r++){const o=e.hydrate[r],i=o.getAttribute("data-hydrate");if("font-face"===i){ob(this.fontFaceCache,nb,o.textContent);continue}if("keyframes"===i){ob(this.keyframesCache,tb,o.textContent);continue}const a=o.media?o.media:"";this.styleElements[a]=o;const s=new cd(t,n);s.key=a,rb(s,eb,o.textContent),this.styleCache.sortedCacheKeys.push(a),this.styleCache.caches[a]=s}}if(!this.container){if(null===document.head)throw new Error("No container provided and `document.head` was null");this.container=document.head}}renderStyle(e){return Jd(this.styleCache,e,"","")}renderFontFace(e){const t=Qd(e);return this.fontFaceCache.addValue(t,e)}renderKeyframes(e){const t=Zd(e);return this.keyframesCache.addValue(t,e)}};var ab=__webpack_require__(68515);const sb=new ib({prefix:"st-"}),lb=Date.now();const cb=function(e){return(0,h.jsx)(r.yJ,{kernel:e.kernel,children:(0,h.jsx)(ab.Kq,{value:sb,children:(0,h.jsx)(Xp,{streamlitExecutionStartedAt:lb})})})};function ub(e){return new URL(e,window.location.href).href}const pb="streamlit_app.py";function db(e){if("string"===typeof e){return{kernelOptions:{entrypoint:pb,files:{[pb]:{data:e}},archives:[],requirements:[],prebuiltPackageNames:[]},toastCallbackOptions:{disableProgressToasts:!1,disableErrorToasts:!1}}}const t=function(e){if(null==e)return{};const t={};return Object.keys(e).forEach((n=>{const r=e[n];if("string"!==typeof r&&!ArrayBuffer.isView(r)){if("object"===typeof r){if("data"in r)return void(t[n]=r);if("url"in r)return void(t[n]={...r,url:ub(r.url)})}throw new Error(`Invalid file value: ${r}`)}t[n]={data:r}})),t}(e.files),n=function(e){return null==e?[]:e.map((e=>"buffer"in e?e:{...e,url:ub(e.url)}))}(e.archives),r=e.entrypoint;if(null==r)throw new Error("The `entrypoint` field is required.");return{kernelOptions:{entrypoint:r,files:t,archives:n,requirements:e.requirements||[],prebuiltPackageNames:e.prebuiltPackageNames||[],hostConfigResponse:e.hostConfig,pyodideUrl:e.pyodideUrl,streamlitConfig:e.streamlitConfig,idbfsMountpoints:e.idbfsMountpoints,sharedWorker:e.sharedWorker},toastCallbackOptions:{disableProgressToasts:e.disableProgressToasts||!1,disableErrorToasts:e.disableErrorToasts||!1}}}function bb(e){var t,n,r="";if("string"==typeof e||"number"==typeof e)r+=e;else if("object"==typeof e)if(Array.isArray(e))for(t=0;t<e.length;t++)e[t]&&(n=bb(e[t]))&&(r&&(r+=" "),r+=n);else for(t in e)e[t]&&(r&&(r+=" "),r+=t);return r}const fb=function(){for(var e,t,n=0,r="";n<arguments.length;)(e=arguments[n++])&&(t=bb(e))&&(r&&(r+=" "),r+=t);return r},hb=e=>"number"==typeof e&&!isNaN(e),mb=e=>"string"==typeof e,Mb=e=>"function"==typeof e,gb=e=>mb(e)||Mb(e)?e:null,Ob=e=>(0,t.isValidElement)(e)||mb(e)||Mb(e)||hb(e);function zb(e){let{enter:n,exit:r,appendPosition:o=!1,collapse:i=!0,collapseDuration:a=300}=e;return function(e){let{children:s,position:l,preventExitTransition:c,done:u,nodeRef:p,isIn:d}=e;const b=o?`${n}--${l}`:n,f=o?`${r}--${l}`:r,h=(0,t.useRef)(0);return(0,t.useLayoutEffect)((()=>{const e=p.current,t=b.split(" "),n=r=>{r.target===p.current&&(e.dispatchEvent(new Event("d")),e.removeEventListener("animationend",n),e.removeEventListener("animationcancel",n),0===h.current&&"animationcancel"!==r.type&&e.classList.remove(...t))};e.classList.add(...t),e.addEventListener("animationend",n),e.addEventListener("animationcancel",n)}),[]),(0,t.useEffect)((()=>{const e=p.current,t=()=>{e.removeEventListener("animationend",t),i?function(e,t,n){void 0===n&&(n=300);const{scrollHeight:r,style:o}=e;requestAnimationFrame((()=>{o.minHeight="initial",o.height=r+"px",o.transition=`all ${n}ms`,requestAnimationFrame((()=>{o.height="0",o.padding="0",o.margin="0",setTimeout(t,n)}))}))}(e,u,a):u()};d||(c?t():(h.current=1,e.className+=` ${f}`,e.addEventListener("animationend",t)))}),[d]),t.createElement(t.Fragment,null,s)}}function yb(e,t){return null!=e?{content:e.content,containerId:e.props.containerId,id:e.props.toastId,theme:e.props.theme,type:e.props.type,data:e.props.data||{},isLoading:e.props.isLoading,icon:e.props.icon,status:t}:{}}const Ab={list:new Map,emitQueue:new Map,on(e,t){return this.list.has(e)||this.list.set(e,[]),this.list.get(e).push(t),this},off(e,t){if(t){const n=this.list.get(e).filter((e=>e!==t));return this.list.set(e,n),this}return this.list.delete(e),this},cancelEmit(e){const t=this.emitQueue.get(e);return t&&(t.forEach(clearTimeout),this.emitQueue.delete(e)),this},emit(e){this.list.has(e)&&this.list.get(e).forEach((t=>{const n=setTimeout((()=>{t(...[].slice.call(arguments,1))}),0);this.emitQueue.has(e)||this.emitQueue.set(e,[]),this.emitQueue.get(e).push(n)}))}},vb=e=>{let{theme:n,type:r,...o}=e;return t.createElement("svg",{viewBox:"0 0 24 24",width:"100%",height:"100%",fill:"colored"===n?"currentColor":`var(--toastify-icon-color-${r})`,...o})},wb={info:function(e){return t.createElement(vb,{...e},t.createElement("path",{d:"M12 0a12 12 0 1012 12A12.013 12.013 0 0012 0zm.25 5a1.5 1.5 0 11-1.5 1.5 1.5 1.5 0 011.5-1.5zm2.25 13.5h-4a1 1 0 010-2h.75a.25.25 0 00.25-.25v-4.5a.25.25 0 00-.25-.25h-.75a1 1 0 010-2h1a2 2 0 012 2v4.75a.25.25 0 00.25.25h.75a1 1 0 110 2z"}))},warning:function(e){return t.createElement(vb,{...e},t.createElement("path",{d:"M23.32 17.191L15.438 2.184C14.728.833 13.416 0 11.996 0c-1.42 0-2.733.833-3.443 2.184L.533 17.448a4.744 4.744 0 000 4.368C1.243 23.167 2.555 24 3.975 24h16.05C22.22 24 24 22.044 24 19.632c0-.904-.251-1.746-.68-2.44zm-9.622 1.46c0 1.033-.724 1.823-1.698 1.823s-1.698-.79-1.698-1.822v-.043c0-1.028.724-1.822 1.698-1.822s1.698.79 1.698 1.822v.043zm.039-12.285l-.84 8.06c-.057.581-.408.943-.897.943-.49 0-.84-.367-.896-.942l-.84-8.065c-.057-.624.25-1.095.779-1.095h1.91c.528.005.84.476.784 1.1z"}))},success:function(e){return t.createElement(vb,{...e},t.createElement("path",{d:"M12 0a12 12 0 1012 12A12.014 12.014 0 0012 0zm6.927 8.2l-6.845 9.289a1.011 1.011 0 01-1.43.188l-4.888-3.908a1 1 0 111.25-1.562l4.076 3.261 6.227-8.451a1 1 0 111.61 1.183z"}))},error:function(e){return t.createElement(vb,{...e},t.createElement("path",{d:"M11.983 0a12.206 12.206 0 00-8.51 3.653A11.8 11.8 0 000 12.207 11.779 11.779 0 0011.8 24h.214A12.111 12.111 0 0024 11.791 11.766 11.766 0 0011.983 0zM10.5 16.542a1.476 1.476 0 011.449-1.53h.027a1.527 1.527 0 011.523 1.47 1.475 1.475 0 01-1.449 1.53h-.027a1.529 1.529 0 01-1.523-1.47zM11 12.5v-6a1 1 0 012 0v6a1 1 0 11-2 0z"}))},spinner:function(){return t.createElement("div",{className:"Toastify__spinner"})}};function Sb(e){const[,n]=(0,t.useReducer)((e=>e+1),0),[r,o]=(0,t.useState)([]),i=(0,t.useRef)(null),a=(0,t.useRef)(new Map).current,s=e=>-1!==r.indexOf(e),l=(0,t.useRef)({toastKey:1,displayedToast:0,count:0,queue:[],props:e,containerId:null,isToastActive:s,getToast:e=>a.get(e)}).current;function c(e){let{containerId:t}=e;const{limit:n}=l.props;!n||t&&l.containerId!==t||(l.count-=l.queue.length,l.queue=[])}function u(e){o((t=>null==e?[]:t.filter((t=>t!==e))))}function p(){const{toastContent:e,toastProps:t,staleId:n}=l.queue.shift();b(e,t,n)}function d(e,r){let{delay:o,staleId:s,...c}=r;if(!Ob(e)||function(e){return!i.current||l.props.enableMultiContainer&&e.containerId!==l.props.containerId||a.has(e.toastId)&&null==e.updateId}(c))return;const{toastId:d,updateId:f,data:h}=c,{props:m}=l,M=()=>u(d),g=null==f;g&&l.count++;const O={...m,style:m.toastStyle,key:l.toastKey++,...Object.fromEntries(Object.entries(c).filter((e=>{let[t,n]=e;return null!=n}))),toastId:d,updateId:f,data:h,closeToast:M,isIn:!1,className:gb(c.className||m.toastClassName),bodyClassName:gb(c.bodyClassName||m.bodyClassName),progressClassName:gb(c.progressClassName||m.progressClassName),autoClose:!c.isLoading&&(z=c.autoClose,y=m.autoClose,!1===z||hb(z)&&z>0?z:y),deleteToast(){const e=yb(a.get(d),"removed");a.delete(d),Ab.emit(4,e);const t=l.queue.length;if(l.count=null==d?l.count-l.displayedToast:l.count-1,l.count<0&&(l.count=0),t>0){const e=null==d?l.props.limit:1;if(1===t||1===e)l.displayedToast++,p();else{const n=e>t?t:e;l.displayedToast=n;for(let e=0;e<n;e++)p()}}else n()}};var z,y;O.iconOut=function(e){let{theme:n,type:r,isLoading:o,icon:i}=e,a=null;const s={theme:n,type:r};return!1===i||(Mb(i)?a=i(s):(0,t.isValidElement)(i)?a=(0,t.cloneElement)(i,s):mb(i)||hb(i)?a=i:o?a=wb.spinner():(e=>e in wb)(r)&&(a=wb[r](s))),a}(O),Mb(c.onOpen)&&(O.onOpen=c.onOpen),Mb(c.onClose)&&(O.onClose=c.onClose),O.closeButton=m.closeButton,!1===c.closeButton||Ob(c.closeButton)?O.closeButton=c.closeButton:!0===c.closeButton&&(O.closeButton=!Ob(m.closeButton)||m.closeButton);let A=e;(0,t.isValidElement)(e)&&!mb(e.type)?A=(0,t.cloneElement)(e,{closeToast:M,toastProps:O,data:h}):Mb(e)&&(A=e({closeToast:M,toastProps:O,data:h})),m.limit&&m.limit>0&&l.count>m.limit&&g?l.queue.push({toastContent:A,toastProps:O,staleId:s}):hb(o)?setTimeout((()=>{b(A,O,s)}),o):b(A,O,s)}function b(e,t,n){const{toastId:r}=t;n&&a.delete(n);const i={content:e,props:t};a.set(r,i),o((e=>[...e,r].filter((e=>e!==n)))),Ab.emit(4,yb(i,null==i.props.updateId?"added":"updated"))}return(0,t.useEffect)((()=>(l.containerId=e.containerId,Ab.cancelEmit(3).on(0,d).on(1,(e=>i.current&&u(e))).on(5,c).emit(2,l),()=>{a.clear(),Ab.emit(3,l)})),[]),(0,t.useEffect)((()=>{l.props=e,l.isToastActive=s,l.displayedToast=r.length})),{getToastToRender:function(t){const n=new Map,r=Array.from(a.values());return e.newestOnTop&&r.reverse(),r.forEach((e=>{const{position:t}=e.props;n.has(t)||n.set(t,[]),n.get(t).push(e)})),Array.from(n,(e=>t(e[0],e[1])))},containerRef:i,isToastActive:s}}function qb(e){return e.targetTouches&&e.targetTouches.length>=1?e.targetTouches[0].clientX:e.clientX}function Eb(e){return e.targetTouches&&e.targetTouches.length>=1?e.targetTouches[0].clientY:e.clientY}function _b(e){const[n,r]=(0,t.useState)(!1),[o,i]=(0,t.useState)(!1),a=(0,t.useRef)(null),s=(0,t.useRef)({start:0,x:0,y:0,delta:0,removalDistance:0,canCloseOnClick:!0,canDrag:!1,boundingRect:null,didMove:!1}).current,l=(0,t.useRef)(e),{autoClose:c,pauseOnHover:u,closeToast:p,onClick:d,closeOnClick:b}=e;function f(t){if(e.draggable){"touchstart"===t.nativeEvent.type&&t.nativeEvent.preventDefault(),s.didMove=!1,document.addEventListener("mousemove",g),document.addEventListener("mouseup",O),document.addEventListener("touchmove",g),document.addEventListener("touchend",O);const n=a.current;s.canCloseOnClick=!0,s.canDrag=!0,s.boundingRect=n.getBoundingClientRect(),n.style.transition="",s.x=qb(t.nativeEvent),s.y=Eb(t.nativeEvent),"x"===e.draggableDirection?(s.start=s.x,s.removalDistance=n.offsetWidth*(e.draggablePercent/100)):(s.start=s.y,s.removalDistance=n.offsetHeight*(80===e.draggablePercent?1.5*e.draggablePercent:e.draggablePercent/100))}}function h(t){if(s.boundingRect){const{top:n,bottom:r,left:o,right:i}=s.boundingRect;"touchend"!==t.nativeEvent.type&&e.pauseOnHover&&s.x>=o&&s.x<=i&&s.y>=n&&s.y<=r?M():m()}}function m(){r(!0)}function M(){r(!1)}function g(t){const r=a.current;s.canDrag&&r&&(s.didMove=!0,n&&M(),s.x=qb(t),s.y=Eb(t),s.delta="x"===e.draggableDirection?s.x-s.start:s.y-s.start,s.start!==s.x&&(s.canCloseOnClick=!1),r.style.transform=`translate${e.draggableDirection}(${s.delta}px)`,r.style.opacity=""+(1-Math.abs(s.delta/s.removalDistance)))}function O(){document.removeEventListener("mousemove",g),document.removeEventListener("mouseup",O),document.removeEventListener("touchmove",g),document.removeEventListener("touchend",O);const t=a.current;if(s.canDrag&&s.didMove&&t){if(s.canDrag=!1,Math.abs(s.delta)>s.removalDistance)return i(!0),void e.closeToast();t.style.transition="transform 0.2s, opacity 0.2s",t.style.transform=`translate${e.draggableDirection}(0)`,t.style.opacity="1"}}(0,t.useEffect)((()=>{l.current=e})),(0,t.useEffect)((()=>(a.current&&a.current.addEventListener("d",m,{once:!0}),Mb(e.onOpen)&&e.onOpen((0,t.isValidElement)(e.children)&&e.children.props),()=>{const e=l.current;Mb(e.onClose)&&e.onClose((0,t.isValidElement)(e.children)&&e.children.props)})),[]),(0,t.useEffect)((()=>(e.pauseOnFocusLoss&&(document.hasFocus()||M(),window.addEventListener("focus",m),window.addEventListener("blur",M)),()=>{e.pauseOnFocusLoss&&(window.removeEventListener("focus",m),window.removeEventListener("blur",M))})),[e.pauseOnFocusLoss]);const z={onMouseDown:f,onTouchStart:f,onMouseUp:h,onTouchEnd:h};return c&&u&&(z.onMouseEnter=M,z.onMouseLeave=m),b&&(z.onClick=e=>{d&&d(e),s.canCloseOnClick&&p()}),{playToast:m,pauseToast:M,isRunning:n,preventExitTransition:o,toastRef:a,eventHandlers:z}}function xb(e){let{closeToast:n,theme:r,ariaLabel:o="close"}=e;return t.createElement("button",{className:`Toastify__close-button Toastify__close-button--${r}`,type:"button",onClick:e=>{e.stopPropagation(),n(e)},"aria-label":o},t.createElement("svg",{"aria-hidden":"true",viewBox:"0 0 14 16"},t.createElement("path",{fillRule:"evenodd",d:"M7.71 8.23l3.75 3.75-1.48 1.48-3.75-3.75-3.75 3.75L1 11.98l3.75-3.75L1 4.48 2.48 3l3.75 3.75L9.98 3l1.48 1.48-3.75 3.75z"})))}function Tb(e){let{delay:n,isRunning:r,closeToast:o,type:i="default",hide:a,className:s,style:l,controlledProgress:c,progress:u,rtl:p,isIn:d,theme:b}=e;const f=a||c&&0===u,h={...l,animationDuration:`${n}ms`,animationPlayState:r?"running":"paused",opacity:f?0:1};c&&(h.transform=`scaleX(${u})`);const m=fb("Toastify__progress-bar",c?"Toastify__progress-bar--controlled":"Toastify__progress-bar--animated",`Toastify__progress-bar-theme--${b}`,`Toastify__progress-bar--${i}`,{"Toastify__progress-bar--rtl":p}),M=Mb(s)?s({rtl:p,type:i,defaultClassName:m}):fb(m,s);return t.createElement("div",{role:"progressbar","aria-hidden":f?"true":"false","aria-label":"notification timer",className:M,style:h,[c&&u>=1?"onTransitionEnd":"onAnimationEnd"]:c&&u<1?null:()=>{d&&o()}})}const Rb=e=>{const{isRunning:n,preventExitTransition:r,toastRef:o,eventHandlers:i}=_b(e),{closeButton:a,children:s,autoClose:l,onClick:c,type:u,hideProgressBar:p,closeToast:d,transition:b,position:f,className:h,style:m,bodyClassName:M,bodyStyle:g,progressClassName:O,progressStyle:z,updateId:y,role:A,progress:v,rtl:w,toastId:S,deleteToast:q,isIn:E,isLoading:_,iconOut:x,closeOnClick:T,theme:R}=e,k=fb("Toastify__toast",`Toastify__toast-theme--${R}`,`Toastify__toast--${u}`,{"Toastify__toast--rtl":w},{"Toastify__toast--close-on-click":T}),N=Mb(h)?h({rtl:w,position:f,type:u,defaultClassName:k}):fb(k,h),C=!!v||!l,W={closeToast:d,type:u,theme:R};let L=null;return!1===a||(L=Mb(a)?a(W):(0,t.isValidElement)(a)?(0,t.cloneElement)(a,W):xb(W)),t.createElement(b,{isIn:E,done:q,position:f,preventExitTransition:r,nodeRef:o},t.createElement("div",{id:S,onClick:c,className:N,...i,style:m,ref:o},t.createElement("div",{...E&&{role:A},className:Mb(M)?M({type:u}):fb("Toastify__toast-body",M),style:g},null!=x&&t.createElement("div",{className:fb("Toastify__toast-icon",{"Toastify--animate-icon Toastify__zoom-enter":!_})},x),t.createElement("div",null,s)),L,t.createElement(Tb,{...y&&!C?{key:`pb-${y}`}:{},rtl:w,theme:R,delay:l,isRunning:n,isIn:E,closeToast:d,hide:p,type:u,style:z,className:O,controlledProgress:C,progress:v||0})))},kb=function(e,t){return void 0===t&&(t=!1),{enter:`Toastify--animate Toastify__${e}-enter`,exit:`Toastify--animate Toastify__${e}-exit`,appendPosition:t}},Nb=zb(kb("bounce",!0)),Cb=zb(kb("slide",!0)),Wb=(zb(kb("zoom")),zb(kb("flip")),(0,t.forwardRef)(((e,n)=>{const{getToastToRender:r,containerRef:o,isToastActive:i}=Sb(e),{className:a,style:s,rtl:l,containerId:c}=e;function u(e){const t=fb("Toastify__toast-container",`Toastify__toast-container--${e}`,{"Toastify__toast-container--rtl":l});return Mb(a)?a({position:e,rtl:l,defaultClassName:t}):fb(t,gb(a))}return(0,t.useEffect)((()=>{n&&(n.current=o.current)}),[]),t.createElement("div",{ref:o,className:"Toastify",id:c},r(((e,n)=>{const r=n.length?{...s}:{...s,pointerEvents:"none"};return t.createElement("div",{className:u(e),style:r,key:`container-${e}`},n.map(((e,r)=>{let{content:o,props:a}=e;return t.createElement(Rb,{...a,isIn:i(a.toastId),style:{...a.style,"--nth":r+1,"--len":n.length},key:`toast-${a.key}`},o)})))})))})));Wb.displayName="ToastContainer",Wb.defaultProps={position:"top-right",transition:Nb,autoClose:5e3,closeButton:xb,pauseOnHover:!0,pauseOnFocusLoss:!0,closeOnClick:!0,draggable:!0,draggablePercent:80,draggableDirection:"x",role:"alert",theme:"light"};let Lb,Ib=new Map,Pb=[],Db=1;function Bb(){return""+Db++}function jb(e){return e&&(mb(e.toastId)||hb(e.toastId))?e.toastId:Bb()}function Fb(e,t){return Ib.size>0?Ab.emit(0,e,t):Pb.push({content:e,options:t}),t.toastId}function Ub(e,t){return{...t,type:t&&t.type||e,toastId:jb(t)}}function Vb(e){return(t,n)=>Fb(t,Ub(e,n))}function Hb(e,t){return Fb(e,Ub("default",t))}Hb.loading=(e,t)=>Fb(e,Ub("default",{isLoading:!0,autoClose:!1,closeOnClick:!1,closeButton:!1,draggable:!1,...t})),Hb.promise=function(e,t,n){let r,{pending:o,error:i,success:a}=t;o&&(r=mb(o)?Hb.loading(o,n):Hb.loading(o.render,{...n,...o}));const s={isLoading:null,autoClose:null,closeOnClick:null,closeButton:null,draggable:null},l=(e,t,o)=>{if(null==t)return void Hb.dismiss(r);const i={type:e,...s,...n,data:o},a=mb(t)?{render:t}:t;return r?Hb.update(r,{...i,...a}):Hb(a.render,{...i,...a}),o},c=Mb(e)?e():e;return c.then((e=>l("success",a,e))).catch((e=>l("error",i,e))),c},Hb.success=Vb("success"),Hb.info=Vb("info"),Hb.error=Vb("error"),Hb.warning=Vb("warning"),Hb.warn=Hb.warning,Hb.dark=(e,t)=>Fb(e,Ub("default",{theme:"dark",...t})),Hb.dismiss=e=>{Ib.size>0?Ab.emit(1,e):Pb=Pb.filter((t=>null!=e&&t.options.toastId!==e))},Hb.clearWaitingQueue=function(e){return void 0===e&&(e={}),Ab.emit(5,e)},Hb.isActive=e=>{let t=!1;return Ib.forEach((n=>{n.isToastActive&&n.isToastActive(e)&&(t=!0)})),t},Hb.update=function(e,t){void 0===t&&(t={}),setTimeout((()=>{const n=function(e,t){let{containerId:n}=t;const r=Ib.get(n||Lb);return r&&r.getToast(e)}(e,t);if(n){const{props:r,content:o}=n,i={delay:100,...r,...t,toastId:t.toastId||e,updateId:Bb()};i.toastId!==e&&(i.staleId=e);const a=i.render||o;delete i.render,Fb(a,i)}}),0)},Hb.done=e=>{Hb.update(e,{progress:1})},Hb.onChange=e=>(Ab.on(4,e),()=>{Ab.off(4,e)}),Hb.POSITION={TOP_LEFT:"top-left",TOP_RIGHT:"top-right",TOP_CENTER:"top-center",BOTTOM_LEFT:"bottom-left",BOTTOM_RIGHT:"bottom-right",BOTTOM_CENTER:"bottom-center"},Hb.TYPE={INFO:"info",SUCCESS:"success",WARNING:"warning",ERROR:"error",DEFAULT:"default"},Ab.on(2,(e=>{Lb=e.containerId||e,Ib.set(Lb,e),Pb.forEach((e=>{Ab.emit(0,e.content,e.options)})),Pb=[]})).on(3,(e=>{Ib.delete(e.containerId||e),0===Ib.size&&Ab.off(0).off(1).off(5)}));const Xb=function(e){const t=e;return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)("p",{children:t.message}),t.error&&(0,h.jsx)("pre",{style:{overflow:"scroll",maxHeight:300},children:(0,h.jsx)("code",{children:t.error.message})})]})};function $b(e){const{disableProgressToasts:t=!1,disableErrorToasts:n=!1}=null!==e&&void 0!==e?e:{};let r=null;const o=[];return{onProgress:e=>{if(t)return;const n=Hb(e,{position:Hb.POSITION.BOTTOM_RIGHT,transition:Cb,isLoading:!0,hideProgressBar:!0,closeButton:!1});o.push(n),r&&Hb.update(r,{isLoading:!1,autoClose:3e3}),r=n},onLoad:()=>{o.forEach((e=>Hb.dismiss(e)))},onError:e=>{n||Hb((0,h.jsx)(Xb,{message:"Error during booting up",error:e}),{position:Hb.POSITION.BOTTOM_RIGHT,type:Hb.TYPE.ERROR,autoClose:!1,closeOnClick:!1})}}}function Gb(e,t){const n=t.error;return Hb.promise(e,{pending:t.pending,success:t.success,error:"string"===typeof n?{render(e){let{data:t}=e;return t?(0,h.jsx)(Xb,{message:n,error:t}):(0,h.jsx)(h.Fragment,{children:"messages.error"})},autoClose:!1,closeOnClick:!1}:n},{hideProgressBar:!0,position:Hb.POSITION.BOTTOM_RIGHT})}class Kb{constructor(e,t){this.kernel=e,e.onModuleAutoLoad=(e,n)=>{null!==t&&void 0!==t&&t.onModuleAutoLoad&&t.onModuleAutoLoad(e,n),Gb(n,{success:{render(e){let{data:t}=e;return"Auto-loaded"+(t?": "+t.map((e=>e.name)).join(", "):" packages")}},error:"Failed to auto-load packages",pending:"Auto-loading packages"})}}writeFile(){return Gb(this.kernel.writeFile(...arguments),{error:"Failed to write the file"})}renameFile(){return Gb(this.kernel.renameFile(...arguments),{error:"Failed to rename the file"})}unlink(){return Gb(this.kernel.unlink(...arguments),{error:"Failed to remove the file"})}readFile(){return Gb(this.kernel.readFile(...arguments),{error:"Failed to read the file"})}install(){return Gb(this.kernel.install(...arguments),{pending:"Installing",success:"Successfully installed",error:"Failed to install"})}reboot(){return Gb(this.kernel.reboot(...arguments),{pending:"Rebooting",success:"Successfully rebooted",error:"Failed to reboot"})}}function Yb(){const e=(0,o.x0)().name;return e===o.QM?window.matchMedia("(prefers-color-scheme: dark)").matches:e===su.a5.name}const Jb=function(){return(0,h.jsx)(Wb,{style:{zIndex:999999},theme:Yb()?"dark":"light"})};let Zb;if(("."===__webpack_require__.p||__webpack_require__.p.startsWith("./"))&&document.currentScript&&"src"in document.currentScript){const e=function(e){const t=e.split("/").slice(0,-1).join("/")+"/";try{return new URL(t).toString()}catch{return new URL(t,window.location.origin).toString()}}(document.currentScript.src);__webpack_require__.p=e,Zb=e}function Qb(e){let o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:document.body;const{kernelOptions:i,toastCallbackOptions:a}=db(e),s=new r.rI({...i,wheelBaseUrl:Zb,...$b(a)});n.render((0,h.jsxs)(t.StrictMode,{children:[(0,h.jsx)(cb,{kernel:s}),(0,h.jsx)(Jb,{})]}),o);const l=new Kb(s);return{unmount:()=>{s.dispose(),n.unmountComponentAtNode(o)},install:e=>l.install(e),writeFile:(e,t,n)=>l.writeFile(e,t,n),renameFile:(e,t)=>l.renameFile(e,t),unlink:e=>l.unlink(e),readFile:(e,t)=>l.readFile(e,t)}}var ef=__webpack_require__(87330);const tf={object(){return this.string(function(e){for(var t=e[0],n=1,r=arguments.length;n<r;n++)t+=arguments[n]+e[n];return t}(...arguments))},string(e){for(const t of e.split(/[\r\n]+/))if(t.trim().length){/^(\s+)/.test(t)&&(e=e.replace(new RegExp("^"+RegExp.$1,"gm"),""));break}return e}},nf=function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return tf[typeof e](e,...n)};document.addEventListener("DOMContentLoaded",(()=>{!function(e){class t extends HTMLElement{constructor(){super(...arguments),this._controller=null,this.parseOptions=()=>{let e=null;const t={};let n="";const r=[],o=[];if(this.childNodes.forEach((i=>{if(i instanceof Text){const e=i.textContent;if(null==e)return;if(""===e.replace(/\s*/g,""))return;o.push(e)}else if(i instanceof HTMLElement)switch(i.tagName){case"APP-FILE":{const n=i.getAttribute("name");if(!n)throw new Error("Attribute 'name' is required for <app-file>");if(t[n])throw new Error(`File with name '${n}' already exists`);const r=i.getAttribute("url"),o=i.getAttribute("encoding");if(r)return void(t[n]={url:r,opts:o?{encoding:o}:void 0});if(t[n]=i.textContent?nf(i.textContent):"",i.hasAttribute("entrypoint")){if(e)throw new Error("Multiple entrypoints are not allowed");e=n}return}case"APP-REQUIREMENTS":return void(n+=i.textContent?nf(i.textContent):"");case"APP-ARCHIVE":{const e=i.getAttribute("url"),t=i.getAttribute("format");if(!e||!t)throw new Error("Attributes 'url' and 'format' are required for <app-archive>");return void r.push({url:e,format:t})}}})),null===e){if(0===o.length)throw new Error("No content found");e="streamlit_app.py",t[e]=nf(o[0])}if(!e)throw new Error("Entrypoint is required");const i={};return this.hasAttribute("shared-worker")&&(i.sharedWorker=!0),{...i,entrypoint:e,files:t,requirements:(0,ef.Yl)(n),archives:r,streamlitConfig:{}}}}connectedCallback(){const t=this.parseOptions(),n=document.createElement("div");n.classList.add("stlite-app-container"),this.appendChild(n),this._controller=e(t,n),this.style.display="block"}disconnectedCallback(){var e;null===(e=this._controller)||void 0===e||e.unmount()}}customElements.define("streamlit-app",t)}(Qb)}))})(),stlite=__webpack_exports__})();
29
29
  //# sourceMappingURL=stlite.js.map