varoe=Object.create;varN=Object.defineProperty;varse=Object.getOwnPropertyDescriptor;varae=Object.getOwnPropertyNames;varce=Object.getPrototypeOf,le=Object.prototype.hasOwnProperty;varf=(t,e)=>N(t,"name",{value:e,configurable:!0}),b=(t=>typeofrequire<"u"?require:typeofProxy<"u"?newProxy(t,{get:(e,c)=>(typeofrequire<"u"?require:e)[c]}):t)(function(t){if(typeofrequire<"u")returnrequire.apply(this,arguments);thrownewError('Dynamic require of "'+t+'" is not supported')});varD=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports);varde=(t,e,c,o)=>{if(e&&typeofe=="object"||typeofe=="function")for(letsofae(e))!le.call(t,s)&&s!==c&&N(t,s,{get:()=>e[s],enumerable:!(o=se(e,s))||o.enumerable});returnt};varfe=(t,e,c)=>(c=t!=null?oe(ce(t)):{},de(e||!t||!t.__esModule?N(c,"default",{value:t,enumerable:!0}):c,t));var$=D((R,T)=>{(function(t,e){"use strict";typeofdefine=="function"&&define.amd?define("stackframe",[],e):typeofR=="object"?T.exports=e():t.StackFrame=e()})(R,function(){"use strict";functiont(d){return!isNaN(parseFloat(d))&&isFinite(d)}f(t,"_isNumber");functione(d){returnd.charAt(0).toUpperCase()+d.substring(1)}f(e,"_capitalize");functionc(d){returnfunction(){returnthis[d]}}f(c,"_getter");varo=["isConstructor","isEval","isNative","isToplevel"],s=["columnNumber","lineNumber"],r=["fileName","functionName","source"],n=["args"],u=["evalOrigin"],i=o.concat(s,r,n,u);functiona(d){if(d)for(varg=0;g<i.length;g++)d[i[g]]!==void0&&this["set"+e(i[g])](d[i[g]])}f(a,"StackFrame"),a.prototype={getArgs:function(){returnthis.args},setArgs:function(d){if(Object.prototype.toString.call(d)!=="[object Array]")thrownewTypeError("Args must be an Array");this.args=d},getEvalOrigin:function(){returnthis.evalOrigin},setEvalOrigin:function(d){if(dinstanceofa)this.evalOrigin=d;elseif(dinstanceofObject)this.evalOrigin=newa(d);elsethrownewTypeError("Eval Origin must be an Object or StackFrame")},toString:function(){vard=this.getFileName()||"",g=this.getLineNumber()||"",v=this.getColumnNumber()||"",h=this.getFunctionName()||"";returnthis.getIsEval()?d?"[eval] ("+d+":"+g+":"+v+")":"[eval]:"+g+":"+v:h?h+" ("+d+":"+g+":"+v+")":d+":"+g+":"+v}},a.fromString=f(function(g){varv=g.indexOf("("),h=g.lastIndexOf(")"),ee=g.substring(0,v),te=g.substring(v+1,h).split(","),A=g.substring(h+1);if(A.indexOf("@")===0)varO=/@(.+?)(?::(\d+))?(?::(\d+))?$/.exec(A,""),re=O[1],ne=O[2],ie=O[3];returnnewa({functionName:ee,args:te||void0,fileName:re,lineNumber:ne||void0,columnNumber:ie||void0})},"StackFrame$$fromString");for(varl=0;l<o.length;l++)a.prototype["get"+e(o[l])]=c(o[l]),a.prototype["set"+e(o[l])]=function(d){returnfunction(g){this[d]=!!g}}(o[l]);for(varm=0;m<s.length;m++)a.prototype["get"+e(s[m])]=c(s[m]),a.prototype["set"+e(s[m])]=function(d){returnfunction(g){if(!t(g))thrownewTypeError(d+" must be a Number");this[d]=Number(g)}}(s[m]);for(varp=0;p<r.length;p++)a.prototype["get"+e(r[p])]=c(r[p]),a.prototype["set"+e(r[p])]=function(d){returnfunction(g){this[d]=String(g)}}(r[p]);returna})});varU=D((k,M)=>{(function(t,e){"use strict";typeofdefine=="function"&&define.amd?define("error-stack-parser",["stackframe"],e):typeofk=="object"?M.exports=e($()):t.ErrorStackParser=e(t.StackFrame)})(k,f(function(e){"use strict";varc=/(^|@)\S+:\d+/,o=/^\s*at .*(\S+:\d+|\(native\))/m,s=/^(eval@)?(\[native code])?$/;return{parse:f(function(n){if(typeofn.stacktrace<"u"||typeofn["opera#sourceloc"]<"u")returnthis.parseOpera(n);if(n.stack&&n.stack.match(o))returnthis.parseV8OrIE(n);if(n.stack)returnthis.parseFFOrSafari(n);thrownewError("Cannot parse given Error object")},"ErrorStackParser$$parse"),extractLocation:f(function(n){if(n.indexOf(":")===-1)return[n];varu=/(.+?)(?::(\d+))?(?::(\d+))?$/,i=u.exec(n.replace(/[()]/g,""));return[i[1],i[2]||void0,i[3]||void0]},"ErrorStackParser$$extractLocation"),parseV8OrIE:f(function(n){varu=n.stack.split(`
`).filter(function(i){return!!i.match(o)},this);return u.map(function(i){i.indexOf("(eval ")>-1&&(i=i.replace(/eval code/g,"eval").replace(/(\(eval at [^()]*)|(,.*$)/g,""));var a=i.replace(/^\s+/,"").replace(/\(eval code/g,"(").replace(/^.*?\s+/,""),l=a.match(/ (\(.+\)$)/);a=l?a.replace(l[0],""):a;var m=this.extractLocation(l?l[1]:a),p=l&&a||void 0,d=["eval","<anonymous>"].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(n){var u=n.stack.split(`
`).filter(function(i){return!i.match(s)},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 a=/((.*".+"[^@]*)?[^@]*)(?:@)/,l=i.match(a),m=l&&l[1]?l[1]:void 0,p=this.extractLocation(i.replace(a,""));return new e({functionName:m,fileName:p[0],lineNumber:p[1],columnNumber:p[2],source:i})},this)},"ErrorStackParser$$parseFFOrSafari"),parseOpera:f(function(n){return!n.stacktrace||n.message.indexOf(`
`).filter(function(i){return!!i.match(c)&&!i.match(/^Error created at/)},this);return u.map(function(i){var a=i.split("@"),l=this.extractLocation(a.pop()),m=a.shift()||"",p=m.replace(/<anonymous function(: (\w+))?>/,"$2").replace(/\([^)]*\)/g,"")||void 0,d;m.match(/\(([^)]*)\)/)&&(d=m.replace(/^[^(]+\(([^)]*)\)$/,"$1"));var g=d===void 0||d==="[arguments not available]"?void 0:d.split(",");return new e({functionName:p,args:g,fileName:l[0],lineNumber:l[1],columnNumber:l[2],source:i})},this)},"ErrorStackParser$$parseOpera11")}},"ErrorStackParser"))});var z=fe(U());var y=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string"&&typeof process.browser>"u",x=y&&typeof module<"u"&&typeof module.exports<"u"&&typeof b<"u"&&typeof __dirname<"u",C=y&&!x,ue=typeof Deno<"u",B=!y&&!ue,W=B&&typeof window<"u"&&typeof document<"u"&&typeof document.createElement<"u"&&typeof sessionStorage<"u"&&typeof importScripts>"u",j=B&&typeof importScripts<"u"&&typeof self<"u",Re=typeof navigator<"u"&&typeof navigator.userAgent<"u"&&navigator.userAgent.indexOf("Chrome")==-1&&navigator.userAgent.indexOf("Safari")>-1;var q,P,V,H,F;async function I(){if(!y||(q=(await import("node:url")).default,H=await import("node:fs"),F=await import("node:fs/promises"),V=(await import("node:vm")).default,P=await import("node:path"),L=P.sep,typeof b<"u"))return;let t=H,e=await import("node:crypto"),c=await import("ws"),o=await import("node:child_process"),s={fs:t,crypto:e,ws:c,child_process:o};globalThis.require=function(r){return s[r]}}f(I,"initNodeModules");function pe(t,e){return P.resolve(e||".",t)}f(pe,"node_resolvePath");function me(t,e){return e===void 0&&(e=location),new URL(t,e).toString()}f(me,"browser_resolvePath");var S;y?S=pe:S=me;var L;y||(L="/");function ge(t,e){return t.startsWith("file://")&&(t=t.slice(7)),t.includes("://")?{response:fetch(t)}:{binary:F.readFile(t).then(c=>new Uint8Array(c.buffer,c.byteOffset,c.byteLength))}}f(ge,"node_getBinaryResponse");function ye(t,e){let c=new URL(t,location);return{response:fetch(c,e?{integrity:e}:{})}}f(ye,"browser_getBinaryResponse");var E;y?E=ge:E=ye;async function K(t,e){let{response:c,binary:o}=E(t,e);if(o)return o;let s=await c;if(!s.ok)throw new Error(`Failedtoload'${t}':requestfailed.`);return new Uint8Array(await s.arrayBuffer())}f(K,"loadBinaryFile");var w;if(W)w=f(async t=>await import(t),"loadScript");else if(j)w=f(async t=>{try{globalThis.importScripts(t)}catch(e){if(e instanceof TypeError)await import(t);else throw e}},"loadScript");else if(y)w=ve;else throw new Error("Cannot determine runtime environment");async function ve(t){t.startsWith("file://")&&(t=t.slice(7)),t.includes("://")?V.runInThisContext(await(await fetch(t)).text()):await import(q.pathToFileURL(t).href)}f(ve,"nodeLoadScript");async function J(t){if(y){await I();let e=await F.readFile(t,{encoding:"utf8"});return JSON.parse(e)}else return await(await fetch(t)).json()}f(J,"loadLockFile");async function X(){if(x)return __dirname;let t;try{throw new Error}catch(o){t=o}let e=z.default.parse(t)[0].fileName;if(C){let o=await import("node:path");return(await import("node:url")).fileURLToPath(o.dirname(e))}let c=e.lastIndexOf(L);if(c===-1)throw new Error("Could not extract indexURL path from pyodide module location");return e.slice(0,c)}f(X,"calculateDirname");function G(t){let e=t.FS,c=t.FS.filesystems.MEMFS,o=t.PATH,s={DIR_MODE:16895,FILE_MODE:33279,mount:function(r){if(!r.opts.fileSystemHandle)throw new Error("opts.fileSystemHandle is required");return c.mount.apply(null,arguments)},syncfs:async(r,n,u)=>{try{let i=s.getLocalSet(r),a=await s.getRemoteSet(r),l=n?a:i,m=n?i:a;await s.reconcile(r,l,m),u(null)}catch(i){u(i)}},getLocalSet:r=>{let n=Object.create(null);function u(l){return l!=="."&&l!==".."}f(u,"isRealDir");function i(l){return m=>o.join2(l,m)}f(i,"toAbsolute");let a=e.readdir(r.mountpoint).filter(u).map(i(r.mountpoint));for(;a.length;){let l=a.pop(),m=e.stat(l);e.isDir(m.mode)&&a.push.apply(a,e.readdir(l).filter(u).map(i(l))),n[l]={timestamp:m.mtime,mode:m.mode}}return{type:"local",
lockfileversion:${r.lockfile_info.version}
pyodideversion:${_}`);return r.package_loader.init_loaded_packages(),o.fullStdLib&&await u.loadPackage(r.lockfile_unvendored_stdlibs),r.initializeStreams(o.stdin,o.stdout,o.stderr),u}f(je,"loadPyodide");export{je as loadPyodide,_ as version};