From 1f3e4f7cc823b1c4cb0d4b3826eabd914c105e86 Mon Sep 17 00:00:00 2001 From: George Stagg Date: Sat, 4 Jan 2025 11:23:50 +0000 Subject: [PATCH] Upgrade Pyodide to 0.27.0 --- _extensions/live/live.lua | 2 +- _extensions/live/resources/pyodide-worker.js | 12 +++--------- live-runtime/package-lock.json | 16 +++++++++------- live-runtime/package.json | 2 +- 4 files changed, 14 insertions(+), 18 deletions(-) diff --git a/_extensions/live/live.lua b/_extensions/live/live.lua index 681d370..00ee5e7 100644 --- a/_extensions/live/live.lua +++ b/_extensions/live/live.lua @@ -528,7 +528,7 @@ function setupPyodide(doc) -- Initial Pyodide startup options local pyodide_options = { - indexURL = "https://cdn.jsdelivr.net/pyodide/v0.26.1/full/", + indexURL = "https://cdn.jsdelivr.net/pyodide/v0.27.0/full/", } if (pyodide["engine-url"]) then pyodide_options["indexURL"] = pandoc.utils.stringify(pyodide["engine-url"]) diff --git a/_extensions/live/resources/pyodide-worker.js b/_extensions/live/resources/pyodide-worker.js index e5ec99b..cf73dc8 100644 --- a/_extensions/live/resources/pyodide-worker.js +++ b/_extensions/live/resources/pyodide-worker.js @@ -1,12 +1,6 @@ -var je=Object.create;var U=Object.defineProperty;var Be=Object.getOwnPropertyDescriptor;var ze=Object.getOwnPropertyNames;var We=Object.getPrototypeOf,Ve=Object.prototype.hasOwnProperty;var x=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,r)=>(typeof require<"u"?require:t)[r]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var qe=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Ye=(e,t)=>{for(var r in t)U(e,r,{get:t[r],enumerable:!0})},Ge=(e,t,r,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of ze(t))!Ve.call(e,a)&&a!==r&&U(e,a,{get:()=>t[a],enumerable:!(o=Be(t,a))||o.enumerable});return e};var Je=(e,t,r)=>(r=e!=null?je(We(e)):{},Ge(t||!e||!e.__esModule?U(r,"default",{value:e,enumerable:!0}):r,e));var ae=qe(()=>{});var M={};Ye(M,{createEndpoint:()=>R,expose:()=>k,finalizer:()=>T,proxy:()=>I,proxyMarker:()=>B,releaseProxy:()=>ee,transfer:()=>oe,transferHandlers:()=>v,windowEndpoint:()=>nt,wrap:()=>A});var B=Symbol("Comlink.proxy"),R=Symbol("Comlink.endpoint"),ee=Symbol("Comlink.releaseProxy"),T=Symbol("Comlink.finalizer"),C=Symbol("Comlink.thrown"),te=e=>typeof e=="object"&&e!==null||typeof e=="function",Xe={canHandle:e=>te(e)&&e[B],serialize(e){let{port1:t,port2:r}=new MessageChannel;return k(e,t),[r,[r]]},deserialize(e){return e.start(),A(e)}},Ke={canHandle:e=>te(e)&&C in e,serialize({value:e}){let t;return e instanceof Error?t={isError:!0,value:{message:e.message,name:e.name,stack:e.stack}}:t={isError:!1,value:e},[t,[]]},deserialize(e){throw e.isError?Object.assign(new Error(e.value.message),e.value):e.value}},v=new Map([["proxy",Xe],["throw",Ke]]);function Qe(e,t){for(let r of e)if(t===r||r==="*"||r instanceof RegExp&&r.test(t))return!0;return!1}function k(e,t=globalThis,r=["*"]){t.addEventListener("message",function o(a){if(!a||!a.data)return;if(!Qe(r,a.origin)){console.warn(`Invalid origin '${a.origin}' for comlink proxy`);return}let{id:i,type:n,path:l}=Object.assign({path:[]},a.data),s=(a.data.argumentList||[]).map(E),u;try{let c=l.slice(0,-1).reduce((p,y)=>p[y],e),f=l.reduce((p,y)=>p[y],e);switch(n){case"GET":u=f;break;case"SET":c[l.slice(-1)[0]]=E(a.data.value),u=!0;break;case"APPLY":u=f.apply(c,s);break;case"CONSTRUCT":{let p=new f(...s);u=I(p)}break;case"ENDPOINT":{let{port1:p,port2:y}=new MessageChannel;k(e,y),u=oe(p,[p])}break;case"RELEASE":u=void 0;break;default:return}}catch(c){u={value:c,[C]:0}}Promise.resolve(u).catch(c=>({value:c,[C]:0})).then(c=>{let[f,p]=N(c);t.postMessage(Object.assign(Object.assign({},f),{id:i}),p),n==="RELEASE"&&(t.removeEventListener("message",o),re(t),T in e&&typeof e[T]=="function"&&e[T]())}).catch(c=>{let[f,p]=N({value:new TypeError("Unserializable return value"),[C]:0});t.postMessage(Object.assign(Object.assign({},f),{id:i}),p)})}),t.start&&t.start()}function Ze(e){return e.constructor.name==="MessagePort"}function re(e){Ze(e)&&e.close()}function A(e,t){return j(e,[],t)}function F(e){if(e)throw new Error("Proxy has been released and is not useable")}function ne(e){return P(e,{type:"RELEASE"}).then(()=>{re(e)})}var L=new WeakMap,_="FinalizationRegistry"in globalThis&&new FinalizationRegistry(e=>{let t=(L.get(e)||0)-1;L.set(e,t),t===0&&ne(e)});function et(e,t){let r=(L.get(t)||0)+1;L.set(t,r),_&&_.register(e,t,e)}function tt(e){_&&_.unregister(e)}function j(e,t=[],r=function(){}){let o=!1,a=new Proxy(r,{get(i,n){if(F(o),n===ee)return()=>{tt(a),ne(e),o=!0};if(n==="then"){if(t.length===0)return{then:()=>a};let l=P(e,{type:"GET",path:t.map(s=>s.toString())}).then(E);return l.then.bind(l)}return j(e,[...t,n])},set(i,n,l){F(o);let[s,u]=N(l);return P(e,{type:"SET",path:[...t,n].map(c=>c.toString()),value:s},u).then(E)},apply(i,n,l){F(o);let s=t[t.length-1];if(s===R)return P(e,{type:"ENDPOINT"}).then(E);if(s==="bind")return j(e,t.slice(0,-1));let[u,c]=Z(l);return P(e,{type:"APPLY",path:t.map(f=>f.toString()),argumentList:u},c).then(E)},construct(i,n){F(o);let[l,s]=Z(n);return P(e,{type:"CONSTRUCT",path:t.map(u=>u.toString()),argumentList:l},s).then(E)}});return et(a,e),a}function rt(e){return Array.prototype.concat.apply([],e)}function Z(e){let t=e.map(N);return[t.map(r=>r[0]),rt(t.map(r=>r[1]))]}var ie=new WeakMap;function oe(e,t){return ie.set(e,t),e}function I(e){return Object.assign(e,{[B]:!0})}function nt(e,t=globalThis,r="*"){return{postMessage:(o,a)=>e.postMessage(o,r,a),addEventListener:t.addEventListener.bind(t),removeEventListener:t.removeEventListener.bind(t)}}function N(e){for(let[t,r]of v)if(r.canHandle(e)){let[o,a]=r.serialize(e);return[{type:"HANDLER",name:t,value:o},a]}return[{type:"RAW",value:e},ie.get(e)||[]]}function E(e){switch(e.type){case"HANDLER":return v.get(e.name).deserialize(e.value);case"RAW":return e.value}}function P(e,t,r){return new Promise(o=>{let a=it();e.addEventListener("message",function i(n){!n.data||!n.data.id||n.data.id!==a||(e.removeEventListener("message",i),o(n.data))}),e.start&&e.start(),e.postMessage(Object.assign({id:a},t),r)})}function it(){return new Array(4).fill(0).map(()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16)).join("-")}var ot=Object.create,V=Object.defineProperty,at=Object.getOwnPropertyDescriptor,st=Object.getOwnPropertyNames,ct=Object.getPrototypeOf,lt=Object.prototype.hasOwnProperty,d=(e,t)=>V(e,"name",{value:t,configurable:!0}),le=(e=>typeof x<"u"?x:typeof Proxy<"u"?new Proxy(e,{get:(t,r)=>(typeof x<"u"?x:t)[r]}):e)(function(e){if(typeof x<"u")return x.apply(this,arguments);throw new Error('Dynamic require of "'+e+'" is not supported')}),ue=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),ut=(e,t,r,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of st(t))!lt.call(e,a)&&a!==r&&V(e,a,{get:()=>t[a],enumerable:!(o=at(t,a))||o.enumerable});return e},ft=(e,t,r)=>(r=e!=null?ot(ct(e)):{},ut(t||!e||!e.__esModule?V(r,"default",{value:e,enumerable:!0}):r,e)),pt=ue((e,t)=>{(function(r,o){"use strict";typeof define=="function"&&define.amd?define("stackframe",[],o):typeof e=="object"?t.exports=o():r.StackFrame=o()})(e,function(){"use strict";function r(m){return!isNaN(parseFloat(m))&&isFinite(m)}d(r,"_isNumber");function o(m){return m.charAt(0).toUpperCase()+m.substring(1)}d(o,"_capitalize");function a(m){return function(){return this[m]}}d(a,"_getter");var i=["isConstructor","isEval","isNative","isToplevel"],n=["columnNumber","lineNumber"],l=["fileName","functionName","source"],s=["args"],u=["evalOrigin"],c=i.concat(n,l,s,u);function f(m){if(m)for(var g=0;g{(function(r,o){"use strict";typeof define=="function"&&define.amd?define("error-stack-parser",["stackframe"],o):typeof e=="object"?t.exports=o(pt()):r.ErrorStackParser=o(r.StackFrame)})(e,d(function(r){"use strict";var o=/(^|@)\S+:\d+/,a=/^\s*at .*(\S+:\d+|\(native\))/m,i=/^(eval@)?(\[native code])?$/;return{parse:d(function(n){if(typeof n.stacktrace<"u"||typeof n["opera#sourceloc"]<"u")return this.parseOpera(n);if(n.stack&&n.stack.match(a))return this.parseV8OrIE(n);if(n.stack)return this.parseFFOrSafari(n);throw new Error("Cannot parse given Error object")},"ErrorStackParser$$parse"),extractLocation:d(function(n){if(n.indexOf(":")===-1)return[n];var l=/(.+?)(?::(\d+))?(?::(\d+))?$/,s=l.exec(n.replace(/[()]/g,""));return[s[1],s[2]||void 0,s[3]||void 0]},"ErrorStackParser$$extractLocation"),parseV8OrIE:d(function(n){var l=n.stack.split(` -`).filter(function(s){return!!s.match(a)},this);return l.map(function(s){s.indexOf("(eval ")>-1&&(s=s.replace(/eval code/g,"eval").replace(/(\(eval at [^()]*)|(,.*$)/g,""));var u=s.replace(/^\s+/,"").replace(/\(eval code/g,"(").replace(/^.*?\s+/,""),c=u.match(/ (\(.+\)$)/);u=c?u.replace(c[0],""):u;var f=this.extractLocation(c?c[1]:u),p=c&&u||void 0,y=["eval",""].indexOf(f[0])>-1?void 0:f[0];return new r({functionName:p,fileName:y,lineNumber:f[1],columnNumber:f[2],source:s})},this)},"ErrorStackParser$$parseV8OrIE"),parseFFOrSafari:d(function(n){var l=n.stack.split(` -`).filter(function(s){return!s.match(i)},this);return l.map(function(s){if(s.indexOf(" > eval")>-1&&(s=s.replace(/ line (\d+)(?: > eval line \d+)* > eval:\d+:\d+/g,":$1")),s.indexOf("@")===-1&&s.indexOf(":")===-1)return new r({functionName:s});var u=/((.*".+"[^@]*)?[^@]*)(?:@)/,c=s.match(u),f=c&&c[1]?c[1]:void 0,p=this.extractLocation(s.replace(u,""));return new r({functionName:f,fileName:p[0],lineNumber:p[1],columnNumber:p[2],source:s})},this)},"ErrorStackParser$$parseFFOrSafari"),parseOpera:d(function(n){return!n.stacktrace||n.message.indexOf(` -`)>-1&&n.message.split(` -`).length>n.stacktrace.split(` -`).length?this.parseOpera9(n):n.stack?this.parseOpera11(n):this.parseOpera10(n)},"ErrorStackParser$$parseOpera"),parseOpera9:d(function(n){for(var l=/Line (\d+).*script (?:in )?(\S+)/i,s=n.message.split(` -`),u=[],c=2,f=s.length;c/,"$2").replace(/\([^)]*\)/g,"")||void 0,y;f.match(/\(([^)]*)\)/)&&(y=f.replace(/^[^(]+\(([^)]*)\)$/,"$1"));var h=y===void 0||y==="[arguments not available]"?void 0:y.split(",");return new r({functionName:p,args:h,fileName:c[0],lineNumber:c[1],columnNumber:c[2],source:s})},this)},"ErrorStackParser$$parseOpera11")}},"ErrorStackParser"))}),dt=ft(mt()),w=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string"&&typeof process.browser>"u",fe=w&&typeof module<"u"&&typeof module.exports<"u"&&typeof le<"u"&&typeof __dirname<"u",yt=w&&!fe,gt=typeof Deno<"u",pe=!w&&!gt,ht=pe&&typeof window=="object"&&typeof document=="object"&&typeof document.createElement=="function"&&typeof sessionStorage=="object"&&typeof importScripts!="function",wt=pe&&typeof importScripts=="function"&&typeof self=="object",Tt=typeof navigator=="object"&&typeof navigator.userAgent=="string"&&navigator.userAgent.indexOf("Chrome")==-1&&navigator.userAgent.indexOf("Safari")>-1,me,z,de,se,q;async function Y(){if(!w||(me=(await import("node:url")).default,se=await import("node:fs"),q=await import("node:fs/promises"),de=(await import("node:vm")).default,z=await import("node:path"),G=z.sep,typeof le<"u"))return;let e=se,t=await import("node:crypto"),r=await Promise.resolve().then(()=>Je(ae(),1)),o=await import("node:child_process"),a={fs:e,crypto:t,ws:r,child_process:o};globalThis.require=function(i){return a[i]}}d(Y,"initNodeModules");function ye(e,t){return z.resolve(t||".",e)}d(ye,"node_resolvePath");function ge(e,t){return t===void 0&&(t=location),new URL(e,t).toString()}d(ge,"browser_resolvePath");var W;w?W=ye:W=ge;var G;w||(G="/");function he(e,t){return e.startsWith("file://")&&(e=e.slice(7)),e.includes("://")?{response:fetch(e)}:{binary:q.readFile(e).then(r=>new Uint8Array(r.buffer,r.byteOffset,r.byteLength))}}d(he,"node_getBinaryResponse");function we(e,t){let r=new URL(e,location);return{response:fetch(r,t?{integrity:t}:{})}}d(we,"browser_getBinaryResponse");var D;w?D=he:D=we;async function ve(e,t){let{response:r,binary:o}=D(e,t);if(o)return o;let a=await r;if(!a.ok)throw new Error(`Failed to load '${e}': request failed.`);return new Uint8Array(await a.arrayBuffer())}d(ve,"loadBinaryFile");var $;if(ht)$=d(async e=>await import(e),"loadScript");else if(wt)$=d(async e=>{try{globalThis.importScripts(e)}catch(t){if(t instanceof TypeError)await import(e);else throw t}},"loadScript");else if(w)$=be;else throw new Error("Cannot determine runtime environment");async function be(e){e.startsWith("file://")&&(e=e.slice(7)),e.includes("://")?de.runInThisContext(await(await fetch(e)).text()):await import(me.pathToFileURL(e).href)}d(be,"nodeLoadScript");async function xe(e){if(w){await Y();let t=await q.readFile(e,{encoding:"utf8"});return JSON.parse(t)}else return await(await fetch(e)).json()}d(xe,"loadLockFile");async function Ee(){if(fe)return __dirname;let e;try{throw new Error}catch(o){e=o}let t=dt.default.parse(e)[0].fileName;if(yt){let o=await import("node:path");return(await import("node:url")).fileURLToPath(o.dirname(t))}let r=t.lastIndexOf(G);if(r===-1)throw new Error("Could not extract indexURL path from pyodide module location");return t.slice(0,r)}d(Ee,"calculateDirname");function ke(e){let t=e.FS,r=e.FS.filesystems.MEMFS,o=e.PATH,a={DIR_MODE:16895,FILE_MODE:33279,mount:function(i){if(!i.opts.fileSystemHandle)throw new Error("opts.fileSystemHandle is required");return r.mount.apply(null,arguments)},syncfs:async(i,n,l)=>{try{let s=a.getLocalSet(i),u=await a.getRemoteSet(i),c=n?u:s,f=n?s:u;await a.reconcile(i,c,f),l(null)}catch(s){l(s)}},getLocalSet:i=>{let n=Object.create(null);function l(c){return c!=="."&&c!==".."}d(l,"isRealDir");function s(c){return f=>o.join2(c,f)}d(s,"toAbsolute");let u=t.readdir(i.mountpoint).filter(l).map(s(i.mountpoint));for(;u.length;){let c=u.pop(),f=t.stat(c);t.isDir(f.mode)&&u.push.apply(u,t.readdir(c).filter(l).map(s(c))),n[c]={timestamp:f.mtime,mode:f.mode}}return{type:"local",entries:n}},getRemoteSet:async i=>{let n=Object.create(null),l=await vt(i.opts.fileSystemHandle);for(let[s,u]of l)s!=="."&&(n[o.join2(i.mountpoint,s)]={timestamp:u.kind==="file"?(await u.getFile()).lastModifiedDate:new Date,mode:u.kind==="file"?a.FILE_MODE:a.DIR_MODE});return{type:"remote",entries:n,handles:l}},loadLocalEntry:i=>{let n=t.lookupPath(i).node,l=t.stat(i);if(t.isDir(l.mode))return{timestamp:l.mtime,mode:l.mode};if(t.isFile(l.mode))return n.contents=r.getFileDataAsTypedArray(n),{timestamp:l.mtime,mode:l.mode,contents:n.contents};throw new Error("node type not supported")},storeLocalEntry:(i,n)=>{if(t.isDir(n.mode))t.mkdirTree(i,n.mode);else if(t.isFile(n.mode))t.writeFile(i,n.contents,{canOwn:!0});else throw new Error("node type not supported");t.chmod(i,n.mode),t.utime(i,n.timestamp,n.timestamp)},removeLocalEntry:i=>{var n=t.stat(i);t.isDir(n.mode)?t.rmdir(i):t.isFile(n.mode)&&t.unlink(i)},loadRemoteEntry:async i=>{if(i.kind==="file"){let n=await i.getFile();return{contents:new Uint8Array(await n.arrayBuffer()),mode:a.FILE_MODE,timestamp:n.lastModifiedDate}}else{if(i.kind==="directory")return{mode:a.DIR_MODE,timestamp:new Date};throw new Error("unknown kind: "+i.kind)}},storeRemoteEntry:async(i,n,l)=>{let s=i.get(o.dirname(n)),u=t.isFile(l.mode)?await s.getFileHandle(o.basename(n),{create:!0}):await s.getDirectoryHandle(o.basename(n),{create:!0});if(u.kind==="file"){let c=await u.createWritable();await c.write(l.contents),await c.close()}i.set(n,u)},removeRemoteEntry:async(i,n)=>{await i.get(o.dirname(n)).removeEntry(o.basename(n)),i.delete(n)},reconcile:async(i,n,l)=>{let s=0,u=[];Object.keys(n.entries).forEach(function(p){let y=n.entries[p],h=l.entries[p];(!h||t.isFile(y.mode)&&y.timestamp.getTime()>h.timestamp.getTime())&&(u.push(p),s++)}),u.sort();let c=[];if(Object.keys(l.entries).forEach(function(p){n.entries[p]||(c.push(p),s++)}),c.sort().reverse(),!s)return;let f=n.type==="remote"?n.handles:l.handles;for(let p of u){let y=o.normalize(p.replace(i.mountpoint,"/")).substring(1);if(l.type==="local"){let h=f.get(y),m=await a.loadRemoteEntry(h);a.storeLocalEntry(p,m)}else{let h=a.loadLocalEntry(p);await a.storeRemoteEntry(f,y,h)}}for(let p of c)if(l.type==="local")a.removeLocalEntry(p);else{let y=o.normalize(p.replace(i.mountpoint,"/")).substring(1);await a.removeRemoteEntry(f,y)}}};e.FS.filesystems.NATIVEFS_ASYNC=a}d(ke,"initializeNativeFS");var vt=d(async e=>{let t=[];async function r(a){for await(let i of a.values())t.push(i),i.kind==="directory"&&await r(i)}d(r,"collect"),await r(e);let o=new Map;o.set(".",e);for(let a of t){let i=(await e.resolve(a)).join("/");o.set(i,a)}return o},"getFsHandles");function Pe(e){let t={noImageDecoding:!0,noAudioDecoding:!0,noWasmDecoding:!1,preRun:Ce(e),quit(r,o){throw t.exited={status:r,toThrow:o},o},print:e.stdout,printErr:e.stderr,arguments:e.args,API:{config:e},locateFile:r=>e.indexURL+r,instantiateWasm:Le(e.indexURL)};return t}d(Pe,"createSettings");function Se(e){return function(t){let r="/";try{t.FS.mkdirTree(e)}catch(o){console.error(`Error occurred while making a home directory '${e}':`),console.error(o),console.error(`Using '${r}' for a home directory instead`),e=r}t.FS.chdir(e)}}d(Se,"createHomeDirectory");function Oe(e){return function(t){Object.assign(t.ENV,e)}}d(Oe,"setEnvironment");function Fe(e){return t=>{for(let r of e)t.FS.mkdirTree(r),t.FS.mount(t.FS.filesystems.NODEFS,{root:r},r)}}d(Fe,"mountLocalDirectories");function Te(e){let t=ve(e);return r=>{let o=r._py_version_major(),a=r._py_version_minor();r.FS.mkdirTree("/lib"),r.FS.mkdirTree(`/lib/python${o}.${a}/site-packages`),r.addRunDependency("install-stdlib"),t.then(i=>{r.FS.writeFile(`/lib/python${o}${a}.zip`,i)}).catch(i=>{console.error("Error occurred while installing the standard library:"),console.error(i)}).finally(()=>{r.removeRunDependency("install-stdlib")})}}d(Te,"installStdlib");function Ce(e){let t;return e.stdLibURL!=null?t=e.stdLibURL:t=e.indexURL+"python_stdlib.zip",[Te(t),Se(e.env.HOME),Oe(e.env),Fe(e._node_mounts),ke]}d(Ce,"getFileSystemInitializationFuncs");function Le(e){let{binary:t,response:r}=D(e+"pyodide.asm.wasm");return function(o,a){return async function(){try{let i;r?i=await WebAssembly.instantiateStreaming(r,o):i=await WebAssembly.instantiate(await t,o);let{instance:n,module:l}=i;typeof WasmOffsetConverter<"u"&&(wasmOffsetConverter=new WasmOffsetConverter(wasmBinary,l)),a(n,l)}catch(i){console.warn("wasm instantiation failed!"),console.warn(i)}}(),{}}}d(Le,"getInstantiateWasmFunc");var ce="0.26.1";async function J(e={}){await Y();let t=e.indexURL||await Ee();t=W(t),t.endsWith("/")||(t+="/"),e.indexURL=t;let r={fullStdLib:!1,jsglobals:globalThis,stdin:globalThis.prompt?globalThis.prompt:void 0,lockFileURL:t+"pyodide-lock.json",args:[],_node_mounts:[],env:{},packageCacheDir:t,packages:[],enableRunUntilComplete:!1},o=Object.assign(r,e);o.env.HOME||(o.env.HOME="/home/pyodide");let a=Pe(o),i=a.API;if(i.lockFilePromise=xe(o.lockFileURL),typeof _createPyodideModule!="function"){let c=`${o.indexURL}pyodide.asm.js`;await $(c)}let n;if(e._loadSnapshot){let c=await e._loadSnapshot;ArrayBuffer.isView(c)?n=c:n=new Uint8Array(c),a.noInitialRun=!0,a.INITIAL_MEMORY=n.length}let l=await _createPyodideModule(a);if(a.exited)throw a.exited.toThrow;if(e.pyproxyToStringRepr&&i.setPyProxyToStringMethod(!0),i.version!==ce)throw new Error(`Pyodide version does not match: '${ce}' <==> '${i.version}'. If you updated the Pyodide version, make sure you also updated the 'indexURL' parameter passed to loadPyodide.`);l.locateFile=c=>{throw new Error("Didn't expect to load any more file_packager files!")};let s;n&&(s=i.restoreSnapshot(n));let u=i.finalizeBootstrap(s);return i.sys.path.insert(0,i.config.env.HOME),u.version.includes("dev")||i.setCdnUrl(`https://cdn.jsdelivr.net/pyodide/v${u.version}/full/`),i._pyodide.set_excepthook(),await i.packageIndexReady,i.initializeStreams(o.stdin,o.stdout,o.stderr),u}d(J,"loadPyodide");function X(e){return typeof ImageBitmap<"u"&&e instanceof ImageBitmap}function S(e,t,r,...o){return e==null||X(e)||e instanceof ArrayBuffer||ArrayBuffer.isView(e)?e:t(e)?r(e,...o):Array.isArray(e)?e.map(a=>S(a,t,r,...o)):typeof e=="object"?Object.fromEntries(Object.entries(e).map(([a,i])=>[a,S(i,t,r,...o)])):e}function bt(e){return e&&e[Symbol.toStringTag]=="PyProxy"}function _e(e){return e&&!!e[R]}function xt(e){return e&&typeof e=="object"&&"_comlinkProxy"in e&&"ptr"in e}function Et(e){return e&&e[Symbol.toStringTag]=="Map"}function K(e){if(_e(e))return!0;if(e==null||e instanceof ArrayBuffer||ArrayBuffer.isView(e))return!1;if(e instanceof Array)return e.some(t=>K(t));if(typeof e=="object")return Object.entries(e).some(([t,r])=>K(r))}var Ne={},Re={canHandle:bt,serialize(e){let t=self.pyodide._module.PyProxy_getPtr(e);Ne[t]=e;let{port1:r,port2:o}=new MessageChannel;return k(e,r),[[o,t],[o]]},deserialize([e,t]){e.start();let r=A(e);return new Proxy(r,{get:(a,i)=>i==="_ptr"?t:a[i]})}},Ae={canHandle:K,serialize(e){return[S(e,_e,t=>({_comlinkProxy:!0,ptr:t._ptr})),[]]},deserialize(e){return S(e,xt,t=>Ne[t.ptr])}},Ie={canHandle:X,serialize(e){if(e.width==0&&e.height==0){let t=new OffscreenCanvas(1,1);t.getContext("2d"),e=t.transferToImageBitmap()}return[e,[e]]},deserialize(e){return e}},Me={canHandle:Et,serialize(e){return[Object.fromEntries(e.entries()),[]]},deserialize(e){return e}};var kt={mkdir(e){self.pyodide._FS.mkdir(e)},writeFile(e,t){self.pyodide._FS.writeFile(e,t)}};async function Pt(e){return self.pyodide=await J(e),self.pyodide.registerComlink(M),self.pyodide._FS=self.pyodide.FS,self.pyodide.FS=kt,v.set("PyProxy",Re),v.set("Comlink",Ae),v.set("ImageBitmap",Ie),v.set("Map",Me),I(self.pyodide)}k({init:Pt}); +var We=Object.create;var V=Object.defineProperty;var je=Object.getOwnPropertyDescriptor;var Ve=Object.getOwnPropertyNames;var qe=Object.getPrototypeOf,Ye=Object.prototype.hasOwnProperty;var v=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,r)=>(typeof require<"u"?require:t)[r]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var Ge=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Je=(e,t)=>{for(var r in t)V(e,r,{get:t[r],enumerable:!0})},Xe=(e,t,r,a)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Ve(t))!Ye.call(e,i)&&i!==r&&V(e,i,{get:()=>t[i],enumerable:!(a=je(t,i))||a.enumerable});return e};var Ke=(e,t,r)=>(r=e!=null?We(qe(e)):{},Xe(t||!e||!e.__esModule?V(r,"default",{value:e,enumerable:!0}):r,e));var ue=Ge(()=>{});var $={};Je($,{createEndpoint:()=>D,expose:()=>x,finalizer:()=>R,proxy:()=>U,proxyMarker:()=>Y,releaseProxy:()=>ie,transfer:()=>ce,transferHandlers:()=>w,windowEndpoint:()=>ot,wrap:()=>H});var Y=Symbol("Comlink.proxy"),D=Symbol("Comlink.endpoint"),ie=Symbol("Comlink.releaseProxy"),R=Symbol("Comlink.finalizer"),A=Symbol("Comlink.thrown"),oe=e=>typeof e=="object"&&e!==null||typeof e=="function",Qe={canHandle:e=>oe(e)&&e[Y],serialize(e){let{port1:t,port2:r}=new MessageChannel;return x(e,t),[r,[r]]},deserialize(e){return e.start(),H(e)}},Ze={canHandle:e=>oe(e)&&A in e,serialize({value:e}){let t;return e instanceof Error?t={isError:!0,value:{message:e.message,name:e.name,stack:e.stack}}:t={isError:!1,value:e},[t,[]]},deserialize(e){throw e.isError?Object.assign(new Error(e.value.message),e.value):e.value}},w=new Map([["proxy",Qe],["throw",Ze]]);function et(e,t){for(let r of e)if(t===r||r==="*"||r instanceof RegExp&&r.test(t))return!0;return!1}function x(e,t=globalThis,r=["*"]){t.addEventListener("message",function a(i){if(!i||!i.data)return;if(!et(r,i.origin)){console.warn(`Invalid origin '${i.origin}' for comlink proxy`);return}let{id:n,type:o,path:s}=Object.assign({path:[]},i.data),l=(i.data.argumentList||[]).map(E),c;try{let u=s.slice(0,-1).reduce((d,p)=>d[p],e),m=s.reduce((d,p)=>d[p],e);switch(o){case"GET":c=m;break;case"SET":u[s.slice(-1)[0]]=E(i.data.value),c=!0;break;case"APPLY":c=m.apply(u,l);break;case"CONSTRUCT":{let d=new m(...l);c=U(d)}break;case"ENDPOINT":{let{port1:d,port2:p}=new MessageChannel;x(e,p),c=ce(d,[d])}break;case"RELEASE":c=void 0;break;default:return}}catch(u){c={value:u,[A]:0}}Promise.resolve(c).catch(u=>({value:u,[A]:0})).then(u=>{let[m,d]=M(u);t.postMessage(Object.assign(Object.assign({},m),{id:n}),d),o==="RELEASE"&&(t.removeEventListener("message",a),ae(t),R in e&&typeof e[R]=="function"&&e[R]())}).catch(u=>{let[m,d]=M({value:new TypeError("Unserializable return value"),[A]:0});t.postMessage(Object.assign(Object.assign({},m),{id:n}),d)})}),t.start&&t.start()}function tt(e){return e.constructor.name==="MessagePort"}function ae(e){tt(e)&&e.close()}function H(e,t){return q(e,[],t)}function L(e){if(e)throw new Error("Proxy has been released and is not useable")}function se(e){return O(e,{type:"RELEASE"}).then(()=>{ae(e)})}var I=new WeakMap,N="FinalizationRegistry"in globalThis&&new FinalizationRegistry(e=>{let t=(I.get(e)||0)-1;I.set(e,t),t===0&&se(e)});function rt(e,t){let r=(I.get(t)||0)+1;I.set(t,r),N&&N.register(e,t,e)}function nt(e){N&&N.unregister(e)}function q(e,t=[],r=function(){}){let a=!1,i=new Proxy(r,{get(n,o){if(L(a),o===ie)return()=>{nt(i),se(e),a=!0};if(o==="then"){if(t.length===0)return{then:()=>i};let s=O(e,{type:"GET",path:t.map(l=>l.toString())}).then(E);return s.then.bind(s)}return q(e,[...t,o])},set(n,o,s){L(a);let[l,c]=M(s);return O(e,{type:"SET",path:[...t,o].map(u=>u.toString()),value:l},c).then(E)},apply(n,o,s){L(a);let l=t[t.length-1];if(l===D)return O(e,{type:"ENDPOINT"}).then(E);if(l==="bind")return q(e,t.slice(0,-1));let[c,u]=ne(s);return O(e,{type:"APPLY",path:t.map(m=>m.toString()),argumentList:c},u).then(E)},construct(n,o){L(a);let[s,l]=ne(o);return O(e,{type:"CONSTRUCT",path:t.map(c=>c.toString()),argumentList:s},l).then(E)}});return rt(i,e),i}function it(e){return Array.prototype.concat.apply([],e)}function ne(e){let t=e.map(M);return[t.map(r=>r[0]),it(t.map(r=>r[1]))]}var le=new WeakMap;function ce(e,t){return le.set(e,t),e}function U(e){return Object.assign(e,{[Y]:!0})}function ot(e,t=globalThis,r="*"){return{postMessage:(a,i)=>e.postMessage(a,r,i),addEventListener:t.addEventListener.bind(t),removeEventListener:t.removeEventListener.bind(t)}}function M(e){for(let[t,r]of w)if(r.canHandle(e)){let[a,i]=r.serialize(e);return[{type:"HANDLER",name:t,value:a},i]}return[{type:"RAW",value:e},le.get(e)||[]]}function E(e){switch(e.type){case"HANDLER":return w.get(e.name).deserialize(e.value);case"RAW":return e.value}}function O(e,t,r){return new Promise(a=>{let i=at();e.addEventListener("message",function n(o){!o.data||!o.data.id||o.data.id!==i||(e.removeEventListener("message",n),a(o.data))}),e.start&&e.start(),e.postMessage(Object.assign({id:i},t),r)})}function at(){return new Array(4).fill(0).map(()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16)).join("-")}var st=Object.defineProperty,f=(e,t)=>st(e,"name",{value:t,configurable:!0}),me=(e=>typeof v<"u"?v:typeof Proxy<"u"?new Proxy(e,{get:(t,r)=>(typeof v<"u"?v:t)[r]}):e)(function(e){if(typeof v<"u")return v.apply(this,arguments);throw new Error('Dynamic require of "'+e+'" is not supported')});function pe(e){return!isNaN(parseFloat(e))&&isFinite(e)}f(pe,"_isNumber");function h(e){return e.charAt(0).toUpperCase()+e.substring(1)}f(h,"_capitalize");function j(e){return function(){return this[e]}}f(j,"_getter");var T=["isConstructor","isEval","isNative","isToplevel"],C=["columnNumber","lineNumber"],F=["fileName","functionName","source"],lt=["args"],ct=["evalOrigin"],B=T.concat(C,F,lt,ct);function y(e){if(e)for(var t=0;t-1&&(i=i.replace(/eval code/g,"eval").replace(/(\(eval at [^()]*)|(,.*$)/g,""));var n=i.replace(/^\s+/,"").replace(/\(eval code/g,"(").replace(/^.*?\s+/,""),o=n.match(/ (\(.+\)$)/);n=o?n.replace(o[0],""):n;var s=this.extractLocation(o?o[1]:n),l=o&&n||void 0,c=["eval",""].indexOf(s[0])>-1?void 0:s[0];return new G({functionName:l,fileName:c,lineNumber:s[1],columnNumber:s[2],source:i})},this)},"ErrorStackParser$$parseV8OrIE"),parseFFOrSafari:f(function(r){var a=r.stack.split(` +`).filter(function(i){return!i.match(t)},this);return a.map(function(i){if(i.indexOf(" > eval")>-1&&(i=i.replace(/ line (\d+)(?: > eval line \d+)* > eval:\d+:\d+/g,":$1")),i.indexOf("@")===-1&&i.indexOf(":")===-1)return new G({functionName:i});var n=/((.*".+"[^@]*)?[^@]*)(?:@)/,o=i.match(n),s=o&&o[1]?o[1]:void 0,l=this.extractLocation(i.replace(n,""));return new G({functionName:s,fileName:l[0],lineNumber:l[1],columnNumber:l[2],source:i})},this)},"ErrorStackParser$$parseFFOrSafari")}}f(ye,"ErrorStackParser");var ut=new ye,ft=ut,g=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string"&&!process.browser,ge=g&&typeof module<"u"&&typeof module.exports<"u"&&typeof me<"u"&&typeof __dirname<"u",dt=g&&!ge,St=typeof globalThis.Bun<"u",mt=typeof Deno<"u",we=!g&&!mt,pt=we&&typeof window=="object"&&typeof document=="object"&&typeof document.createElement=="function"&&"sessionStorage"in window&&typeof importScripts!="function",yt=we&&typeof importScripts=="function"&&typeof self=="object",Ot=typeof navigator=="object"&&typeof navigator.userAgent=="string"&&navigator.userAgent.indexOf("Chrome")==-1&&navigator.userAgent.indexOf("Safari")>-1,he,J,ve,fe,K;async function Q(){if(!g||(he=(await import("node:url")).default,fe=await import("node:fs"),K=await import("node:fs/promises"),ve=(await import("node:vm")).default,J=await import("node:path"),Z=J.sep,typeof me<"u"))return;let e=fe,t=await import("node:crypto"),r=await Promise.resolve().then(()=>Ke(ue(),1)),a=await import("node:child_process"),i={fs:e,crypto:t,ws:r,child_process:a};globalThis.require=function(n){return i[n]}}f(Q,"initNodeModules");function Ee(e,t){return J.resolve(t||".",e)}f(Ee,"node_resolvePath");function xe(e,t){return t===void 0&&(t=location),new URL(e,t).toString()}f(xe,"browser_resolvePath");var X;g?X=Ee:X=xe;var Z;g||(Z="/");function be(e,t){return e.startsWith("file://")&&(e=e.slice(7)),e.includes("://")?{response:fetch(e)}:{binary:K.readFile(e).then(r=>new Uint8Array(r.buffer,r.byteOffset,r.byteLength))}}f(be,"node_getBinaryResponse");function Pe(e,t){let r=new URL(e,location);return{response:fetch(r,t?{integrity:t}:{})}}f(Pe,"browser_getBinaryResponse");var W;g?W=be:W=Pe;async function ke(e,t){let{response:r,binary:a}=W(e,t);if(a)return a;let i=await r;if(!i.ok)throw new Error(`Failed to load '${e}': request failed.`);return new Uint8Array(await i.arrayBuffer())}f(ke,"loadBinaryFile");var z;if(pt)z=f(async e=>await import(e),"loadScript");else if(yt)z=f(async e=>{try{globalThis.importScripts(e)}catch(t){if(t instanceof TypeError)await import(e);else throw t}},"loadScript");else if(g)z=Se;else throw new Error("Cannot determine runtime environment");async function Se(e){e.startsWith("file://")&&(e=e.slice(7)),e.includes("://")?ve.runInThisContext(await(await fetch(e)).text()):await import(he.pathToFileURL(e).href)}f(Se,"nodeLoadScript");async function Oe(e){if(g){await Q();let t=await K.readFile(e,{encoding:"utf8"});return JSON.parse(t)}else return await(await fetch(e)).json()}f(Oe,"loadLockFile");async function Te(){if(ge)return __dirname;let e;try{throw new Error}catch(a){e=a}let t=ft.parse(e)[0].fileName;if(g&&!t.startsWith("file://")&&(t=`file://${t}`),dt){let a=await import("node:path");return(await import("node:url")).fileURLToPath(a.dirname(t))}let r=t.lastIndexOf(Z);if(r===-1)throw new Error("Could not extract indexURL path from pyodide module location");return t.slice(0,r)}f(Te,"calculateDirname");function Ce(e){let t=e.FS,r=e.FS.filesystems.MEMFS,a=e.PATH,i={DIR_MODE:16895,FILE_MODE:33279,mount:function(n){if(!n.opts.fileSystemHandle)throw new Error("opts.fileSystemHandle is required");return r.mount.apply(null,arguments)},syncfs:async(n,o,s)=>{try{let l=i.getLocalSet(n),c=await i.getRemoteSet(n),u=o?c:l,m=o?l:c;await i.reconcile(n,u,m),s(null)}catch(l){s(l)}},getLocalSet:n=>{let o=Object.create(null);function s(u){return u!=="."&&u!==".."}f(s,"isRealDir");function l(u){return m=>a.join2(u,m)}f(l,"toAbsolute");let c=t.readdir(n.mountpoint).filter(s).map(l(n.mountpoint));for(;c.length;){let u=c.pop(),m=t.stat(u);t.isDir(m.mode)&&c.push.apply(c,t.readdir(u).filter(s).map(l(u))),o[u]={timestamp:m.mtime,mode:m.mode}}return{type:"local",entries:o}},getRemoteSet:async n=>{let o=Object.create(null),s=await gt(n.opts.fileSystemHandle);for(let[l,c]of s)l!=="."&&(o[a.join2(n.mountpoint,l)]={timestamp:c.kind==="file"?(await c.getFile()).lastModifiedDate:new Date,mode:c.kind==="file"?i.FILE_MODE:i.DIR_MODE});return{type:"remote",entries:o,handles:s}},loadLocalEntry:n=>{let o=t.lookupPath(n).node,s=t.stat(n);if(t.isDir(s.mode))return{timestamp:s.mtime,mode:s.mode};if(t.isFile(s.mode))return o.contents=r.getFileDataAsTypedArray(o),{timestamp:s.mtime,mode:s.mode,contents:o.contents};throw new Error("node type not supported")},storeLocalEntry:(n,o)=>{if(t.isDir(o.mode))t.mkdirTree(n,o.mode);else if(t.isFile(o.mode))t.writeFile(n,o.contents,{canOwn:!0});else throw new Error("node type not supported");t.chmod(n,o.mode),t.utime(n,o.timestamp,o.timestamp)},removeLocalEntry:n=>{var o=t.stat(n);t.isDir(o.mode)?t.rmdir(n):t.isFile(o.mode)&&t.unlink(n)},loadRemoteEntry:async n=>{if(n.kind==="file"){let o=await n.getFile();return{contents:new Uint8Array(await o.arrayBuffer()),mode:i.FILE_MODE,timestamp:o.lastModifiedDate}}else{if(n.kind==="directory")return{mode:i.DIR_MODE,timestamp:new Date};throw new Error("unknown kind: "+n.kind)}},storeRemoteEntry:async(n,o,s)=>{let l=n.get(a.dirname(o)),c=t.isFile(s.mode)?await l.getFileHandle(a.basename(o),{create:!0}):await l.getDirectoryHandle(a.basename(o),{create:!0});if(c.kind==="file"){let u=await c.createWritable();await u.write(s.contents),await u.close()}n.set(o,c)},removeRemoteEntry:async(n,o)=>{await n.get(a.dirname(o)).removeEntry(a.basename(o)),n.delete(o)},reconcile:async(n,o,s)=>{let l=0,c=[];Object.keys(o.entries).forEach(function(d){let p=o.entries[d],S=s.entries[d];(!S||t.isFile(p.mode)&&p.timestamp.getTime()>S.timestamp.getTime())&&(c.push(d),l++)}),c.sort();let u=[];if(Object.keys(s.entries).forEach(function(d){o.entries[d]||(u.push(d),l++)}),u.sort().reverse(),!l)return;let m=o.type==="remote"?o.handles:s.handles;for(let d of c){let p=a.normalize(d.replace(n.mountpoint,"/")).substring(1);if(s.type==="local"){let S=m.get(p),ze=await i.loadRemoteEntry(S);i.storeLocalEntry(d,ze)}else{let S=i.loadLocalEntry(d);await i.storeRemoteEntry(m,p,S)}}for(let d of u)if(s.type==="local")i.removeLocalEntry(d);else{let p=a.normalize(d.replace(n.mountpoint,"/")).substring(1);await i.removeRemoteEntry(m,p)}}};e.FS.filesystems.NATIVEFS_ASYNC=i}f(Ce,"initializeNativeFS");var gt=f(async e=>{let t=[];async function r(i){for await(let n of i.values())t.push(n),n.kind==="directory"&&await r(n)}f(r,"collect"),await r(e);let a=new Map;a.set(".",e);for(let i of t){let n=(await e.resolve(i)).join("/");a.set(n,i)}return a},"getFsHandles");function Fe(e){let t={noImageDecoding:!0,noAudioDecoding:!0,noWasmDecoding:!1,preRun:Ie(e),quit(r,a){throw t.exited={status:r,toThrow:a},a},print:e.stdout,printErr:e.stderr,arguments:e.args,API:{config:e},locateFile:r=>e.indexURL+r,instantiateWasm:Ne(e.indexURL)};return t}f(Fe,"createSettings");function _e(e){return function(t){let r="/";try{t.FS.mkdirTree(e)}catch(a){console.error(`Error occurred while making a home directory '${e}':`),console.error(a),console.error(`Using '${r}' for a home directory instead`),e=r}t.FS.chdir(e)}}f(_e,"createHomeDirectory");function Le(e){return function(t){Object.assign(t.ENV,e)}}f(Le,"setEnvironment");function Re(e){return t=>{for(let r of e)t.FS.mkdirTree(r),t.FS.mount(t.FS.filesystems.NODEFS,{root:r},r)}}f(Re,"mountLocalDirectories");function Ae(e){let t=ke(e);return r=>{let a=r._py_version_major(),i=r._py_version_minor();r.FS.mkdirTree("/lib"),r.FS.mkdirTree(`/lib/python${a}.${i}/site-packages`),r.addRunDependency("install-stdlib"),t.then(n=>{r.FS.writeFile(`/lib/python${a}${i}.zip`,n)}).catch(n=>{console.error("Error occurred while installing the standard library:"),console.error(n)}).finally(()=>{r.removeRunDependency("install-stdlib")})}}f(Ae,"installStdlib");function Ie(e){let t;return e.stdLibURL!=null?t=e.stdLibURL:t=e.indexURL+"python_stdlib.zip",[Ae(t),_e(e.env.HOME),Le(e.env),Re(e._node_mounts),Ce]}f(Ie,"getFileSystemInitializationFuncs");function Ne(e){let{binary:t,response:r}=W(e+"pyodide.asm.wasm");return function(a,i){return async function(){try{let n;r?n=await WebAssembly.instantiateStreaming(r,a):n=await WebAssembly.instantiate(await t,a);let{instance:o,module:s}=n;typeof WasmOffsetConverter<"u"&&(wasmOffsetConverter=new WasmOffsetConverter(wasmBinary,s)),i(o,s)}catch(n){console.warn("wasm instantiation failed!"),console.warn(n)}}(),{}}}f(Ne,"getInstantiateWasmFunc");var de="0.27.0";async function ee(e={}){var t,r;await Q();let a=e.indexURL||await Te();a=X(a),a.endsWith("/")||(a+="/"),e.indexURL=a;let i={fullStdLib:!1,jsglobals:globalThis,stdin:globalThis.prompt?globalThis.prompt:void 0,lockFileURL:a+"pyodide-lock.json",args:[],_node_mounts:[],env:{},packageCacheDir:a,packages:[],enableRunUntilComplete:!1,checkAPIVersion:!0,BUILD_ID:"8f254d3346bd62b9d3eb64ff47e12c292072a672346cdf144e38e4e3f6572e16"},n=Object.assign(i,e);(t=n.env).HOME??(t.HOME="/home/pyodide"),(r=n.env).PYTHONINSPECT??(r.PYTHONINSPECT="1");let o=Fe(n),s=o.API;if(s.lockFilePromise=Oe(n.lockFileURL),typeof _createPyodideModule!="function"){let d=`${n.indexURL}pyodide.asm.js`;await z(d)}let l;if(e._loadSnapshot){let d=await e._loadSnapshot;ArrayBuffer.isView(d)?l=d:l=new Uint8Array(d),o.noInitialRun=!0,o.INITIAL_MEMORY=l.length}let c=await _createPyodideModule(o);if(o.exited)throw o.exited.toThrow;if(e.pyproxyToStringRepr&&s.setPyProxyToStringMethod(!0),s.version!==de&&n.checkAPIVersion)throw new Error(`Pyodide version does not match: '${de}' <==> '${s.version}'. If you updated the Pyodide version, make sure you also updated the 'indexURL' parameter passed to loadPyodide.`);c.locateFile=d=>{throw new Error("Didn't expect to load any more file_packager files!")};let u;l&&(u=s.restoreSnapshot(l));let m=s.finalizeBootstrap(u,e._snapshotDeserializer);return s.sys.path.insert(0,s.config.env.HOME),m.version.includes("dev")||s.setCdnUrl(`https://cdn.jsdelivr.net/pyodide/v${m.version}/full/`),s._pyodide.set_excepthook(),await s.packageIndexReady,s.initializeStreams(n.stdin,n.stdout,n.stderr),m}f(ee,"loadPyodide");function te(e){return typeof ImageBitmap<"u"&&e instanceof ImageBitmap}function _(e,t,r,...a){return e==null||te(e)||e instanceof ArrayBuffer||ArrayBuffer.isView(e)?e:t(e)?r(e,...a):Array.isArray(e)?e.map(i=>_(i,t,r,...a)):typeof e=="object"?Object.fromEntries(Object.entries(e).map(([i,n])=>[i,_(n,t,r,...a)])):e}function wt(e){return e&&e[Symbol.toStringTag]=="PyProxy"}function Me(e){return e&&!!e[D]}function ht(e){return e&&typeof e=="object"&&"_comlinkProxy"in e&&"ptr"in e}function vt(e){return e&&e[Symbol.toStringTag]=="Map"}function re(e){if(Me(e))return!0;if(e==null||e instanceof ArrayBuffer||ArrayBuffer.isView(e))return!1;if(e instanceof Array)return e.some(t=>re(t));if(typeof e=="object")return Object.entries(e).some(([t,r])=>re(r))}var De={},He={canHandle:wt,serialize(e){let t=self.pyodide._module.PyProxy_getPtr(e);De[t]=e;let{port1:r,port2:a}=new MessageChannel;return x(e,r),[[a,t],[a]]},deserialize([e,t]){e.start();let r=H(e);return new Proxy(r,{get:(i,n)=>n==="_ptr"?t:i[n]})}},Ue={canHandle:re,serialize(e){return[_(e,Me,t=>({_comlinkProxy:!0,ptr:t._ptr})),[]]},deserialize(e){return _(e,ht,t=>De[t.ptr])}},$e={canHandle:te,serialize(e){if(e.width==0&&e.height==0){let t=new OffscreenCanvas(1,1);t.getContext("2d"),e=t.transferToImageBitmap()}return[e,[e]]},deserialize(e){return e}},Be={canHandle:vt,serialize(e){return[Object.fromEntries(e.entries()),[]]},deserialize(e){return e}};var Et={mkdir(e){self.pyodide._FS.mkdir(e)},writeFile(e,t){self.pyodide._FS.writeFile(e,t)}};async function xt(e){return self.pyodide=await ee(e),self.pyodide.registerComlink($),self.pyodide._FS=self.pyodide.FS,self.pyodide.FS=Et,w.set("PyProxy",He),w.set("Comlink",Ue),w.set("ImageBitmap",$e),w.set("Map",Be),U(self.pyodide)}x({init:xt}); /*! Bundled license information: comlink/dist/esm/comlink.mjs: diff --git a/live-runtime/package-lock.json b/live-runtime/package-lock.json index 74950ad..43bce92 100644 --- a/live-runtime/package-lock.json +++ b/live-runtime/package-lock.json @@ -23,7 +23,7 @@ "@types/node": "^20.12.7", "esbuild": "^0.20.2", "esbuild-plugin-copy": "^2.1.1", - "pyodide": "^0.26.1", + "pyodide": "^0.27.0", "tsx": "^4.8.2", "webr": "^0.4.0-rc.0" } @@ -1915,15 +1915,16 @@ } }, "node_modules/nanoid": { - "version": "3.3.7", - "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.7.tgz", - "integrity": "sha512-eSRppjcPIatRIMC1U6UngP8XFcz8MQWGQdt1MTBQ7NaAmvXDfvNxbvWV3x2y6CdEUciCSsDHDQZbhYaB8QEo2g==", + "version": "3.3.8", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.8.tgz", + "integrity": "sha512-WNLf5Sd8oZxOm+TzppcYk8gVOgP+l58xNy58D0nbUnOxOWRWvlcCV4kUF7ltmI6PsrLl/BgKEyS4mqsGChFN0w==", "funding": [ { "type": "github", "url": "https://github.com/sponsors/ai" } ], + "license": "MIT", "bin": { "nanoid": "bin/nanoid.cjs" }, @@ -2052,10 +2053,11 @@ } }, "node_modules/pyodide": { - "version": "0.26.1", - "resolved": "https://registry.npmjs.org/pyodide/-/pyodide-0.26.1.tgz", - "integrity": "sha512-P+Gm88nwZqY7uBgjbQH8CqqU6Ei/rDn7pS1t02sNZsbyLJMyE2OVXjgNuqVT3KqYWnyGREUN0DbBUCJqk8R0ew==", + "version": "0.27.0", + "resolved": "https://registry.npmjs.org/pyodide/-/pyodide-0.27.0.tgz", + "integrity": "sha512-0O992noCKqv8lPw4+QFWw8d8yrNWVtQ6zPhWNg/RNYbFohiwmV6SGlVh5fWk/4pOxyhgHbayq+ur8JoR/r5U9A==", "dev": true, + "license": "Apache-2.0", "dependencies": { "ws": "^8.5.0" }, diff --git a/live-runtime/package.json b/live-runtime/package.json index d0f6b59..461c7f9 100644 --- a/live-runtime/package.json +++ b/live-runtime/package.json @@ -16,7 +16,7 @@ "@types/node": "^20.12.7", "esbuild": "^0.20.2", "esbuild-plugin-copy": "^2.1.1", - "pyodide": "^0.26.1", + "pyodide": "^0.27.0", "tsx": "^4.8.2", "webr": "^0.4.0-rc.0" },