@stlite/desktop 0.26.0 → 0.27.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/bin/dump_artifacts.js +1 -1
- package/build/asset-manifest.json +8 -8
- package/build/index.html +1 -1
- package/build/static/js/{2632.3ed5d578.chunk.js → 2632.13f2d6fb.chunk.js} +1 -1
- package/build/static/js/{3392.d73d4efc.chunk.js → 3392.5f81677b.chunk.js} +1 -1
- package/build/static/js/6391.5417f789.chunk.js +1 -0
- package/build/static/js/{9462.6616e921.chunk.js → 9462.e56f97b3.chunk.js} +1 -1
- package/build/static/js/{9551.e50bee9b.chunk.js → 9551.f4ae413b.chunk.js} +1 -1
- package/build/static/js/main.915cbd3b.js +28 -0
- package/package.json +5 -5
- package/build/pyodide/openssl-1.1.1n.zip +0 -0
- package/build/pyodide/ssl-1.0.0.zip +0 -0
- package/build/static/js/6391.6cdac98a.chunk.js +0 -1
- package/build/static/js/main.91a73418.js +0 -28
- /package/build/static/js/{main.91a73418.js.LICENSE.txt → main.915cbd3b.js.LICENSE.txt} +0 -0
package/README.md
CHANGED
|
@@ -24,8 +24,8 @@ Convert your [Streamlit](https://streamlit.io/) application into a desktop app w
|
|
|
24
24
|
}
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
|
-
"@stlite/desktop": "^0.
|
|
28
|
-
"electron": "
|
|
27
|
+
"@stlite/desktop": "^0.25.0",
|
|
28
|
+
"electron": "23.0.0",
|
|
29
29
|
"electron-builder": "^23.6.0"
|
|
30
30
|
}
|
|
31
31
|
}
|
package/bin/dump_artifacts.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
var O=Object.create;var g=Object.defineProperty;var P=Object.getOwnPropertyDescriptor;var $=Object.getOwnPropertyNames;var j=Object.getPrototypeOf,F=Object.prototype.hasOwnProperty;var w=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var x=(e,t,r,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of $(t))!F.call(e,o)&&o!==r&&g(e,o,{get:()=>t[o],enumerable:!(i=P(t,o))||i.enumerable});return e};var n=(e,t,r)=>(r=e!=null?O(j(e)):{},x(t||!e||!e.__esModule?g(r,"default",{value:e,enumerable:!0}):r,e));var v=w(u=>{"use strict";Object.defineProperty(u,"__esModule",{value:!0});u.parseRequirementsTxt=void 0;function C(e){return e.split(`
|
|
3
|
-
`).filter(t=>!t.startsWith("#")).map(t=>t.trim()).filter(t=>t!=="")}u.parseRequirementsTxt=C});var _=w(c=>{"use strict";var K=c&&c.__createBinding||(Object.create?function(e,t,r,i){i===void 0&&(i=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,i,o)}:function(e,t,r,i){i===void 0&&(i=r),e[i]=t[r]}),R=c&&c.__exportStar||function(e,t){for(var r in e)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&K(t,e,r)};Object.defineProperty(c,"__esModule",{value:!0});R(v(),c)});var D=n(require("yargs")),b=require("yargs/helpers"),a=n(require("path")),s=n(require("fs/promises")),f=n(require("fs-extra")),y=n(require("node-fetch")),k=require("pyodide"),T=n(_());global.fetch=y.default;async function B(e){console.info("Copy the build directory (the bare built app files) to this directory...");let t=a.default.resolve(__dirname,"../build");if(!(await s.default.stat(t)).isDirectory())throw new Error(`The source ${t} does not exist.`);if(t===e.copyTo){console.warn(`sourceDir == destDir (${t}). Are you in the development environment? Skip copying the directory.`);return}if(e.keepOld)try{await s.default.access(e.copyTo),console.info(`${e.copyTo} already exists. Use it and skip copying.`);return}catch{throw new Error(`${e.copyTo} does not exist even though the \`keepOld\` option is specified`)}console.log(`Copy ${t} to ${e.copyTo}`),await s.default.rm(e.copyTo,{recursive:!0,force:!0}),await f.default.copy(t,e.copyTo)}async function m(e,t){console.log(`Install the local wheel ${t}`);let r=await s.default.readFile(t),i="/tmp/"+a.default.basename(t);e.FS.writeFile(i,r);let o=e.pyimport("micropip"),p=`emfs:${i}`;console.log(`Install ${p}`),await o.install.callKwargs(p,{keep_going:!0})}async function E(e){console.info("Create the site-packages snapshot file...");let t=await(0,k.loadPyodide)();if(await t.loadPackage(["micropip"]),e.useLocalKernelWheels){let p=a.default.dirname(require.resolve("@stlite/kernel")),l=a.default.resolve(p,"../py");await m(t,a.default.join(l,"
|
|
3
|
+
`).filter(t=>!t.startsWith("#")).map(t=>t.trim()).filter(t=>t!=="")}u.parseRequirementsTxt=C});var _=w(c=>{"use strict";var K=c&&c.__createBinding||(Object.create?function(e,t,r,i){i===void 0&&(i=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,i,o)}:function(e,t,r,i){i===void 0&&(i=r),e[i]=t[r]}),R=c&&c.__exportStar||function(e,t){for(var r in e)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&K(t,e,r)};Object.defineProperty(c,"__esModule",{value:!0});R(v(),c)});var D=n(require("yargs")),b=require("yargs/helpers"),a=n(require("path")),s=n(require("fs/promises")),f=n(require("fs-extra")),y=n(require("node-fetch")),k=require("pyodide"),T=n(_());global.fetch=y.default;async function B(e){console.info("Copy the build directory (the bare built app files) to this directory...");let t=a.default.resolve(__dirname,"../build");if(!(await s.default.stat(t)).isDirectory())throw new Error(`The source ${t} does not exist.`);if(t===e.copyTo){console.warn(`sourceDir == destDir (${t}). Are you in the development environment? Skip copying the directory.`);return}if(e.keepOld)try{await s.default.access(e.copyTo),console.info(`${e.copyTo} already exists. Use it and skip copying.`);return}catch{throw new Error(`${e.copyTo} does not exist even though the \`keepOld\` option is specified`)}console.log(`Copy ${t} to ${e.copyTo}`),await s.default.rm(e.copyTo,{recursive:!0,force:!0}),await f.default.copy(t,e.copyTo)}async function m(e,t){console.log(`Install the local wheel ${t}`);let r=await s.default.readFile(t),i="/tmp/"+a.default.basename(t);e.FS.writeFile(i,r);let o=e.pyimport("micropip"),p=`emfs:${i}`;console.log(`Install ${p}`),await o.install.callKwargs(p,{keep_going:!0})}async function E(e){console.info("Create the site-packages snapshot file...");let t=await(0,k.loadPyodide)();if(await t.loadPackage(["micropip"]),e.useLocalKernelWheels){let p=a.default.dirname(require.resolve("@stlite/kernel")),l=a.default.resolve(p,"../py");await m(t,a.default.join(l,"stlite-server/dist/stlite_server-0.1.0-py3-none-any.whl")),await m(t,a.default.join(l,"stlite-pyarrow/dist/stlite_pyarrow-0.1.0-py3-none-any.whl")),await m(t,a.default.join(l,"streamlit/lib/dist/streamlit-1.18.1-py2.py3-none-any.whl"))}else{let l=require(a.default.resolve(__dirname,"../package.json")).version,S=`https://data.jsdelivr.com/v1/package/npm/@stlite/kernel@${l}/flat`,h=(await(await(0,y.default)(S)).json()).files.filter(d=>d.name.endsWith(".whl")).map(d=>`https://cdn.jsdelivr.net/npm/@stlite/kernel@${l}${d.name}`),q=t.pyimport("micropip");console.log("Install",h),await q.install.callKwargs(h,{keep_going:!0})}console.log(`Install the requirements ${JSON.stringify(e.requirements)}`),await t.pyimport("micropip").install.callKwargs(e.requirements,{keep_going:!0}),console.log("Archive the site-packages director(y|ies)");let i="/tmp/site-packages-snapshot.tar.gz";await t.runPythonAsync(`
|
|
4
4
|
import tarfile
|
|
5
5
|
import site
|
|
6
6
|
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"files": {
|
|
3
3
|
"main.css": "/static/css/main.b43a24ba.css",
|
|
4
|
-
"main.js": "/static/js/main.
|
|
5
|
-
"static/js/6391.
|
|
4
|
+
"main.js": "/static/js/main.915cbd3b.js",
|
|
5
|
+
"static/js/6391.5417f789.chunk.js": "/static/js/6391.5417f789.chunk.js",
|
|
6
6
|
"static/js/4994.8f0118ec.chunk.js": "/static/js/4994.8f0118ec.chunk.js",
|
|
7
|
-
"static/js/9462.
|
|
7
|
+
"static/js/9462.e56f97b3.chunk.js": "/static/js/9462.e56f97b3.chunk.js",
|
|
8
8
|
"static/js/1367.9dcea0bc.chunk.js": "/static/js/1367.9dcea0bc.chunk.js",
|
|
9
9
|
"static/js/5865.90a40692.chunk.js": "/static/js/5865.90a40692.chunk.js",
|
|
10
10
|
"static/css/3683.60b7ada4.chunk.css": "/static/css/3683.60b7ada4.chunk.css",
|
|
@@ -15,12 +15,12 @@
|
|
|
15
15
|
"static/js/2116.2e449b06.chunk.js": "/static/js/2116.2e449b06.chunk.js",
|
|
16
16
|
"static/js/6097.56c4b02a.chunk.js": "/static/js/6097.56c4b02a.chunk.js",
|
|
17
17
|
"static/js/91.f23bbeac.chunk.js": "/static/js/91.f23bbeac.chunk.js",
|
|
18
|
-
"static/js/2632.
|
|
18
|
+
"static/js/2632.13f2d6fb.chunk.js": "/static/js/2632.13f2d6fb.chunk.js",
|
|
19
19
|
"static/js/9735.0e70600f.chunk.js": "/static/js/9735.0e70600f.chunk.js",
|
|
20
20
|
"static/js/5678.b7f865a0.chunk.js": "/static/js/5678.b7f865a0.chunk.js",
|
|
21
|
-
"static/js/9551.
|
|
21
|
+
"static/js/9551.f4ae413b.chunk.js": "/static/js/9551.f4ae413b.chunk.js",
|
|
22
22
|
"static/js/7937.a3bc5cdb.chunk.js": "/static/js/7937.a3bc5cdb.chunk.js",
|
|
23
|
-
"static/js/3392.
|
|
23
|
+
"static/js/3392.5f81677b.chunk.js": "/static/js/3392.5f81677b.chunk.js",
|
|
24
24
|
"static/js/7496.37614377.chunk.js": "/static/js/7496.37614377.chunk.js",
|
|
25
25
|
"static/js/3977.8a9ac9d7.chunk.js": "/static/js/3977.8a9ac9d7.chunk.js",
|
|
26
26
|
"static/js/6242.5e6f91ac.chunk.js": "/static/js/6242.5e6f91ac.chunk.js",
|
|
@@ -56,7 +56,6 @@
|
|
|
56
56
|
"static/js/6865.b0803b6b.chunk.js": "/static/js/6865.b0803b6b.chunk.js",
|
|
57
57
|
"static/js/6679.d28318d1.chunk.js": "/static/js/6679.d28318d1.chunk.js",
|
|
58
58
|
"pypi/streamlit-1.18.1-py2.py3-none-any.whl": "/pypi/streamlit-1.18.1-py2.py3-none-any.whl",
|
|
59
|
-
"pypi/tornado-6.2-py3-none-any.whl": "/pypi/tornado-6.2-py3-none-any.whl",
|
|
60
59
|
"static/media/SourceSansPro-Regular.ttf": "/static/media/SourceSansPro-Regular.efa76f8326aa5cee3bdd.ttf",
|
|
61
60
|
"static/media/SourceSansPro-SemiBold.ttf": "/static/media/SourceSansPro-SemiBold.43cc81b496222dc9ce3c.ttf",
|
|
62
61
|
"static/media/SourceSansPro-Bold.ttf": "/static/media/SourceSansPro-Bold.12e6acd2589d00c9d0aa.ttf",
|
|
@@ -109,6 +108,7 @@
|
|
|
109
108
|
"static/media/KaTeX_Math-Italic.woff2": "/static/media/KaTeX_Math-Italic.6d3d25f4820d0da8f01f.woff2",
|
|
110
109
|
"static/media/KaTeX_Math-BoldItalic.woff2": "/static/media/KaTeX_Math-BoldItalic.dcbcbd93bac0470b462d.woff2",
|
|
111
110
|
"static/media/KaTeX_Typewriter-Regular.woff": "/static/media/KaTeX_Typewriter-Regular.4c6b94fd1d07f8beff7c.woff",
|
|
111
|
+
"pypi/stlite_server-0.1.0-py3-none-any.whl": "/pypi/stlite_server-0.1.0-py3-none-any.whl",
|
|
112
112
|
"static/media/KaTeX_SansSerif-Bold.woff": "/static/media/KaTeX_SansSerif-Bold.b9cd458ac6d5889ff9c3.woff",
|
|
113
113
|
"static/media/KaTeX_SansSerif-Italic.woff": "/static/media/KaTeX_SansSerif-Italic.8d593cfaa96238d5e2f8.woff",
|
|
114
114
|
"static/media/KaTeX_Typewriter-Regular.woff2": "/static/media/KaTeX_Typewriter-Regular.c295e7f71970f03c0549.woff2",
|
|
@@ -152,6 +152,6 @@
|
|
|
152
152
|
},
|
|
153
153
|
"entrypoints": [
|
|
154
154
|
"static/css/main.b43a24ba.css",
|
|
155
|
-
"static/js/main.
|
|
155
|
+
"static/js/main.915cbd3b.js"
|
|
156
156
|
]
|
|
157
157
|
}
|
package/build/index.html
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
<!doctype html><html lang="en"><head><meta charset="utf-8"/><meta name="viewport" content="width=device-width,initial-scale=1"/><title>stlite</title><meta http-equiv="Content-Security-Policy" content="default-src 'self'; script-src 'wasm-unsafe-eval' 'unsafe-eval'; style-src 'self' 'unsafe-inline'; worker-src 'self' blob:; script-src-elem 'self' 'unsafe-inline' https:; style-src-elem 'self' 'unsafe-inline' https:; font-src 'self' data: https:; connect-src https://data.streamlit.io/ https://*.mapbox.com/ 'self' https:; img-src https: blob: data: file:; media-src https: blob:; frame-src https:"><script defer="defer" src="/static/js/main.
|
|
1
|
+
<!doctype html><html lang="en"><head><meta charset="utf-8"/><meta name="viewport" content="width=device-width,initial-scale=1"/><title>stlite</title><meta http-equiv="Content-Security-Policy" content="default-src 'self'; script-src 'wasm-unsafe-eval' 'unsafe-eval'; style-src 'self' 'unsafe-inline'; worker-src 'self' blob:; script-src-elem 'self' 'unsafe-inline' https:; style-src-elem 'self' 'unsafe-inline' https:; font-src 'self' data: https:; connect-src https://data.streamlit.io/ https://*.mapbox.com/ 'self' https:; img-src https: blob: data: file:; media-src https: blob:; frame-src https:"><script defer="defer" src="/static/js/main.915cbd3b.js"></script><link href="/static/css/main.b43a24ba.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div></body></html>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(globalThis.webpackChunk_stlite_desktop=globalThis.webpackChunk_stlite_desktop||[]).push([[2632],{86926:(t,i,e)=>{"use strict";e.r(i),e.d(i,{default:()=>p});var r=e(5057),n=e(89733),o=e(
|
|
1
|
+
(globalThis.webpackChunk_stlite_desktop=globalThis.webpackChunk_stlite_desktop||[]).push([[2632],{86926:(t,i,e)=>{"use strict";e.r(i),e.d(i,{default:()=>p});var r=e(5057),n=e(89733),o=e(60735),a=e(85493),s=e(62658),l=e(22199),d=e(45490);const h=(0,d.Z)("div",{target:"etr89bj2"})((({theme:t})=>({display:"flex",flexDirection:"row",flexWrap:"wrap",rowGap:t.spacing.lg})),""),c=(0,d.Z)("div",{target:"etr89bj1"})((({theme:t})=>({display:"flex",flexDirection:"column",alignItems:"stretch",width:"auto",flexGrow:0})),""),g=(0,d.Z)("div",{target:"etr89bj0"})((({theme:t})=>({fontFamily:t.genericFonts.bodyFont,fontSize:t.fontSizes.sm,color:t.colors.fadedText60,textAlign:"center",marginTop:t.spacing.xs,wordWrap:"break-word",padding:"0.125rem"})),"");var u,m=e(96266);!function(t){t[t.OriginalWidth=-1]="OriginalWidth",t[t.ColumnWidth=-2]="ColumnWidth",t[t.AutoWidth=-3]="AutoWidth"}(u||(u={}));const p=(0,s.Z)((function({width:t,isFullScreen:i,element:e,height:s}){const{getBaseUriParts:d}=(0,r.useContext)(a.Z),p=(0,o.$R)(e.imgs);let f;const x=e.width;if(x===u.OriginalWidth||x===u.AutoWidth)f=void 0;else if(x===u.ColumnWidth)f=t;else{if(!(x>0))throw Error(`Invalid image width: ${x}`);f=x}const w={};return s&&i?(w.maxHeight=s,w["object-fit"]="contain"):(w.width=f,x===u.AutoWidth&&(w.maxWidth="100%")),(0,m.jsx)(h,{style:{width:t},children:p.map(((t,i)=>{const e=t;return(0,m.jsxs)(c,{"data-testid":"stImage",children:[e.markup?(0,n.ZP)((0,l.kB)(e.markup)):(0,m.jsx)("img",{style:w,src:(0,l.Bz)(e.url,d()),alt:i.toString()}),e.caption&&(0,m.jsx)(g,{"data-testid":"caption",style:w,children:` ${e.caption} `})]},i)}))})}))},24875:()=>{}}]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";(globalThis.webpackChunk_stlite_desktop=globalThis.webpackChunk_stlite_desktop||[]).push([[3392],{23392:(t,e,i)=>{i.r(e),i.d(e,{default:()=>a});var s=i(5057),l=i(85493),n=i(92445),r=i(46540),d=i(22199),o=i(
|
|
1
|
+
"use strict";(globalThis.webpackChunk_stlite_desktop=globalThis.webpackChunk_stlite_desktop||[]).push([[3392],{23392:(t,e,i)=>{i.r(e),i.d(e,{default:()=>a});var s=i(5057),l=i(85493),n=i(92445),r=i(46540),d=i(22199),o=i(60735),u=i(96266);const a=function(t){const{disabled:e,element:i,widgetMgr:a,width:c}=t,h={width:c},{getBaseUriParts:b}=(0,s.useContext)(l.Z),k=(0,o.v_)();return(0,u.jsx)("div",{className:"row-widget stDownloadButton",style:h,children:(0,u.jsx)(n.uD,{help:i.help,children:(0,u.jsx)(n.ZP,{kind:n.hY.SECONDARY,size:n.$u.SMALL,disabled:e,onClick:()=>{if(a.setTriggerValue(i,{fromUi:!0}),i.url.startsWith("/media"))return void(0,o.uP)(k,i.url);const t=document.createElement("a"),e=`${(0,d.Bz)(i.url,b())}?title=${encodeURIComponent(document.title)}`;t.setAttribute("href",e),t.setAttribute("target","_blank"),t.click()},fluidWidth:i.useContainerWidth||!1,children:(0,u.jsx)(r.Z,{source:i.label,allowHTML:!1,isButton:!0})})})})}}}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(()=>{"use strict";var e={56977:e=>{function t(e){if("string"!==typeof e)throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}function n(e,t){for(var n,r="",o=0,i=-1,s=0,a=0;a<=e.length;++a){if(a<e.length)n=e.charCodeAt(a);else{if(47===n)break;n=47}if(47===n){if(i===a-1||1===s);else if(i!==a-1&&2===s){if(r.length<2||2!==o||46!==r.charCodeAt(r.length-1)||46!==r.charCodeAt(r.length-2))if(r.length>2){var l=r.lastIndexOf("/");if(l!==r.length-1){-1===l?(r="",o=0):o=(r=r.slice(0,l)).length-1-r.lastIndexOf("/"),i=a,s=0;continue}}else if(2===r.length||1===r.length){r="",o=0,i=a,s=0;continue}t&&(r.length>0?r+="/..":r="..",o=2)}else r.length>0?r+="/"+e.slice(i+1,a):r=e.slice(i+1,a),o=a-i-1;i=a,s=0}else 46===n&&-1!==s?++s:s=-1}return r}var r={resolve:function(){for(var e,r="",o=!1,i=arguments.length-1;i>=-1&&!o;i--){var s;i>=0?s=arguments[i]:(void 0===e&&(e=process.cwd()),s=e),t(s),0!==s.length&&(r=s+"/"+r,o=47===s.charCodeAt(0))}return r=n(r,!o),o?r.length>0?"/"+r:"/":r.length>0?r:"."},normalize:function(e){if(t(e),0===e.length)return".";var r=47===e.charCodeAt(0),o=47===e.charCodeAt(e.length-1);return 0!==(e=n(e,!r)).length||r||(e="."),e.length>0&&o&&(e+="/"),r?"/"+e:e},isAbsolute:function(e){return t(e),e.length>0&&47===e.charCodeAt(0)},join:function(){if(0===arguments.length)return".";for(var e,n=0;n<arguments.length;++n){var o=arguments[n];t(o),o.length>0&&(void 0===e?e=o:e+="/"+o)}return void 0===e?".":r.normalize(e)},relative:function(e,n){if(t(e),t(n),e===n)return"";if((e=r.resolve(e))===(n=r.resolve(n)))return"";for(var o=1;o<e.length&&47===e.charCodeAt(o);++o);for(var i=e.length,s=i-o,a=1;a<n.length&&47===n.charCodeAt(a);++a);for(var l=n.length-a,c=s<l?s:l,d=-1,g=0;g<=c;++g){if(g===c){if(l>c){if(47===n.charCodeAt(a+g))return n.slice(a+g+1);if(0===g)return n.slice(a+g)}else s>c&&(47===e.charCodeAt(o+g)?d=g:0===g&&(d=0));break}var u=e.charCodeAt(o+g);if(u!==n.charCodeAt(a+g))break;47===u&&(d=g)}var f="";for(g=o+d+1;g<=i;++g)g!==i&&47!==e.charCodeAt(g)||(0===f.length?f+="..":f+="/..");return f.length>0?f+n.slice(a+d):(a+=d,47===n.charCodeAt(a)&&++a,n.slice(a))},_makeLong:function(e){return e},dirname:function(e){if(t(e),0===e.length)return".";for(var n=e.charCodeAt(0),r=47===n,o=-1,i=!0,s=e.length-1;s>=1;--s)if(47===(n=e.charCodeAt(s))){if(!i){o=s;break}}else i=!1;return-1===o?r?"/":".":r&&1===o?"//":e.slice(0,o)},basename:function(e,n){if(void 0!==n&&"string"!==typeof n)throw new TypeError('"ext" argument must be a string');t(e);var r,o=0,i=-1,s=!0;if(void 0!==n&&n.length>0&&n.length<=e.length){if(n.length===e.length&&n===e)return"";var a=n.length-1,l=-1;for(r=e.length-1;r>=0;--r){var c=e.charCodeAt(r);if(47===c){if(!s){o=r+1;break}}else-1===l&&(s=!1,l=r+1),a>=0&&(c===n.charCodeAt(a)?-1===--a&&(i=r):(a=-1,i=l))}return o===i?i=l:-1===i&&(i=e.length),e.slice(o,i)}for(r=e.length-1;r>=0;--r)if(47===e.charCodeAt(r)){if(!s){o=r+1;break}}else-1===i&&(s=!1,i=r+1);return-1===i?"":e.slice(o,i)},extname:function(e){t(e);for(var n=-1,r=0,o=-1,i=!0,s=0,a=e.length-1;a>=0;--a){var l=e.charCodeAt(a);if(47!==l)-1===o&&(i=!1,o=a+1),46===l?-1===n?n=a:1!==s&&(s=1):-1!==n&&(s=-1);else if(!i){r=a+1;break}}return-1===n||-1===o||0===s||1===s&&n===o-1&&n===r+1?"":e.slice(n,o)},format:function(e){if(null===e||"object"!==typeof e)throw new TypeError('The "pathObject" argument must be of type Object. Received type '+typeof e);return function(e,t){var n=t.dir||t.root,r=t.base||(t.name||"")+(t.ext||"");return n?n===t.root?n+r:n+e+r:r}("/",e)},parse:function(e){t(e);var n={root:"",dir:"",base:"",ext:"",name:""};if(0===e.length)return n;var r,o=e.charCodeAt(0),i=47===o;i?(n.root="/",r=1):r=0;for(var s=-1,a=0,l=-1,c=!0,d=e.length-1,g=0;d>=r;--d)if(47!==(o=e.charCodeAt(d)))-1===l&&(c=!1,l=d+1),46===o?-1===s?s=d:1!==g&&(g=1):-1!==s&&(g=-1);else if(!c){a=d+1;break}return-1===s||-1===l||0===g||1===g&&s===l-1&&s===a+1?-1!==l&&(n.base=n.name=0===a&&i?e.slice(1,l):e.slice(a,l)):(0===a&&i?(n.name=e.slice(1,s),n.base=e.slice(1,l)):(n.name=e.slice(a,s),n.base=e.slice(a,l)),n.ext=e.slice(s,l)),a>0?n.dir=e.slice(0,a-1):i&&(n.dir="/"),n},sep:"/",delimiter:":",win32:null,posix:null};r.posix=r,e.exports=r}},t={};function n(r){var o=t[r];if(void 0!==o)return o.exports;var i=t[r]={exports:{}};return e[r](i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{var e;!function(e){function t(e){return null===e||"boolean"===typeof e||"number"===typeof e||"string"===typeof e}function n(e){return Array.isArray(e)}function r(e,o){if(e===o)return!0;if(t(e)||t(o))return!1;var i=n(e),s=n(o);return i===s&&(i&&s?function(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(var n=0,o=e.length;n<o;++n)if(!r(e[n],t[n]))return!1;return!0}(e,o):function(e,t){if(e===t)return!0;for(var n in e)if(void 0!==e[n]&&!(n in t))return!1;for(var n in t)if(void 0!==t[n]&&!(n in e))return!1;for(var n in e){var o=e[n],i=t[n];if(void 0!==o||void 0!==i){if(void 0===o||void 0===i)return!1;if(!r(o,i))return!1}}return!0}(e,o))}function o(e){return t(e)?e:n(e)?function(e){for(var t=new Array(e.length),n=0,r=e.length;n<r;++n)t[n]=o(e[n]);return t}(e):function(e){var t={};for(var n in e){var r=e[n];void 0!==r&&(t[n]=o(r))}return t}(e)}e.emptyObject=Object.freeze({}),e.emptyArray=Object.freeze([]),e.isPrimitive=t,e.isArray=n,e.isObject=function(e){return!t(e)&&!n(e)},e.deepEqual=r,e.deepCopy=o}(e||(e={}));!function(){function e(){this._types=[],this._values=[]}e.prototype.types=function(){return this._types.slice()},e.prototype.hasData=function(e){return-1!==this._types.indexOf(e)},e.prototype.getData=function(e){var t=this._types.indexOf(e);return-1!==t?this._values[t]:void 0},e.prototype.setData=function(e,t){this.clearData(e),this._types.push(e),this._values.push(t)},e.prototype.clearData=function(e){var t=this._types.indexOf(e);-1!==t&&(this._types.splice(t,1),this._values.splice(t,1))},e.prototype.clear=function(){this._types.length=0,this._values.length=0}}();var t,r,o=function(){function e(){var e=this;this.promise=new Promise((function(t,n){e._resolve=t,e._reject=n}))}return e.prototype.resolve=function(e){(0,this._resolve)(e)},e.prototype.reject=function(e){(0,this._reject)(e)},e}();function i(e){for(var t=0,n=0,r=e.length;n<r;++n)n%4===0&&(t=4294967295*Math.random()>>>0),e[n]=255&t,t>>>=8}!function(e){e.getRandomValues=function(){var e="undefined"!==typeof window&&(window.crypto||window.msCrypto)||null;return e&&"function"===typeof e.getRandomValues?function(t){return e.getRandomValues(t)}:i}()}(t||(t={})),function(e){e.uuid4=function(e){for(var t=new Uint8Array(16),n=new Array(256),r=0;r<16;++r)n[r]="0"+r.toString(16);for(r=16;r<256;++r)n[r]=r.toString(16);return function(){return e(t),t[6]=64|15&t[6],t[8]=128|63&t[8],n[t[0]]+n[t[1]]+n[t[2]]+n[t[3]]+"-"+n[t[4]]+n[t[5]]+"-"+n[t[6]]+n[t[7]]+"-"+n[t[8]]+n[t[9]]+"-"+n[t[10]]+n[t[11]]+n[t[12]]+n[t[13]]+n[t[14]]+n[t[15]]}}(t.getRandomValues)}(r||(r={}));var s=n(56977),a=n.n(s);function l(e,t){const n=a().normalize(t),r=a().dirname(n).split("/"),o=[];for(const s of r){o.push(s);const t=o.join("/");if(e.FS.analyzePath(t).exists){if(e.FS.isDir(t))throw new Error(`"${t}" already exists and is not a directory.`)}else try{e.FS.mkdir(t)}catch(i){throw console.error(`Failed to create a directory "${t}"`),i}}}function c(e,t,n,r){l(e,t),e.FS.writeFile(t,n,r)}function d(e){e.forEach((e=>{let t;try{t=new URL(e)}catch(n){return}if("emfs:"===t.protocol||"file:"===t.protocol)throw new Error(`"emfs:" and "file:" protocols are not allowed for the requirement (${e})`)}))}var g=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{l(r.next(e))}catch(t){i(t)}}function a(e){try{l(r.throw(e))}catch(t){i(t)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}l((r=r.apply(e,t||[])).next())}))};let u,f;const p=self,h=new o;function y(e){p.postMessage({type:"event:progress",data:{message:e}})}const m=function(){return g(this,void 0,void 0,(function*(){const{entrypoint:e,files:t,requirements:n,wheels:r,mountedSitePackagesSnapshotFilePath:o,pyodideEntrypointUrl:i}=yield h.promise;if(y("Loading Pyodide."),console.debug("Import the entrypoint script."),importScripts(null!==i&&void 0!==i?i:"https://cdn.jsdelivr.net/pyodide/v0.22.1/full/pyodide.js"),console.debug("Loading Pyodide"),u=yield loadPyodide({stdout:console.log,stderr:console.error}),console.debug("Loaded Pyodide"),y("Mounting files."),Object.keys(t).forEach((e=>{const{data:n,opts:r}=t[e];console.debug(`Write a file "${e}"`),c(u,e,n,r)})),o)y("Restoring the snapshot."),yield u.runPythonAsync("import tarfile, shutil, site"),yield u.runPythonAsync("\n site_packages_dirs = site.getsitepackages()\n for site_packages in site_packages_dirs:\n shutil.rmtree(site_packages)\n "),console.debug(`Unarchive ${o}`),yield u.runPythonAsync(`\n with tarfile.open("${o}", "r") as tar_gz_file:\n tar_gz_file.extractall("/")\n `),console.debug("Restored the snapshot");else{if(!r)throw new Error("Neither snapshot nor wheel files are provided.");{y("Installing streamlit and its dependencies."),console.debug("Loading pyarrow, stlite-server, and streamlit"),yield u.loadPackage("micropip");const e=u.pyimport("micropip");yield e.install.callKwargs([r.pyarrow,r.stliteServer],{keep_going:!0}),yield e.install.callKwargs([r.streamlit],{keep_going:!0}),console.debug("Loaded pyarrow, stlite-server, and streamlit"),y("Installing the requirements."),console.debug("Installing the requirements:",n),d(n),yield e.install.callKwargs(n,{keep_going:!0}),console.debug("Installed the requirements:",n)}}yield u.runPythonAsync("\n import importlib\n importlib.invalidate_caches()\n "),y("Loading streamlit package."),console.debug("Loading the Streamlit package"),yield u.runPythonAsync("\n import streamlit.runtime\n import streamlit.web\n "),console.debug("Loaded the Streamlit package"),y("Setting up the loggers."),console.debug("Setting the loggers"),yield u.runPythonAsync("\n import logging\n import streamlit.logger\n\n streamlit.logger.get_logger = logging.getLogger\n streamlit.logger.setup_formatter = None\n streamlit.logger.update_formatter = lambda *a, **k: None\n streamlit.logger.set_log_level = lambda *a, **k: None\n ");self.__logCallback__=e=>{e.startsWith("CRITICAL")||e.startsWith("ERROR")?console.error(e):e.startsWith("WARNING")?console.warn(e):e.startsWith("INFO")?console.info(e):e.startsWith("DEBUG")?console.debug(e):console.log(e)},yield u.runPythonAsync('\n from js import __logCallback__\n\n\n class JsHandler(logging.Handler):\n def emit(self, record):\n msg = self.format(record)\n __logCallback__(msg)\n\n\n main_formatter = logging.Formatter("%(levelname)s:%(name)s:%(message)s")\n\n js_handler = JsHandler()\n js_handler.setFormatter(main_formatter)\n\n root_logger = logging.getLogger()\n root_logger.handlers.clear()\n root_logger.addHandler(js_handler)\n root_logger.setLevel(logging.DEBUG)\n\n streamlit_handler = logging.getLogger("streamlit")\n streamlit_handler.setLevel(logging.DEBUG)\n '),console.debug("Set the loggers"),y("Mocking some Streamlit functions for the browser environment."),console.debug("Mocking some Streamlit functions"),yield u.runPythonAsync("\n import streamlit\n import contextlib\n\n @contextlib.contextmanager\n def spinner(*args, **kwargs):\n yield\n\n streamlit.spinner = spinner\n streamlit.runtime.caching.cache_utils.spinner = spinner\n streamlit.runtime.legacy_caching.caching.spinner = spinner\n "),console.debug("Mocked some Streamlit functions"),y("Booting up the Streamlit server."),console.debug("Booting up the Streamlit server"),yield u.runPythonAsync(`\n from stlite_server.bootstrap import load_config_options, prepare\n from stlite_server.server import Server\n\n load_config_options({\n "global.dataFrameSerialization": "legacy", # Not to use PyArrow\n "browser.gatherUsageStats": False,\n })\n\n main_script_path = "${e}"\n command_line = None\n args = []\n\n prepare(main_script_path, args)\n\n server = Server(main_script_path, command_line)\n server.start()\n `),console.debug("Booted up the Streamlit server"),console.debug("Setting up the HTTP server"),f=u.globals.get("server").copy(),console.debug("Set up the HTTP server"),p.postMessage({type:"event:loaded"})}))}().catch((e=>{throw p.postMessage({type:"event:error",data:{error:e}}),e}));self.onmessage=e=>g(void 0,void 0,void 0,(function*(){const t=e.data;if("initData"===t.type)return void h.resolve(t.data);yield m;const n=e.ports[0];try{switch(t.type){case"websocket:connect":{console.debug("websocket:connect",t.data);const{path:e}=t.data;f.start_websocket(e,((e,t)=>{if(t){const t=e.getBuffer("u8");e.destroy();const n=new Uint8ClampedArray(t.data.buffer,t.data.byteOffset,t.data.byteLength);p.postMessage({type:"websocket:message",data:{payload:new Uint8Array(n)}})}else p.postMessage({type:"websocket:message",data:{payload:e}})})),n.postMessage({type:"reply"});break}case"websocket:send":{console.debug("websocket:send",t.data);const{payload:e}=t.data;f.receive_websocket_from_js(e);break}case"http:request":{console.debug("http:request",t.data);const{request:e}=t.data,r=(e,t,r)=>{const o=t.toJs(),i=r.toJs();console.debug({statusCode:e,headers:o,body:i});const s={type:"http:response",data:{response:{statusCode:e,headers:o,body:i}}};n.postMessage(s)};f.receive_http_from_js(e.method,e.path,e.headers,e.body,r);break}case"file:write":{const{path:e,data:r,opts:o}=t.data;console.debug(`Write a file "${e}"`),c(u,e,r,o),n.postMessage({type:"reply"});break}case"file:rename":{const{oldPath:e,newPath:r}=t.data;console.debug(`Rename "${e}" to ${r}`),function(e,t,n){l(e,n),e.FS.rename(t,n)}(u,e,r),n.postMessage({type:"reply"});break}case"file:unlink":{const{path:e}=t.data;console.debug(`Remove "${e}`),u.FS.unlink(e),n.postMessage({type:"reply"});break}case"install":{const{requirements:e}=t.data,r=u.pyimport("micropip");console.debug("Install the requirements:",e),d(e),yield r.install.callKwargs(e,{keep_going:!0}).then((()=>{if(e.includes("matplotlib"))return u.runPythonAsync("\n bootstrap._fix_matplotlib_crash()\n ")})).then((()=>{console.debug("Successfully installed"),n.postMessage({type:"reply"})}))}}}catch(r){n.postMessage({type:"reply",error:r})}})),p.postMessage({type:"event:start"})})()})();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";(globalThis.webpackChunk_stlite_desktop=globalThis.webpackChunk_stlite_desktop||[]).push([[9462],{69462:(t,e,s)=>{s.r(e),s.d(e,{default:()=>n});var r=s(5057),u=s(85493),i=s(22199),a=s(
|
|
1
|
+
"use strict";(globalThis.webpackChunk_stlite_desktop=globalThis.webpackChunk_stlite_desktop||[]).push([[9462],{69462:(t,e,s)=>{s.r(e),s.d(e,{default:()=>n});var r=s(5057),u=s(85493),i=s(22199),a=s(60735),l=s(96266);function n({element:t,width:e}){const s=(0,r.useRef)(null),{getBaseUriParts:n}=(0,r.useContext)(u.Z);(0,r.useEffect)((()=>{s.current&&(s.current.currentTime=t.startTime)}),[t.startTime]);const c=(0,a.O0)(t.url),o=(0,i.Bz)(c,n());return(0,l.jsx)("audio",{id:"audio",ref:s,controls:!0,src:o,className:"stAudio",style:{width:e}})}}}]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";(globalThis.webpackChunk_stlite_desktop=globalThis.webpackChunk_stlite_desktop||[]).push([[9551],{29551:(e,t,r)=>{r.r(t),r.d(t,{default:()=>c});var s=r(5057),a=r(85493),n=r(32291),i=r(22199),l=r(
|
|
1
|
+
"use strict";(globalThis.webpackChunk_stlite_desktop=globalThis.webpackChunk_stlite_desktop||[]).push([[9551],{29551:(e,t,r)=>{r.r(t),r.d(t,{default:()=>c});var s=r(5057),a=r(85493),n=r(32291),i=r(22199),l=r(60735),o=r(96266);const d=528;function c({element:e,width:t}){const r=(0,s.useRef)(null),{getBaseUriParts:c}=(0,s.useContext)(a.Z),{type:u,url:h}=e,m=(0,l.O0)(h);(0,s.useEffect)((()=>{const t=r.current,s=()=>{t&&(t.currentTime=e.startTime)};return t&&t.addEventListener("loadedmetadata",s),()=>{t&&t.removeEventListener("loadedmetadata",s)}}),[e]);const f=t=>{const{startTime:r}=e;return r?`${t}?start=${r}`:t};if(u===n.nk.Type.YOUTUBE_IFRAME){const e=0!==t?.75*t:d;return(0,o.jsx)("iframe",{title:m,src:f(m),width:t,height:e,frameBorder:"0",allow:"autoplay; encrypted-media",allowFullScreen:!0})}return(0,o.jsx)("video",{ref:r,controls:!0,src:(0,i.Bz)(m,c()),className:"stVideo",style:{width:t,height:0===t?d:void 0}})}}}]);
|