"use strict";var loadPyodide=(()=>{var ae=Object.create;var w=Object.defineProperty;var se=Object.getOwnPropertyDescriptor;var ce=Object.getOwnPropertyNames;var le=Object.getPrototypeOf,de=Object.prototype.hasOwnProperty;var f=(t,e)=>w(t,"name",{value:e,configurable:!0}),g=(t=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:(e,o)=>(typeof require<"u"?require:e)[o]}):t)(function(t){if(typeof require<"u")return require.apply(this,arguments);throw new Error('Dynamic require of "'+t+'" is not supported')});var U=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),fe=(t,e)=>{for(var o in e)w(t,o,{get:e[o],enumerable:!0})},M=(t,e,o,a)=>{if(e&&typeof e=="object"||typeof e=="function")for(let l of ce(e))!de.call(t,l)&&l!==o&&w(t,l,{get:()=>e[l],enumerable:!(a=se(e,l))||a.enumerable});return t};var h=(t,e,o)=>(o=t!=null?ae(le(t)):{},M(e||!t||!t.__esModule?w(o,"default",{value:t,enumerable:!0}):o,t)),ue=t=>M(w({},"__esModule",{value:!0}),t);var C=U((P,$)=>{(function(t,e){"use strict";typeof define=="function"&&define.amd?define("stackframe",[],e):typeof P=="object"?$.exports=e():t.StackFrame=e()})(P,function(){"use strict";function t(d){return!isNaN(parseFloat(d))&&isFinite(d)}f(t,"_isNumber");function e(d){return d.charAt(0).toUpperCase()+d.substring(1)}f(e,"_capitalize");function o(d){return function(){return this[d]}}f(o,"_getter");var a=["isConstructor","isEval","isNative","isToplevel"],l=["columnNumber","lineNumber"],n=["fileName","functionName","source"],r=["args"],u=["evalOrigin"],i=a.concat(l,n,r,u);function c(d){if(d)for(var y=0;y{(function(t,e){"use strict";typeof define=="function"&&define.amd?define("error-stack-parser",["stackframe"],e):typeof x=="object"?W.exports=e(C()):t.ErrorStackParser=e(t.StackFrame)})(x,f(function(e){"use strict";var o=/(^|@)\S+:\d+/,a=/^\s*at .*(\S+:\d+|\(native\))/m,l=/^(eval@)?(\[native code])?$/;return{parse:f(function(r){if(typeof r.stacktrace<"u"||typeof r["opera#sourceloc"]<"u")return this.parseOpera(r);if(r.stack&&r.stack.match(a))return this.parseV8OrIE(r);if(r.stack)return this.parseFFOrSafari(r);throw new Error("Cannot parse given Error object")},"ErrorStackParser$$parse"),extractLocation:f(function(r){if(r.indexOf(":")===-1)return[r];var u=/(.+?)(?::(\d+))?(?::(\d+))?$/,i=u.exec(r.replace(/[()]/g,""));return[i[1],i[2]||void 0,i[3]||void 0]},"ErrorStackParser$$extractLocation"),parseV8OrIE:f(function(r){var u=r.stack.split(` `).filter(function(i){return!!i.match(a)},this);return u.map(function(i){i.indexOf("(eval ")>-1&&(i=i.replace(/eval code/g,"eval").replace(/(\(eval at [^()]*)|(,.*$)/g,""));var c=i.replace(/^\s+/,"").replace(/\(eval code/g,"(").replace(/^.*?\s+/,""),s=c.match(/ (\(.+\)$)/);c=s?c.replace(s[0],""):c;var m=this.extractLocation(s?s[1]:c),p=s&&c||void 0,d=["eval",""].indexOf(m[0])>-1?void 0:m[0];return new e({functionName:p,fileName:d,lineNumber:m[1],columnNumber:m[2],source:i})},this)},"ErrorStackParser$$parseV8OrIE"),parseFFOrSafari:f(function(r){var u=r.stack.split(` `).filter(function(i){return!i.match(l)},this);return u.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 e({functionName:i});var c=/((.*".+"[^@]*)?[^@]*)(?:@)/,s=i.match(c),m=s&&s[1]?s[1]:void 0,p=this.extractLocation(i.replace(c,""));return new e({functionName:m,fileName:p[0],lineNumber:p[1],columnNumber:p[2],source:i})},this)},"ErrorStackParser$$parseFFOrSafari"),parseOpera:f(function(r){return!r.stacktrace||r.message.indexOf(` `)>-1&&r.message.split(` `).length>r.stacktrace.split(` `).length?this.parseOpera9(r):r.stack?this.parseOpera11(r):this.parseOpera10(r)},"ErrorStackParser$$parseOpera"),parseOpera9:f(function(r){for(var u=/Line (\d+).*script (?:in )?(\S+)/i,i=r.message.split(` `),c=[],s=2,m=i.length;s/,"$2").replace(/\([^)]*\)/g,"")||void 0,d;m.match(/\(([^)]*)\)/)&&(d=m.replace(/^[^(]+\(([^)]*)\)$/,"$1"));var y=d===void 0||d==="[arguments not available]"?void 0:d.split(",");return new e({functionName:p,args:y,fileName:s[0],lineNumber:s[1],columnNumber:s[2],source:i})},this)},"ErrorStackParser$$parseOpera11")}},"ErrorStackParser"))});var Ne={};fe(Ne,{loadPyodide:()=>D,version:()=>R});var K=h(j());var v=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string"&&typeof process.browser>"u",F=v&&typeof module<"u"&&typeof module.exports<"u"&&typeof g<"u"&&typeof __dirname<"u",B=v&&!F,pe=typeof Deno<"u",H=!v&&!pe,z=H&&typeof window=="object"&&typeof document=="object"&&typeof document.createElement=="function"&&typeof sessionStorage=="object"&&typeof importScripts!="function",q=H&&typeof importScripts=="function"&&typeof self=="object",ke=typeof navigator=="object"&&typeof navigator.userAgent=="string"&&navigator.userAgent.indexOf("Chrome")==-1&&navigator.userAgent.indexOf("Safari")>-1;var J,k,X,V,I;async function A(){if(!v||(J=(await import(/* webpackIgnore */"node:url")).default,V=await import(/* webpackIgnore */"node:fs"),I=await import(/* webpackIgnore */"node:fs/promises"),X=(await import(/* webpackIgnore */"node:vm")).default,k=await import(/* webpackIgnore */"node:path"),L=k.sep,typeof g<"u"))return;let t=V,e=await import(/* webpackIgnore */"node:crypto"),o=await import(/* webpackIgnore */"ws"),a=await import(/* webpackIgnore */"node:child_process"),l={fs:t,crypto:e,ws:o,child_process:a};globalThis.require=function(n){return l[n]}}f(A,"initNodeModules");function me(t,e){return k.resolve(e||".",t)}f(me,"node_resolvePath");function ye(t,e){return e===void 0&&(e=location),new URL(t,e).toString()}f(ye,"browser_resolvePath");var O;v?O=me:O=ye;var L;v||(L="/");function ge(t,e){return t.startsWith("file://")&&(t=t.slice(7)),t.includes("://")?{response:fetch(t)}:{binary:I.readFile(t).then(o=>new Uint8Array(o.buffer,o.byteOffset,o.byteLength))}}f(ge,"node_getBinaryResponse");function he(t,e){let o=new URL(t,location);return{response:fetch(o,e?{integrity:e}:{})}}f(he,"browser_getBinaryResponse");var _;v?_=ge:_=he;async function G(t,e){let{response:o,binary:a}=_(t,e);if(a)return a;let l=await o;if(!l.ok)throw new Error(`Failed to load '${t}': request failed.`);return new Uint8Array(await l.arrayBuffer())}f(G,"loadBinaryFile");var S;if(z)S=f(async t=>await import(/* webpackIgnore */t),"loadScript");else if(q)S=f(async t=>{try{globalThis.importScripts(t)}catch(e){if(e instanceof TypeError)await import(/* webpackIgnore */t);else throw e}},"loadScript");else if(v)S=ve;else throw new Error("Cannot determine runtime environment");async function ve(t){t.startsWith("file://")&&(t=t.slice(7)),t.includes("://")?X.runInThisContext(await(await fetch(t)).text()):await import(/* webpackIgnore */J.pathToFileURL(t).href)}f(ve,"nodeLoadScript");async function Y(t){if(v){await A();let e=await I.readFile(t,{encoding:"utf8"});return JSON.parse(e)}else return await(await fetch(t)).json()}f(Y,"loadLockFile");async function Q(){if(F)return __dirname;let t;try{throw new Error}catch(a){t=a}let e=K.default.parse(t)[0].fileName;if(B){let a=await import(/* webpackIgnore */"node:path");return(await import(/* webpackIgnore */"node:url")).fileURLToPath(a.dirname(e))}let o=e.lastIndexOf(L);if(o===-1)throw new Error("Could not extract indexURL path from pyodide module location");return e.slice(0,o)}f(Q,"calculateDirname");function Z(t){let e=t.FS,o=t.FS.filesystems.MEMFS,a=t.PATH,l={DIR_MODE:16895,FILE_MODE:33279,mount:function(n){if(!n.opts.fileSystemHandle)throw new Error("opts.fileSystemHandle is required");return o.mount.apply(null,arguments)},syncfs:async(n,r,u)=>{try{let i=l.getLocalSet(n),c=await l.getRemoteSet(n),s=r?c:i,m=r?i:c;await l.reconcile(n,s,m),u(null)}catch(i){u(i)}},getLocalSet:n=>{let r=Object.create(null);function u(s){return s!=="."&&s!==".."}f(u,"isRealDir");function i(s){return m=>a.join2(s,m)}f(i,"toAbsolute");let c=e.readdir(n.mountpoint).filter(u).map(i(n.mountpoint));for(;c.length;){let s=c.pop(),m=e.stat(s);e.isDir(m.mode)&&c.push.apply(c,e.readdir(s).filter(u).map(i(s))),r[s]={timestamp:m.mtime,mode:m.mode}}return{type:"local",entries:r}},getRemoteSet:async n=>{let r=Object.create(null),u=await Ee(n.opts.fileSystemHandle);for(let[i,c]of u)i!=="."&&(r[a.join2(n.mountpoint,i)]={timestamp:c.kind==="file"?(await c.getFile()).lastModifiedDate:new Date,mode:c.kind==="file"?l.FILE_MODE:l.DIR_MODE});return{type:"remote",entries:r,handles:u}},loadLocalEntry:n=>{let u=e.lookupPath(n).node,i=e.stat(n);if(e.isDir(i.mode))return{timestamp:i.mtime,mode:i.mode};if(e.isFile(i.mode))return u.contents=o.getFileDataAsTypedArray(u),{timestamp:i.mtime,mode:i.mode,contents:u.contents};throw new Error("node type not supported")},storeLocalEntry:(n,r)=>{if(e.isDir(r.mode))e.mkdirTree(n,r.mode);else if(e.isFile(r.mode))e.writeFile(n,r.contents,{canOwn:!0});else throw new Error("node type not supported");e.chmod(n,r.mode),e.utime(n,r.timestamp,r.timestamp)},removeLocalEntry:n=>{var r=e.stat(n);e.isDir(r.mode)?e.rmdir(n):e.isFile(r.mode)&&e.unlink(n)},loadRemoteEntry:async n=>{if(n.kind==="file"){let r=await n.getFile();return{contents:new Uint8Array(await r.arrayBuffer()),mode:l.FILE_MODE,timestamp:r.lastModifiedDate}}else{if(n.kind==="directory")return{mode:l.DIR_MODE,timestamp:new Date};throw new Error("unknown kind: "+n.kind)}},storeRemoteEntry:async(n,r,u)=>{let i=n.get(a.dirname(r)),c=e.isFile(u.mode)?await i.getFileHandle(a.basename(r),{create:!0}):await i.getDirectoryHandle(a.basename(r),{create:!0});if(c.kind==="file"){let s=await c.createWritable();await s.write(u.contents),await s.close()}n.set(r,c)},removeRemoteEntry:async(n,r)=>{await n.get(a.dirname(r)).removeEntry(a.basename(r)),n.delete(r)},reconcile:async(n,r,u)=>{let i=0,c=[];Object.keys(r.entries).forEach(function(p){let d=r.entries[p],y=u.entries[p];(!y||e.isFile(d.mode)&&d.timestamp.getTime()>y.timestamp.getTime())&&(c.push(p),i++)}),c.sort();let s=[];if(Object.keys(u.entries).forEach(function(p){r.entries[p]||(s.push(p),i++)}),s.sort().reverse(),!i)return;let m=r.type==="remote"?r.handles:u.handles;for(let p of c){let d=a.normalize(p.replace(n.mountpoint,"/")).substring(1);if(u.type==="local"){let y=m.get(d),E=await l.loadRemoteEntry(y);l.storeLocalEntry(p,E)}else{let y=l.loadLocalEntry(p);await l.storeRemoteEntry(m,d,y)}}for(let p of s)if(u.type==="local")l.removeLocalEntry(p);else{let d=a.normalize(p.replace(n.mountpoint,"/")).substring(1);await l.removeRemoteEntry(m,d)}}};t.FS.filesystems.NATIVEFS_ASYNC=l}f(Z,"initializeNativeFS");var Ee=f(async t=>{let e=[];async function o(l){for await(let n of l.values())e.push(n),n.kind==="directory"&&await o(n)}f(o,"collect"),await o(t);let a=new Map;a.set(".",t);for(let l of e){let n=(await t.resolve(l)).join("/");a.set(n,l)}return a},"getFsHandles");function ee(t){let e={noImageDecoding:!0,noAudioDecoding:!0,noWasmDecoding:!1,preRun:Re(t),quit(o,a){throw e.exited={status:o,toThrow:a},a},print:t.stdout,printErr:t.stderr,arguments:t.args,API:{config:t},locateFile:o=>t.indexURL+o,instantiateWasm:Oe(t.indexURL)};return e}f(ee,"createSettings");function be(t){return function(e){let o="/";try{e.FS.mkdirTree(t)}catch(a){console.error(`Error occurred while making a home directory '${t}':`),console.error(a),console.error(`Using '${o}' for a home directory instead`),t=o}e.FS.chdir(t)}}f(be,"createHomeDirectory");function we(t){return function(e){Object.assign(e.ENV,t)}}f(we,"setEnvironment");function Se(t){return e=>{for(let o of t)e.FS.mkdirTree(o),e.FS.mount(e.FS.filesystems.NODEFS,{root:o},o)}}f(Se,"mountLocalDirectories");function _e(t){let e=G(t);return o=>{let a=o._py_version_major(),l=o._py_version_minor();o.FS.mkdirTree("/lib"),o.FS.mkdirTree(`/lib/python${a}.${l}/site-packages`),o.addRunDependency("install-stdlib"),e.then(n=>{o.FS.writeFile(`/lib/python${a}${l}.zip`,n)}).catch(n=>{console.error("Error occurred while installing the standard library:"),console.error(n)}).finally(()=>{o.removeRunDependency("install-stdlib")})}}f(_e,"installStdlib");function Re(t){let e;return t.stdLibURL!=null?e=t.stdLibURL:e=t.indexURL+"python_stdlib.zip",[_e(e),be(t.env.HOME),we(t.env),Se(t._node_mounts),Z]}f(Re,"getFileSystemInitializationFuncs");function Oe(t){let{binary:e,response:o}=_(t+"pyodide.asm.wasm");return function(a,l){return async function(){try{let n;o?n=await WebAssembly.instantiateStreaming(o,a):n=await WebAssembly.instantiate(await e,a);let{instance:r,module:u}=n;typeof WasmOffsetConverter<"u"&&(wasmOffsetConverter=new WasmOffsetConverter(wasmBinary,u)),l(r,u)}catch(n){console.warn("wasm instantiation failed!"),console.warn(n)}}(),{}}}f(Oe,"getInstantiateWasmFunc");var R="0.26.1";async function D(t={}){await A();let e=t.indexURL||await Q();e=O(e),e.endsWith("/")||(e+="/"),t.indexURL=e;let o={fullStdLib:!1,jsglobals:globalThis,stdin:globalThis.prompt?globalThis.prompt:void 0,lockFileURL:e+"pyodide-lock.json",args:[],_node_mounts:[],env:{},packageCacheDir:e,packages:[],enableRunUntilComplete:!1},a=Object.assign(o,t);a.env.HOME||(a.env.HOME="/home/pyodide");let l=ee(a),n=l.API;if(n.lockFilePromise=Y(a.lockFileURL),typeof _createPyodideModule!="function"){let s=`${a.indexURL}pyodide.asm.js`;await S(s)}let r;if(t._loadSnapshot){let s=await t._loadSnapshot;ArrayBuffer.isView(s)?r=s:r=new Uint8Array(s),l.noInitialRun=!0,l.INITIAL_MEMORY=r.length}let u=await _createPyodideModule(l);if(l.exited)throw l.exited.toThrow;if(t.pyproxyToStringRepr&&n.setPyProxyToStringMethod(!0),n.version!==R)throw new Error(`Pyodide version does not match: '${R}' <==> '${n.version}'. If you updated the Pyodide version, make sure you also updated the 'indexURL' parameter passed to loadPyodide.`);u.locateFile=s=>{throw new Error("Didn't expect to load any more file_packager files!")};let i;r&&(i=n.restoreSnapshot(r));let c=n.finalizeBootstrap(i);return n.sys.path.insert(0,n.config.env.HOME),c.version.includes("dev")||n.setCdnUrl(`https://cdn.jsdelivr.net/pyodide/v${c.version}/full/`),n._pyodide.set_excepthook(),await n.packageIndexReady,n.initializeStreams(a.stdin,a.stdout,a.stderr),c}f(D,"loadPyodide");globalThis.loadPyodide=D;return ue(Ne);})(); try{Object.assign(exports,loadPyodide)}catch(_){} globalThis.loadPyodide=loadPyodide.loadPyodide; //# sourceMappingURL=pyodide.js.map