@stlite/desktop 0.27.1 → 0.27.2

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.
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
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,"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(`
2
+ var O=Object.create;var h=Object.defineProperty;var P=Object.getOwnPropertyDescriptor;var $=Object.getOwnPropertyNames;var j=Object.getPrototypeOf,F=Object.prototype.hasOwnProperty;var g=(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&&h(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?h(r,"default",{value:e,enumerable:!0}):r,e));var w=g(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 v=g(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(w(),c)});var D=n(require("yargs")),b=require("yargs/helpers"),a=n(require("path")),s=n(require("fs/promises")),m=n(require("fs-extra")),f=n(require("node-fetch")),k=require("pyodide"),T=n(v());global.fetch=f.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 m.default.copy(t,e.copyTo)}async function _(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"),l=`emfs:${i}`;console.log(`Install ${l}`),await o.install.callKwargs(l,{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 l=a.default.dirname(require.resolve("@stlite/kernel")),p=a.default.resolve(l,"../py");await _(t,a.default.join(p,"stlite-server/dist/stlite_server-0.1.0-py3-none-any.whl")),await _(t,a.default.join(p,"streamlit/lib/dist/streamlit-1.18.1-py2.py3-none-any.whl"))}else{let p=require(a.default.resolve(__dirname,"../package.json")).version,S=`https://data.jsdelivr.com/v1/package/npm/@stlite/kernel@${p}/flat`,y=(await(await(0,f.default)(S)).json()).files.filter(d=>d.name.endsWith(".whl")).map(d=>`https://cdn.jsdelivr.net/npm/@stlite/kernel@${p}${d.name}`),q=t.pyimport("micropip");console.log("Install",y),await q.install.callKwargs(y,{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
 
@@ -10,4 +10,4 @@ var O=Object.create;var g=Object.defineProperty;var P=Object.getOwnPropertyDescr
10
10
  with tarfile.open(tar_file_name, mode='w:gz') as gzf:
11
11
  for site_packages in site_packages_dirs:
12
12
  gzf.add(site_packages)
13
- `),console.log("Extract the archive file from EMFS");let o=t.FS.readFile(i);console.log(`Save the archive file (${e.saveTo})`),await s.default.writeFile(e.saveTo,o)}async function H(e){console.info("Copy the Streamlit app directory..."),console.log(`Copy ${e.sourceDir} to ${e.copyTo}`),await s.default.rm(e.copyTo,{recursive:!0,force:!0}),await f.default.copy(e.sourceDir,e.copyTo)}async function W(e){let t=await s.default.readFile(e,{encoding:"utf-8"});return(0,T.parseRequirementsTxt)(t)}function I(e){e.forEach(t=>{let r;try{r=new URL(t)}catch{return}if(r.protocol==="emfs:"||r.protocol==="file:")throw new Error(`"emfs:" and "file:" protocols are not allowed for the requirement (${t})`)})}(0,D.default)((0,b.hideBin)(process.argv)).command("* <appHomeDirSource> [packages..]","Put the user code and data and the snapshot of the required packages into the build artifact.",()=>{},e=>{console.info(e)}).positional("appHomeDirSource",{describe:"The source directory of the user code and data that will be mounted in the Pyodide file system at app runtime",type:"string",demandOption:!0}).positional("packages",{describe:"Package names to install.",type:"string",array:!0}).options("requirement",{describe:"Install from the given requirements file. This option can be used multiple times.",array:!0,type:"string",alias:"r",default:[]}).options("localKernelWheels",{describe:"Use the locally installed kernel wheels",type:"boolean",alias:"l",default:!1}).options("keepOldBuild",{type:"boolean",default:!1,alias:"k",describe:"Keep the existing build directory contents except appHomeDir."}).parseAsync().then(async e=>{let t=a.default.resolve(process.cwd(),"./build");try{await s.default.access(e.appHomeDirSource)}catch{throw new Error(`${e.appHomeDirSource} does not exist.`)}let r=e.packages;for(let i of e.requirement)r=r.concat(await W(i));I(r),await B({copyTo:t,keepOld:e.keepOldBuild}),await E({useLocalKernelWheels:e.localKernelWheels,requirements:r,saveTo:a.default.resolve(t,"./site-packages-snapshot.tar.gz")}),await H({sourceDir:e.appHomeDirSource,copyTo:a.default.resolve(t,"./streamlit_app")})});
13
+ `),console.log("Extract the archive file from EMFS");let o=t.FS.readFile(i);console.log(`Save the archive file (${e.saveTo})`),await s.default.writeFile(e.saveTo,o)}async function H(e){console.info("Copy the Streamlit app directory..."),console.log(`Copy ${e.sourceDir} to ${e.copyTo}`),await s.default.rm(e.copyTo,{recursive:!0,force:!0}),await m.default.copy(e.sourceDir,e.copyTo)}async function W(e){let t=await s.default.readFile(e,{encoding:"utf-8"});return(0,T.parseRequirementsTxt)(t)}function I(e){e.forEach(t=>{let r;try{r=new URL(t)}catch{return}if(r.protocol==="emfs:"||r.protocol==="file:")throw new Error(`"emfs:" and "file:" protocols are not allowed for the requirement (${t})`)})}(0,D.default)((0,b.hideBin)(process.argv)).command("* <appHomeDirSource> [packages..]","Put the user code and data and the snapshot of the required packages into the build artifact.",()=>{},e=>{console.info(e)}).positional("appHomeDirSource",{describe:"The source directory of the user code and data that will be mounted in the Pyodide file system at app runtime",type:"string",demandOption:!0}).positional("packages",{describe:"Package names to install.",type:"string",array:!0}).options("requirement",{describe:"Install from the given requirements file. This option can be used multiple times.",array:!0,type:"string",alias:"r",default:[]}).options("localKernelWheels",{describe:"Use the locally installed kernel wheels",type:"boolean",alias:"l",default:!1}).options("keepOldBuild",{type:"boolean",default:!1,alias:"k",describe:"Keep the existing build directory contents except appHomeDir."}).parseAsync().then(async e=>{let t=a.default.resolve(process.cwd(),"./build");try{await s.default.access(e.appHomeDirSource)}catch{throw new Error(`${e.appHomeDirSource} does not exist.`)}let r=e.packages;for(let i of e.requirement)r=r.concat(await W(i));I(r),await B({copyTo:t,keepOld:e.keepOldBuild}),await E({useLocalKernelWheels:e.localKernelWheels,requirements:r,saveTo:a.default.resolve(t,"./site-packages-snapshot.tar.gz")}),await H({sourceDir:e.appHomeDirSource,copyTo:a.default.resolve(t,"./streamlit_app")})});
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "files": {
3
3
  "main.css": "/static/css/main.b43a24ba.css",
4
- "main.js": "/static/js/main.d1e80a13.js",
5
- "static/js/6391.77507fb7.chunk.js": "/static/js/6391.77507fb7.chunk.js",
4
+ "main.js": "/static/js/main.ae72fb3d.js",
5
+ "static/js/7073.08b496aa.chunk.js": "/static/js/7073.08b496aa.chunk.js",
6
6
  "static/js/4994.8f0118ec.chunk.js": "/static/js/4994.8f0118ec.chunk.js",
7
- "static/js/9462.e56f97b3.chunk.js": "/static/js/9462.e56f97b3.chunk.js",
7
+ "static/js/9462.1c932557.chunk.js": "/static/js/9462.1c932557.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.13f2d6fb.chunk.js": "/static/js/2632.13f2d6fb.chunk.js",
18
+ "static/js/2632.6fe5e4a8.chunk.js": "/static/js/2632.6fe5e4a8.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.f4ae413b.chunk.js": "/static/js/9551.f4ae413b.chunk.js",
21
+ "static/js/9551.61e47ac7.chunk.js": "/static/js/9551.61e47ac7.chunk.js",
22
22
  "static/js/7937.a3bc5cdb.chunk.js": "/static/js/7937.a3bc5cdb.chunk.js",
23
- "static/js/3392.5f81677b.chunk.js": "/static/js/3392.5f81677b.chunk.js",
23
+ "static/js/3392.0d6a4b1f.chunk.js": "/static/js/3392.0d6a4b1f.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",
@@ -147,11 +147,10 @@
147
147
  "static/media/KaTeX_Size3-Regular.woff": "/static/media/KaTeX_Size3-Regular.7947224e8a9914fa332b.woff",
148
148
  "static/media/KaTeX_Size3-Regular.woff2": "/static/media/KaTeX_Size3-Regular.e1951519f6f0596f7356.woff2",
149
149
  "static/media/icon_running.gif": "/static/media/icon_running.de1119daebe465fa5263.gif",
150
- "pypi/stlite_pyarrow-0.1.0-py3-none-any.whl": "/pypi/stlite_pyarrow-0.1.0-py3-none-any.whl",
151
150
  "index.html": "/index.html"
152
151
  },
153
152
  "entrypoints": [
154
153
  "static/css/main.b43a24ba.css",
155
- "static/js/main.d1e80a13.js"
154
+ "static/js/main.ae72fb3d.js"
156
155
  ]
157
156
  }
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.d1e80a13.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
+ <!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.ae72fb3d.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(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
+ (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(84584),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(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})})})})}}}]);
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(84584),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,s=-1,i=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(s===a-1||1===i);else if(s!==a-1&&2===i){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("/"),s=a,i=0;continue}}else if(2===r.length||1===r.length){r="",o=0,s=a,i=0;continue}t&&(r.length>0?r+="/..":r="..",o=2)}else r.length>0?r+="/"+e.slice(s+1,a):r=e.slice(s+1,a),o=a-s-1;s=a,i=0}else 46===n&&-1!==i?++i:i=-1}return r}var r={resolve:function(){for(var e,r="",o=!1,s=arguments.length-1;s>=-1&&!o;s--){var i;s>=0?i=arguments[s]:(void 0===e&&(e=process.cwd()),i=e),t(i),0!==i.length&&(r=i+"/"+r,o=47===i.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 s=e.length,i=s-o,a=1;a<n.length&&47===n.charCodeAt(a);++a);for(var l=n.length-a,c=i<l?i: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 i>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 p="";for(g=o+d+1;g<=s;++g)g!==s&&47!==e.charCodeAt(g)||(0===p.length?p+="..":p+="/..");return p.length>0?p+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,s=!0,i=e.length-1;i>=1;--i)if(47===(n=e.charCodeAt(i))){if(!s){o=i;break}}else s=!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,s=-1,i=!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(!i){o=r+1;break}}else-1===l&&(i=!1,l=r+1),a>=0&&(c===n.charCodeAt(a)?-1===--a&&(s=r):(a=-1,s=l))}return o===s?s=l:-1===s&&(s=e.length),e.slice(o,s)}for(r=e.length-1;r>=0;--r)if(47===e.charCodeAt(r)){if(!i){o=r+1;break}}else-1===s&&(i=!1,s=r+1);return-1===s?"":e.slice(o,s)},extname:function(e){t(e);for(var n=-1,r=0,o=-1,s=!0,i=0,a=e.length-1;a>=0;--a){var l=e.charCodeAt(a);if(47!==l)-1===o&&(s=!1,o=a+1),46===l?-1===n?n=a:1!==i&&(i=1):-1!==n&&(i=-1);else if(!s){r=a+1;break}}return-1===n||-1===o||0===i||1===i&&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),s=47===o;s?(n.root="/",r=1):r=0;for(var i=-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===i?i=d:1!==g&&(g=1):-1!==i&&(g=-1);else if(!c){a=d+1;break}return-1===i||-1===l||0===g||1===g&&i===l-1&&i===a+1?-1!==l&&(n.base=n.name=0===a&&s?e.slice(1,l):e.slice(a,l)):(0===a&&s?(n.name=e.slice(1,i),n.base=e.slice(1,l)):(n.name=e.slice(a,i),n.base=e.slice(a,l)),n.ext=e.slice(i,l)),a>0?n.dir=e.slice(0,a-1):s&&(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 s=t[r]={exports:{}};return e[r](s,s.exports,n),s.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 s=n(e),i=n(o);return s===i&&(s&&i?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],s=t[n];if(void 0!==o||void 0!==s){if(void 0===o||void 0===s)return!1;if(!r(o,s))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 s(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)}:s}()}(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 i=n(56977),a=n.n(i);function l(e,t){const n=a().normalize(t),r=a().dirname(n).split("/"),o=[];for(const i of r){o.push(i);const t=o.join("/");if(e.FS.analyzePath(t).exists){if(e.FS.isDir(t))throw new Error(`"${t}" already exists and is not a directory.`)}else try{e.FS.mkdir(t)}catch(s){throw console.error(`Failed to create a directory "${t}"`),s}}}function c(e,t,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})`)}))}function g(e){e.runPython('\nimport micropip\nmicropip.add_mock_package(\n "pyarrow", "0.0.1",\n modules={\n "pyarrow": """\n__version__ = \'0.0.1\' # TODO: Update when releasing\n\n\nclass Table:\n @classmethod\n def from_pandas(*args, **kwargs):\n raise NotImplementedError("stlite is not supporting this method.")\n"""\n }\n)\n')}var u=function(e,t,n,r){return new(n||(n=Promise))((function(o,s){function i(e){try{l(r.next(e))}catch(t){s(t)}}function a(e){try{l(r.throw(e))}catch(t){s(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(i,a)}l((r=r.apply(e,t||[])).next())}))};let p,f;const h=self,m=new o;function y(e){h.postMessage({type:"event:progress",data:{message:e}})}const v=function(){return u(this,void 0,void 0,(function*(){const{entrypoint:e,files:t,requirements:n,wheels:r,mountedSitePackagesSnapshotFilePath:o,pyodideEntrypointUrl:s}=yield m.promise;if(y("Loading Pyodide."),console.debug("Import the entrypoint script."),importScripts(null!==s&&void 0!==s?s:"https://cdn.jsdelivr.net/pyodide/v0.22.1/full/pyodide.js"),console.debug("Loading Pyodide"),p=yield loadPyodide({stdout:console.log,stderr:console.error}),console.debug("Loaded Pyodide"),y("Mounting files."),Object.keys(t).forEach((e=>{const{data:n,opts:r}=t[e];console.debug(`Write a file "${e}"`),c(p,e,n,r)})),o)y("Restoring the snapshot."),yield p.runPythonAsync("import tarfile, shutil, site"),yield p.runPythonAsync("\n site_packages_dirs = site.getsitepackages()\n for site_packages in site_packages_dirs:\n shutil.rmtree(site_packages)\n "),console.debug(`Unarchive ${o}`),yield p.runPythonAsync(`\n with tarfile.open("${o}", "r") as tar_gz_file:\n tar_gz_file.extractall("/")\n `),console.debug("Restored the snapshot"),y("Mocking some packages."),console.debug("Mock pyarrow"),g(p),console.debug("Mocked pyarrow");else{if(!r)throw new Error("Neither snapshot nor wheel files are provided.");{y("Installing streamlit and its dependencies."),console.debug("Loading stlite-server, and streamlit"),yield p.loadPackage("micropip");const e=p.pyimport("micropip");yield e.install.callKwargs([r.stliteServer],{keep_going:!0}),yield e.install.callKwargs([r.streamlit],{keep_going:!0}),console.debug("Loaded stlite-server, and streamlit"),y("Mocking some packages."),console.debug("Mock pyarrow"),g(p),console.debug("Mocked pyarrow"),y("Installing the requirements."),console.debug("Installing the requirements:",n),d(n),yield e.install.callKwargs(n,{keep_going:!0}),console.debug("Installed the requirements:",n)}}yield p.runPythonAsync("\n import importlib\n importlib.invalidate_caches()\n "),y("Loading streamlit package."),console.debug("Loading the Streamlit package"),yield p.runPythonAsync("\n import streamlit.runtime\n import streamlit.web\n "),console.debug("Loaded the Streamlit package"),y("Setting up the loggers."),console.debug("Setting the loggers"),yield p.runPythonAsync("\n import logging\n import streamlit.logger\n\n streamlit.logger.get_logger = logging.getLogger\n streamlit.logger.setup_formatter = None\n streamlit.logger.update_formatter = lambda *a, **k: None\n streamlit.logger.set_log_level = lambda *a, **k: None\n ");self.__logCallback__=e=>{e.startsWith("CRITICAL")||e.startsWith("ERROR")?console.error(e):e.startsWith("WARNING")?console.warn(e):e.startsWith("INFO")?console.info(e):e.startsWith("DEBUG")?console.debug(e):console.log(e)},yield p.runPythonAsync('\n from js import __logCallback__\n\n\n class JsHandler(logging.Handler):\n def emit(self, record):\n msg = self.format(record)\n __logCallback__(msg)\n\n\n main_formatter = logging.Formatter("%(levelname)s:%(name)s:%(message)s")\n\n js_handler = JsHandler()\n js_handler.setFormatter(main_formatter)\n\n root_logger = logging.getLogger()\n root_logger.handlers.clear()\n root_logger.addHandler(js_handler)\n root_logger.setLevel(logging.DEBUG)\n\n streamlit_handler = logging.getLogger("streamlit")\n streamlit_handler.setLevel(logging.DEBUG)\n '),console.debug("Set the loggers"),y("Mocking some Streamlit functions for the browser environment."),console.debug("Mocking some Streamlit functions"),yield p.runPythonAsync("\n import streamlit\n 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 p.runPythonAsync(`\n from stlite_server.bootstrap import load_config_options, prepare\n from stlite_server.server import Server\n\n load_config_options({\n "global.dataFrameSerialization": "legacy", # Not to use PyArrow\n "browser.gatherUsageStats": False,\n })\n\n main_script_path = "${e}"\n command_line = None\n args = []\n\n prepare(main_script_path, args)\n\n server = Server(main_script_path, command_line)\n server.start()\n `),console.debug("Booted up the Streamlit server"),console.debug("Setting up the HTTP server"),f=p.globals.get("server").copy(),console.debug("Set up the HTTP server"),h.postMessage({type:"event:loaded"})}))}().catch((e=>{throw h.postMessage({type:"event:error",data:{error:e}}),e}));self.onmessage=e=>u(void 0,void 0,void 0,(function*(){const t=e.data;if("initData"===t.type)return void m.resolve(t.data);yield v;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);h.postMessage({type:"websocket:message",data:{payload:new Uint8Array(n)}})}else h.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(),s=r.toJs();console.debug({statusCode:e,headers:o,body:s});const i={type:"http:response",data:{response:{statusCode:e,headers:o,body:s}}};n.postMessage(i)};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(p,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)}(p,e,r),n.postMessage({type:"reply"});break}case"file:unlink":{const{path:e}=t.data;console.debug(`Remove "${e}`),p.FS.unlink(e),n.postMessage({type:"reply"});break}case"install":{const{requirements:e}=t.data,r=p.pyimport("micropip");console.debug("Install the requirements:",e),d(e),yield r.install.callKwargs(e,{keep_going:!0}).then((()=>{if(e.includes("matplotlib"))return p.runPythonAsync("\n from stlite_server.bootstrap import _fix_matplotlib_crash\n _fix_matplotlib_crash()\n ")})).then((()=>{console.debug("Successfully installed"),n.postMessage({type:"reply"})}))}}}catch(r){n.postMessage({type:"reply",error:r})}})),h.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(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
+ "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(84584),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(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}})}}}]);
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(84584),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}})}}}]);