pyodide 0.28.0 → 0.28.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/pyodide.asm.wasm CHANGED
Binary file
package/pyodide.d.ts CHANGED
@@ -1,14 +1,5 @@
1
1
  // Generated by dts-bundle-generator v8.1.2
2
2
 
3
- /**
4
- *
5
- * The Pyodide version.
6
- *
7
- * The version here is a Python version, following :pep:`440`. This is different
8
- * from the version in ``package.json`` which follows the node package manager
9
- * version convention.
10
- */
11
- export declare const version: string;
12
3
  interface CanvasInterface {
13
4
  setCanvas2D(canvas: HTMLCanvasElement): void;
14
5
  getCanvas2D(): HTMLCanvasElement | undefined;
@@ -35,6 +26,9 @@ declare function setStderr(options?: {
35
26
  write?: (buffer: Uint8Array) => number;
36
27
  isatty?: boolean;
37
28
  }): void;
29
+ /**
30
+ * @docgroup pyodide.ffi
31
+ */
38
32
  /** @deprecated Use `import type { TypedArray } from "pyodide/ffi"` instead */
39
33
  export type TypedArray = Int8Array | Uint8Array | Int16Array | Uint16Array | Int32Array | Uint32Array | Uint8ClampedArray | Float32Array | Float64Array;
40
34
  type FSNode = {
@@ -89,6 +83,7 @@ interface FSType {
89
83
  utime: (path: string, atime: number, mtime: number) => void;
90
84
  rmdir: (path: string) => void;
91
85
  mount: (type: any, opts: any, mountpoint: string) => any;
86
+ unmount: (mountpoint: string) => any;
92
87
  write: (stream: FSStream, buffer: any, offset: number, length: number, position?: number) => number;
93
88
  close: (stream: FSStream) => void;
94
89
  ErrnoError: {
@@ -97,17 +92,87 @@ interface FSType {
97
92
  registerDevice<T>(dev: number, ops: FSStreamOpsGen<T>): void;
98
93
  syncfs(dir: boolean, oncomplete: (val: void) => void): void;
99
94
  }
100
- type LockfileInfo = {
101
- arch: "wasm32" | "wasm64";
95
+ /**
96
+ * The lockfile platform info. The ``abi_version`` field is used to check if the
97
+ * lockfile is compatible with the interpreter. The remaining fields are
98
+ * informational.
99
+ */
100
+ interface LockfileInfo {
101
+ /**
102
+ * Machine architecture. At present, only can be wasm32. Pyodide has no wasm64
103
+ * build.
104
+ */
105
+ arch: "wasm32";
106
+ /**
107
+ * The ABI version is structured as ``yyyy_patch``. For the lockfile to be
108
+ * compatible with the current interpreter this field must match exactly with
109
+ * the ABI version of the interpreter.
110
+ */
102
111
  abi_version: string;
112
+ /**
113
+ * The Emscripten versions for instance, `emscripten_4_0_9`. Different
114
+ * Emscripten versions have different ABIs so if this changes ``abi_version``
115
+ * must also change.
116
+ */
103
117
  platform: string;
118
+ /**
119
+ * The Pyodide version the lockfile was made with. Informational only, has no
120
+ * compatibility implications. May be removed in the future.
121
+ */
104
122
  version: string;
123
+ /**
124
+ * The Python version this lock file was made with. If the minor version
125
+ * changes (e.g, 3.12 to 3.13) this changes the ABI and the ``abi_version``
126
+ * must change too. Patch versions do not imply a change to the
127
+ * ``abi_version``.
128
+ */
105
129
  python: string;
106
- };
107
- type Lockfile = {
130
+ }
131
+ /**
132
+ * A package entry in the lock file.
133
+ */
134
+ interface LockfilePackage {
135
+ /**
136
+ * The unnormalized name of the package.
137
+ */
138
+ name: string;
139
+ version: string;
140
+ /**
141
+ * The file name or url of the package wheel. If it's relative, it will be
142
+ * resolved with respect to ``packageBaseUrl``. If there is no
143
+ * ``packageBaseUrl``, attempting to install a package with a relative
144
+ * ``file_name`` will fail.
145
+ */
146
+ file_name: string;
147
+ package_type: PackageType;
148
+ /**
149
+ * The installation directory. Will be ``site`` except for certain system
150
+ * dynamic libraries that need to go on the global LD_LIBRARY_PATH.
151
+ */
152
+ install_dir: "site" | "dynlib";
153
+ /**
154
+ * Integrity. Must be present unless ``checkIntegrity: false`` is passed to
155
+ * ``loadPyodide``.
156
+ */
157
+ sha256: string;
158
+ /**
159
+ * The set of imports provided by this package as best we can tell. Used by
160
+ * :js:func:`pyodide.loadPackagesFromImports` to work out what packages to
161
+ * install.
162
+ */
163
+ imports: string[];
164
+ /**
165
+ * The set of dependencies of this package.
166
+ */
167
+ depends: string[];
168
+ }
169
+ /**
170
+ * The type of a package lockfile.
171
+ */
172
+ interface Lockfile {
108
173
  info: LockfileInfo;
109
- packages: Record<string, InternalPackageData>;
110
- };
174
+ packages: Record<string, LockfilePackage>;
175
+ }
111
176
  type PackageType = "package" | "cpython_module" | "shared_library" | "static_library";
112
177
  interface PackageData {
113
178
  name: string;
@@ -117,16 +182,6 @@ interface PackageData {
117
182
  packageType: PackageType;
118
183
  }
119
184
  type LoadedPackages = Record<string, string>;
120
- type InternalPackageData = {
121
- name: string;
122
- version: string;
123
- file_name: string;
124
- package_type: PackageType;
125
- install_dir: string;
126
- sha256: string;
127
- imports: string[];
128
- depends: string[];
129
- };
130
185
  /** @deprecated Use `import type { PyProxy } from "pyodide/ffi"` instead */
131
186
  interface PyProxy {
132
187
  [x: string]: any;
@@ -160,7 +215,7 @@ declare class PyProxy {
160
215
  get type(): string;
161
216
  /**
162
217
  * Returns `str(o)` (unless `pyproxyToStringRepr: true` was passed to
163
- * :js:func:`~globalThis.loadPyodide` in which case it will return `repr(o)`)
218
+ * :js:func:`~exports.loadPyodide` in which case it will return `repr(o)`)
164
219
  */
165
220
  toString(): string;
166
221
  /**
@@ -1095,7 +1150,7 @@ declare class PythonError extends Error {
1095
1150
  type NativeFS = {
1096
1151
  syncfs: () => Promise<void>;
1097
1152
  };
1098
- declare class PyodideAPI {
1153
+ declare class PyodideAPI_ {
1099
1154
  /** @hidden */
1100
1155
  static version: string;
1101
1156
  /** @hidden */
@@ -1473,9 +1528,7 @@ declare class PyodideAPI {
1473
1528
  */
1474
1529
  static setDebug(debug: boolean): boolean;
1475
1530
  /**
1476
- *
1477
- * @param param0
1478
- * @returns
1531
+ * @private
1479
1532
  */
1480
1533
  static makeMemorySnapshot({ serializer, }?: {
1481
1534
  serializer?: (obj: any) => any;
@@ -1487,13 +1540,26 @@ declare class PyodideAPI {
1487
1540
  */
1488
1541
  static get lockfile(): Lockfile;
1489
1542
  /**
1490
- * Returns the base URL of the lockfile, which is used to locate the packages
1491
- * distributed with the lockfile.
1543
+ * Returns the URL or path with respect to which relative paths in the lock
1544
+ * file are resolved, or undefined.
1492
1545
  */
1493
- static get lockfileBaseUrl(): string;
1546
+ static get lockfileBaseUrl(): string | undefined;
1494
1547
  }
1495
- /** @hidden */
1496
- export type PyodideInterface = typeof PyodideAPI;
1548
+ /**
1549
+ * The return type of :js:func:`~exports.loadPyodide`. See
1550
+ * :ref:`the pyodide api docs <js-api-pyodide>` for more information.
1551
+ * @hidetype
1552
+ * @docgroup exports
1553
+ */
1554
+ export type PyodideAPI = typeof PyodideAPI_;
1555
+ /**
1556
+ * The Pyodide version.
1557
+ *
1558
+ * The version here is a Python version, following :pep:`440`. This is different
1559
+ * from the version in ``package.json`` which follows the node package manager
1560
+ * version convention.
1561
+ */
1562
+ export declare const version: string;
1497
1563
  /**
1498
1564
  * See documentation for loadPyodide.
1499
1565
  * @hidden
@@ -1501,7 +1567,7 @@ export type PyodideInterface = typeof PyodideAPI;
1501
1567
  type ConfigType = {
1502
1568
  indexURL: string;
1503
1569
  packageCacheDir: string;
1504
- lockFileURL: string;
1570
+ lockFileContents: Lockfile | string | Promise<Lockfile | string>;
1505
1571
  fullStdLib?: boolean;
1506
1572
  stdLibURL?: string;
1507
1573
  stdin?: () => string;
@@ -1521,6 +1587,8 @@ type ConfigType = {
1521
1587
  enableRunUntilComplete: boolean;
1522
1588
  checkAPIVersion: boolean;
1523
1589
  BUILD_ID: string;
1590
+ packageBaseUrl?: string;
1591
+ cdnUrl: string;
1524
1592
  };
1525
1593
  /**
1526
1594
  * Load the main Pyodide wasm module and initialize it.
@@ -1561,6 +1629,26 @@ export declare function loadPyodide(options?: {
1561
1629
  * Default: ```${indexURL}/pyodide-lock.json```
1562
1630
  */
1563
1631
  lockFileURL?: string;
1632
+ /**
1633
+ * The contents of a lockfile. If a string, it should be valid json and
1634
+ * ``JSON.parse()`` should return a ``Lockfile`` instance. See
1635
+ * :js:interface:`~pyodide.Lockfile` for the schema.
1636
+ */
1637
+ lockFileContents?: Lockfile | string | Promise<Lockfile | string>;
1638
+ /**
1639
+ * The base url relative to which a relative value of
1640
+ * :js:attr:`~pyodide.LockfilePackage.file_name` is interpreted. If
1641
+ * ``lockfileContents`` is provided, then ``lockFileContents`` must be
1642
+ * provided explicitly in order to install packages with relative paths.
1643
+ *
1644
+ * Otherwise, the default is calculated as follows:
1645
+ *
1646
+ * 1. If `lockFileURL` contains a ``/``, the default is everything before the last
1647
+ * ``/`` in ``lockFileURL``.
1648
+ * 2. If in the browser, the default is ``location.toString()``.
1649
+ * 3. Otherwise, the default is `'.'`.
1650
+ */
1651
+ packageBaseUrl?: string;
1564
1652
  /**
1565
1653
  * Load the full Python standard library. Setting this to false excludes
1566
1654
  * unvendored modules from the standard library.
@@ -1672,7 +1760,7 @@ export declare function loadPyodide(options?: {
1672
1760
  _loadSnapshot?: Uint8Array | ArrayBuffer | PromiseLike<Uint8Array | ArrayBuffer>;
1673
1761
  /** @ignore */
1674
1762
  _snapshotDeserializer?: (obj: any) => any;
1675
- }): Promise<PyodideInterface>;
1763
+ }): Promise<PyodideAPI>;
1676
1764
 
1677
1765
  export type {};
1678
- export type {PackageData};
1766
+ export type {Lockfile, LockfileInfo, LockfilePackage, PackageData};
package/pyodide.js CHANGED
@@ -1,6 +1,6 @@
1
- "use strict";var loadPyodide=(()=>{var se=Object.create;var k=Object.defineProperty;var ae=Object.getOwnPropertyDescriptor;var ce=Object.getOwnPropertyNames;var le=Object.getPrototypeOf,de=Object.prototype.hasOwnProperty;var s=(e,t)=>k(e,"name",{value:t,configurable:!0}),f=(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 ue=(e,t)=>{for(var r in t)k(e,r,{get:t[r],enumerable:!0})},j=(e,t,r,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of ce(t))!de.call(e,a)&&a!==r&&k(e,a,{get:()=>t[a],enumerable:!(i=ae(t,a))||i.enumerable});return e};var b=(e,t,r)=>(r=e!=null?se(le(e)):{},j(t||!e||!e.__esModule?k(r,"default",{value:e,enumerable:!0}):r,e)),fe=e=>j(k({},"__esModule",{value:!0}),e);var H=(()=>{for(var e=new Uint8Array(128),t=0;t<64;t++)e[t<26?t+65:t<52?t+71:t<62?t-4:t*4-205]=t;return r=>{for(var i=r.length,a=new Uint8Array((i-(r[i-1]=="=")-(r[i-2]=="="))*3/4|0),n=0,o=0;n<i;){var c=e[r.charCodeAt(n++)],l=e[r.charCodeAt(n++)],d=e[r.charCodeAt(n++)],u=e[r.charCodeAt(n++)];a[o++]=c<<2|l>>4,a[o++]=l<<4|d>>2,a[o++]=d<<6|u}return a}})();var De={};ue(De,{loadPyodide:()=>B,version:()=>O});function me(e){return!isNaN(parseFloat(e))&&isFinite(e)}s(me,"_isNumber");function E(e){return e.charAt(0).toUpperCase()+e.substring(1)}s(E,"_capitalize");function D(e){return function(){return this[e]}}s(D,"_getter");var N=["isConstructor","isEval","isNative","isToplevel"],I=["columnNumber","lineNumber"],_=["fileName","functionName","source"],pe=["args"],ye=["evalOrigin"],L=N.concat(I,_,pe,ye);function p(e){if(e)for(var t=0;t<L.length;t++)e[L[t]]!==void 0&&this["set"+E(L[t])](e[L[t]])}s(p,"StackFrame");p.prototype={getArgs:s(function(){return this.args},"getArgs"),setArgs:s(function(e){if(Object.prototype.toString.call(e)!=="[object Array]")throw new TypeError("Args must be an Array");this.args=e},"setArgs"),getEvalOrigin:s(function(){return this.evalOrigin},"getEvalOrigin"),setEvalOrigin:s(function(e){if(e instanceof p)this.evalOrigin=e;else if(e instanceof Object)this.evalOrigin=new p(e);else throw new TypeError("Eval Origin must be an Object or StackFrame")},"setEvalOrigin"),toString:s(function(){var e=this.getFileName()||"",t=this.getLineNumber()||"",r=this.getColumnNumber()||"",i=this.getFunctionName()||"";return this.getIsEval()?e?"[eval] ("+e+":"+t+":"+r+")":"[eval]:"+t+":"+r:i?i+" ("+e+":"+t+":"+r+")":e+":"+t+":"+r},"toString")};p.fromString=s(function(t){var r=t.indexOf("("),i=t.lastIndexOf(")"),a=t.substring(0,r),n=t.substring(r+1,i).split(","),o=t.substring(i+1);if(o.indexOf("@")===0)var c=/@(.+?)(?::(\d+))?(?::(\d+))?$/.exec(o,""),l=c[1],d=c[2],u=c[3];return new p({functionName:a,args:n||void 0,fileName:l,lineNumber:d||void 0,columnNumber:u||void 0})},"StackFrame$$fromString");for(h=0;h<N.length;h++)p.prototype["get"+E(N[h])]=D(N[h]),p.prototype["set"+E(N[h])]=function(e){return function(t){this[e]=!!t}}(N[h]);var h;for(S=0;S<I.length;S++)p.prototype["get"+E(I[S])]=D(I[S]),p.prototype["set"+E(I[S])]=function(e){return function(t){if(!me(t))throw new TypeError(e+" must be a Number");this[e]=Number(t)}}(I[S]);var S;for(w=0;w<_.length;w++)p.prototype["get"+E(_[w])]=D(_[w]),p.prototype["set"+E(_[w])]=function(e){return function(t){this[e]=String(t)}}(_[w]);var w,T=p;function ge(){var e=/^\s*at .*(\S+:\d+|\(native\))/m,t=/^(eval@)?(\[native code])?$/;return{parse:s(function(i){if(i.stack&&i.stack.match(e))return this.parseV8OrIE(i);if(i.stack)return this.parseFFOrSafari(i);throw new Error("Cannot parse given Error object")},"ErrorStackParser$$parse"),extractLocation:s(function(i){if(i.indexOf(":")===-1)return[i];var a=/(.+?)(?::(\d+))?(?::(\d+))?$/,n=a.exec(i.replace(/[()]/g,""));return[n[1],n[2]||void 0,n[3]||void 0]},"ErrorStackParser$$extractLocation"),parseV8OrIE:s(function(i){var a=i.stack.split(`
2
- `).filter(function(n){return!!n.match(e)},this);return a.map(function(n){n.indexOf("(eval ")>-1&&(n=n.replace(/eval code/g,"eval").replace(/(\(eval at [^()]*)|(,.*$)/g,""));var o=n.replace(/^\s+/,"").replace(/\(eval code/g,"(").replace(/^.*?\s+/,""),c=o.match(/ (\(.+\)$)/);o=c?o.replace(c[0],""):o;var l=this.extractLocation(c?c[1]:o),d=c&&o||void 0,u=["eval","<anonymous>"].indexOf(l[0])>-1?void 0:l[0];return new T({functionName:d,fileName:u,lineNumber:l[1],columnNumber:l[2],source:n})},this)},"ErrorStackParser$$parseV8OrIE"),parseFFOrSafari:s(function(i){var a=i.stack.split(`
3
- `).filter(function(n){return!n.match(t)},this);return a.map(function(n){if(n.indexOf(" > eval")>-1&&(n=n.replace(/ line (\d+)(?: > eval line \d+)* > eval:\d+:\d+/g,":$1")),n.indexOf("@")===-1&&n.indexOf(":")===-1)return new T({functionName:n});var o=/((.*".+"[^@]*)?[^@]*)(?:@)/,c=n.match(o),l=c&&c[1]?c[1]:void 0,d=this.extractLocation(n.replace(o,""));return new T({functionName:l,fileName:d[0],lineNumber:d[1],columnNumber:d[2],source:n})},this)},"ErrorStackParser$$parseFFOrSafari")}}s(ge,"ErrorStackParser");var be=new ge;var V=be;var g=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string"&&!process.browser,U=g&&typeof module<"u"&&typeof module.exports<"u"&&typeof f<"u"&&typeof __dirname<"u",z=g&&!U,je=typeof globalThis.Bun<"u",ve=typeof Deno<"u",q=!g&&!ve,J=q&&typeof window=="object"&&typeof document=="object"&&typeof document.createElement=="function"&&"sessionStorage"in window&&typeof importScripts!="function",Y=q&&typeof importScripts=="function"&&typeof self=="object",He=typeof navigator=="object"&&typeof navigator.userAgent=="string"&&navigator.userAgent.indexOf("Chrome")==-1&&navigator.userAgent.indexOf("Safari")>-1,R=typeof read=="function"&&typeof load=="function";var G,C,X,K,M;async function W(){if(!g||(G=(await import(/* webpackIgnore */"node:url")).default,K=await import(/* webpackIgnore */"node:fs"),M=await import(/* webpackIgnore */"node:fs/promises"),X=(await import(/* webpackIgnore */"node:vm")).default,C=await import(/* webpackIgnore */"node:path"),$=C.sep,typeof f<"u"))return;let e=K,t=await import(/* webpackIgnore */"node:crypto"),r=await import(/* webpackIgnore */"ws"),i=await import(/* webpackIgnore */"node:child_process"),a={fs:e,crypto:t,ws:r,child_process:i};globalThis.require=function(n){return a[n]}}s(W,"initNodeModules");function he(e,t){return C.resolve(t||".",e)}s(he,"node_resolvePath");function Se(e,t){return t===void 0&&(t=location),new URL(e,t).toString()}s(Se,"browser_resolvePath");var A;g?A=he:R?A=s(e=>e,"resolvePath"):A=Se;var $;g||($="/");function we(e,t){return e.startsWith("file://")&&(e=e.slice(7)),e.includes("://")?{response:fetch(e)}:{binary:M.readFile(e).then(r=>new Uint8Array(r.buffer,r.byteOffset,r.byteLength))}}s(we,"node_getBinaryResponse");function Ee(e,t){if(e.startsWith("file://")&&(e=e.slice(7)),e.includes("://"))throw new Error("Shell cannot fetch urls");return{binary:Promise.resolve(new Uint8Array(readbuffer(e)))}}s(Ee,"shell_getBinaryResponse");function Pe(e,t){let r=new URL(e,location);return{response:fetch(r,t?{integrity:t}:{})}}s(Pe,"browser_getBinaryResponse");var x;g?x=we:R?x=Ee:x=Pe;async function Q(e,t){let{response:r,binary:i}=x(e,t);if(i)return i;let a=await r;if(!a.ok)throw new Error(`Failed to load '${e}': request failed.`);return new Uint8Array(await a.arrayBuffer())}s(Q,"loadBinaryFile");var F;if(J)F=s(async e=>await import(/* webpackIgnore */e),"loadScript");else if(Y)F=s(async e=>{try{globalThis.importScripts(e)}catch(t){if(t instanceof TypeError)await import(/* webpackIgnore */e);else throw t}},"loadScript");else if(g)F=Ne;else if(R)F=load;else throw new Error("Cannot determine runtime environment");async function Ne(e){e.startsWith("file://")&&(e=e.slice(7)),e.includes("://")?X.runInThisContext(await(await fetch(e)).text()):await import(/* webpackIgnore */G.pathToFileURL(e).href)}s(Ne,"nodeLoadScript");async function Z(e){if(g){await W();let t=await M.readFile(e,{encoding:"utf8"});return JSON.parse(t)}else if(R){let t=read(e);return JSON.parse(t)}else return await(await fetch(e)).json()}s(Z,"loadLockFile");async function ee(){if(U)return __dirname;let e;try{throw new Error}catch(i){e=i}let t=V.parse(e)[0].fileName;if(g&&!t.startsWith("file://")&&(t=`file://${t}`),z){let i=await import(/* webpackIgnore */"node:path");return(await import(/* webpackIgnore */"node:url")).fileURLToPath(i.dirname(t))}let r=t.lastIndexOf($);if(r===-1)throw new Error("Could not extract indexURL path from pyodide module location");return t.slice(0,r)}s(ee,"calculateDirname");function te(e){let t=e.FS,r=e.FS.filesystems.MEMFS,i=e.PATH,a={DIR_MODE:16895,FILE_MODE:33279,mount:s(function(n){if(!n.opts.fileSystemHandle)throw new Error("opts.fileSystemHandle is required");return r.mount.apply(null,arguments)},"mount"),syncfs:s(async(n,o,c)=>{try{let l=a.getLocalSet(n),d=await a.getRemoteSet(n),u=o?d:l,y=o?l:d;await a.reconcile(n,u,y),c(null)}catch(l){c(l)}},"syncfs"),getLocalSet:s(n=>{let o=Object.create(null);function c(u){return u!=="."&&u!==".."}s(c,"isRealDir");function l(u){return y=>i.join2(u,y)}s(l,"toAbsolute");let d=t.readdir(n.mountpoint).filter(c).map(l(n.mountpoint));for(;d.length;){let u=d.pop(),y=t.stat(u);t.isDir(y.mode)&&d.push.apply(d,t.readdir(u).filter(c).map(l(u))),o[u]={timestamp:y.mtime,mode:y.mode}}return{type:"local",entries:o}},"getLocalSet"),getRemoteSet:s(async n=>{let o=Object.create(null),c=await Ie(n.opts.fileSystemHandle);for(let[l,d]of c)l!=="."&&(o[i.join2(n.mountpoint,l)]={timestamp:d.kind==="file"?new Date((await d.getFile()).lastModified):new Date,mode:d.kind==="file"?a.FILE_MODE:a.DIR_MODE});return{type:"remote",entries:o,handles:c}},"getRemoteSet"),loadLocalEntry:s(n=>{let c=t.lookupPath(n).node,l=t.stat(n);if(t.isDir(l.mode))return{timestamp:l.mtime,mode:l.mode};if(t.isFile(l.mode))return c.contents=r.getFileDataAsTypedArray(c),{timestamp:l.mtime,mode:l.mode,contents:c.contents};throw new Error("node type not supported")},"loadLocalEntry"),storeLocalEntry:s((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)},"storeLocalEntry"),removeLocalEntry:s(n=>{var o=t.stat(n);t.isDir(o.mode)?t.rmdir(n):t.isFile(o.mode)&&t.unlink(n)},"removeLocalEntry"),loadRemoteEntry:s(async n=>{if(n.kind==="file"){let o=await n.getFile();return{contents:new Uint8Array(await o.arrayBuffer()),mode:a.FILE_MODE,timestamp:new Date(o.lastModified)}}else{if(n.kind==="directory")return{mode:a.DIR_MODE,timestamp:new Date};throw new Error("unknown kind: "+n.kind)}},"loadRemoteEntry"),storeRemoteEntry:s(async(n,o,c)=>{let l=n.get(i.dirname(o)),d=t.isFile(c.mode)?await l.getFileHandle(i.basename(o),{create:!0}):await l.getDirectoryHandle(i.basename(o),{create:!0});if(d.kind==="file"){let u=await d.createWritable();await u.write(c.contents),await u.close()}n.set(o,d)},"storeRemoteEntry"),removeRemoteEntry:s(async(n,o)=>{await n.get(i.dirname(o)).removeEntry(i.basename(o)),n.delete(o)},"removeRemoteEntry"),reconcile:s(async(n,o,c)=>{let l=0,d=[];Object.keys(o.entries).forEach(function(m){let v=o.entries[m],P=c.entries[m];(!P||t.isFile(v.mode)&&v.timestamp.getTime()>P.timestamp.getTime())&&(d.push(m),l++)}),d.sort();let u=[];if(Object.keys(c.entries).forEach(function(m){o.entries[m]||(u.push(m),l++)}),u.sort().reverse(),!l)return;let y=o.type==="remote"?o.handles:c.handles;for(let m of d){let v=i.normalize(m.replace(n.mountpoint,"/")).substring(1);if(c.type==="local"){let P=y.get(v),oe=await a.loadRemoteEntry(P);a.storeLocalEntry(m,oe)}else{let P=a.loadLocalEntry(m);await a.storeRemoteEntry(y,v,P)}}for(let m of u)if(c.type==="local")a.removeLocalEntry(m);else{let v=i.normalize(m.replace(n.mountpoint,"/")).substring(1);await a.removeRemoteEntry(y,v)}},"reconcile")};e.FS.filesystems.NATIVEFS_ASYNC=a}s(te,"initializeNativeFS");var Ie=s(async e=>{let t=[];async function r(a){for await(let n of a.values())t.push(n),n.kind==="directory"&&await r(n)}s(r,"collect"),await r(e);let i=new Map;i.set(".",e);for(let a of t){let n=(await e.resolve(a)).join("/");i.set(n,a)}return i},"getFsHandles");var ne=H("AGFzbQEAAAABDANfAGAAAW9gAW8BfwMDAgECByECD2NyZWF0ZV9zZW50aW5lbAAAC2lzX3NlbnRpbmVsAAEKEwIHAPsBAPsbCwkAIAD7GvsUAAs=");var Fe=async function(){if(!(globalThis.navigator&&(/iPad|iPhone|iPod/.test(navigator.userAgent)||navigator.platform==="MacIntel"&&typeof navigator.maxTouchPoints<"u"&&navigator.maxTouchPoints>1))){return;try{let t=await WebAssembly.compile(ne);return await WebAssembly.instantiate(t)}catch(t){if(t instanceof WebAssembly.CompileError)return;throw t}}}();async function re(){let e=await Fe;if(e)return e.exports;let t=Symbol("error marker");return{create_sentinel:s(()=>t,"create_sentinel"),is_sentinel:s(r=>r===t,"is_sentinel")}}s(re,"getSentinelImport");function ie(e){let t={noImageDecoding:!0,noAudioDecoding:!0,noWasmDecoding:!1,preRun:Le(e),print:e.stdout,printErr:e.stderr,onExit(r){t.exitCode=r},thisProgram:e._sysExecutable,arguments:e.args,API:{config:e},locateFile:s(r=>e.indexURL+r,"locateFile"),instantiateWasm:Te(e.indexURL)};return t}s(ie,"createSettings");function xe(e){return function(t){let r="/";try{t.FS.mkdirTree(e)}catch(i){console.error(`Error occurred while making a home directory '${e}':`),console.error(i),console.error(`Using '${r}' for a home directory instead`),e=r}t.FS.chdir(e)}}s(xe,"createHomeDirectory");function ke(e){return function(t){Object.assign(t.ENV,e)}}s(ke,"setEnvironment");function Re(e){return e?[async t=>{t.addRunDependency("fsInitHook");try{await e(t.FS,{sitePackages:t.API.sitePackages})}finally{t.removeRunDependency("fsInitHook")}}]:[]}s(Re,"callFsInitHook");function Ae(e){let t=e.HEAPU32[e._Py_Version>>>2],r=t>>>24&255,i=t>>>16&255,a=t>>>8&255;return[r,i,a]}s(Ae,"computeVersionTuple");function Oe(e){let t=Q(e);return async r=>{r.API.pyVersionTuple=Ae(r);let[i,a]=r.API.pyVersionTuple;r.FS.mkdirTree("/lib"),r.API.sitePackages=`/lib/python${i}.${a}/site-packages`,r.FS.mkdirTree(r.API.sitePackages),r.addRunDependency("install-stdlib");try{let n=await t;r.FS.writeFile(`/lib/python${i}${a}.zip`,n)}catch(n){console.error("Error occurred while installing the standard library:"),console.error(n)}finally{r.removeRunDependency("install-stdlib")}}}s(Oe,"installStdlib");function Le(e){let t;return e.stdLibURL!=null?t=e.stdLibURL:t=e.indexURL+"python_stdlib.zip",[Oe(t),xe(e.env.HOME),ke(e.env),te,...Re(e.fsInit)]}s(Le,"getFileSystemInitializationFuncs");function Te(e){if(typeof WasmOffsetConverter<"u")return;let{binary:t,response:r}=x(e+"pyodide.asm.wasm"),i=re();return function(a,n){return async function(){a.sentinel=await i;try{let o;r?o=await WebAssembly.instantiateStreaming(r,a):o=await WebAssembly.instantiate(await t,a);let{instance:c,module:l}=o;n(c,l)}catch(o){console.warn("wasm instantiation failed!"),console.warn(o)}}(),{}}}s(Te,"getInstantiateWasmFunc");var O="0.28.0";async function B(e={}){await W();let t=e.indexURL||await ee();t=A(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:[],env:{},packages:[],enableRunUntilComplete:!0,checkAPIVersion:!0,BUILD_ID:"aca77914b08e1d99774d24f0b7c9b8f9068e2c62cf4696d7e95d8c3b72139f2d"},i=Object.assign(r,e);i.env.HOME??="/home/pyodide",i.env.PYTHONINSPECT??="1";let a=ie(i),n=a.API;if(n.lockFilePromise=Z(i.lockFileURL),typeof _createPyodideModule!="function"){let u=`${i.indexURL}pyodide.asm.js`;await F(u)}let o;if(e._loadSnapshot){let u=await e._loadSnapshot;ArrayBuffer.isView(u)?o=u:o=new Uint8Array(u),a.noInitialRun=!0,a.INITIAL_MEMORY=o.length}let c=await _createPyodideModule(a);if(a.exitCode!==void 0)throw new c.ExitStatus(a.exitCode);if(e.pyproxyToStringRepr&&n.setPyProxyToStringMethod(!0),e.convertNullToNone&&n.setCompatNullToNone(!0),n.version!==O&&i.checkAPIVersion)throw new Error(`Pyodide version does not match: '${O}' <==> '${n.version}'. If you updated the Pyodide version, make sure you also updated the 'indexURL' parameter passed to loadPyodide.`);c.locateFile=u=>{throw u.endsWith(".so")?new Error(`Failed to find dynamic library "${u}"`):new Error(`Unexpected call to locateFile("${u}")`)};let l;o&&(l=n.restoreSnapshot(o));let d=n.finalizeBootstrap(l,e._snapshotDeserializer);return n.sys.path.insert(0,""),d.version.includes("dev")||n.setCdnUrl(`https://cdn.jsdelivr.net/pyodide/v${d.version}/full/`),n._pyodide.set_excepthook(),await n.packageIndexReady,n.initializeStreams(i.stdin,i.stdout,i.stderr),d}s(B,"loadPyodide");globalThis.loadPyodide=B;return fe(De);})();
1
+ "use strict";var loadPyodide=(()=>{var ce=Object.create;var R=Object.defineProperty;var le=Object.getOwnPropertyDescriptor;var de=Object.getOwnPropertyNames;var ue=Object.getPrototypeOf,fe=Object.prototype.hasOwnProperty;var o=(e,t)=>R(e,"name",{value:t,configurable:!0}),m=(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 me=(e,t)=>{for(var r in t)R(e,r,{get:t[r],enumerable:!0})},j=(e,t,r,a)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of de(t))!fe.call(e,s)&&s!==r&&R(e,s,{get:()=>t[s],enumerable:!(a=le(t,s))||a.enumerable});return e};var b=(e,t,r)=>(r=e!=null?ce(ue(e)):{},j(t||!e||!e.__esModule?R(r,"default",{value:e,enumerable:!0}):r,e)),pe=e=>j(R({},"__esModule",{value:!0}),e);var H=(()=>{for(var e=new Uint8Array(128),t=0;t<64;t++)e[t<26?t+65:t<52?t+71:t<62?t-4:t*4-205]=t;return r=>{for(var a=r.length,s=new Uint8Array((a-(r[a-1]=="=")-(r[a-2]=="="))*3/4|0),n=0,i=0;n<a;){var c=e[r.charCodeAt(n++)],l=e[r.charCodeAt(n++)],d=e[r.charCodeAt(n++)],f=e[r.charCodeAt(n++)];s[i++]=c<<2|l>>4,s[i++]=l<<4|d>>2,s[i++]=d<<6|f}return s}})();var Ce={};me(Ce,{loadPyodide:()=>$,version:()=>O});function ge(e){return!isNaN(parseFloat(e))&&isFinite(e)}o(ge,"_isNumber");function E(e){return e.charAt(0).toUpperCase()+e.substring(1)}o(E,"_capitalize");function D(e){return function(){return this[e]}}o(D,"_getter");var k=["isConstructor","isEval","isNative","isToplevel"],I=["columnNumber","lineNumber"],N=["fileName","functionName","source"],ye=["args"],be=["evalOrigin"],L=k.concat(I,N,ye,be);function g(e){if(e)for(var t=0;t<L.length;t++)e[L[t]]!==void 0&&this["set"+E(L[t])](e[L[t]])}o(g,"StackFrame");g.prototype={getArgs:o(function(){return this.args},"getArgs"),setArgs:o(function(e){if(Object.prototype.toString.call(e)!=="[object Array]")throw new TypeError("Args must be an Array");this.args=e},"setArgs"),getEvalOrigin:o(function(){return this.evalOrigin},"getEvalOrigin"),setEvalOrigin:o(function(e){if(e instanceof g)this.evalOrigin=e;else if(e instanceof Object)this.evalOrigin=new g(e);else throw new TypeError("Eval Origin must be an Object or StackFrame")},"setEvalOrigin"),toString:o(function(){var e=this.getFileName()||"",t=this.getLineNumber()||"",r=this.getColumnNumber()||"",a=this.getFunctionName()||"";return this.getIsEval()?e?"[eval] ("+e+":"+t+":"+r+")":"[eval]:"+t+":"+r:a?a+" ("+e+":"+t+":"+r+")":e+":"+t+":"+r},"toString")};g.fromString=o(function(t){var r=t.indexOf("("),a=t.lastIndexOf(")"),s=t.substring(0,r),n=t.substring(r+1,a).split(","),i=t.substring(a+1);if(i.indexOf("@")===0)var c=/@(.+?)(?::(\d+))?(?::(\d+))?$/.exec(i,""),l=c[1],d=c[2],f=c[3];return new g({functionName:s,args:n||void 0,fileName:l,lineNumber:d||void 0,columnNumber:f||void 0})},"StackFrame$$fromString");for(h=0;h<k.length;h++)g.prototype["get"+E(k[h])]=D(k[h]),g.prototype["set"+E(k[h])]=function(e){return function(t){this[e]=!!t}}(k[h]);var h;for(S=0;S<I.length;S++)g.prototype["get"+E(I[S])]=D(I[S]),g.prototype["set"+E(I[S])]=function(e){return function(t){if(!ge(t))throw new TypeError(e+" must be a Number");this[e]=Number(t)}}(I[S]);var S;for(w=0;w<N.length;w++)g.prototype["get"+E(N[w])]=D(N[w]),g.prototype["set"+E(N[w])]=function(e){return function(t){this[e]=String(t)}}(N[w]);var w,T=g;function ve(){var e=/^\s*at .*(\S+:\d+|\(native\))/m,t=/^(eval@)?(\[native code])?$/;return{parse:o(function(a){if(a.stack&&a.stack.match(e))return this.parseV8OrIE(a);if(a.stack)return this.parseFFOrSafari(a);throw new Error("Cannot parse given Error object")},"ErrorStackParser$$parse"),extractLocation:o(function(a){if(a.indexOf(":")===-1)return[a];var s=/(.+?)(?::(\d+))?(?::(\d+))?$/,n=s.exec(a.replace(/[()]/g,""));return[n[1],n[2]||void 0,n[3]||void 0]},"ErrorStackParser$$extractLocation"),parseV8OrIE:o(function(a){var s=a.stack.split(`
2
+ `).filter(function(n){return!!n.match(e)},this);return s.map(function(n){n.indexOf("(eval ")>-1&&(n=n.replace(/eval code/g,"eval").replace(/(\(eval at [^()]*)|(,.*$)/g,""));var i=n.replace(/^\s+/,"").replace(/\(eval code/g,"(").replace(/^.*?\s+/,""),c=i.match(/ (\(.+\)$)/);i=c?i.replace(c[0],""):i;var l=this.extractLocation(c?c[1]:i),d=c&&i||void 0,f=["eval","<anonymous>"].indexOf(l[0])>-1?void 0:l[0];return new T({functionName:d,fileName:f,lineNumber:l[1],columnNumber:l[2],source:n})},this)},"ErrorStackParser$$parseV8OrIE"),parseFFOrSafari:o(function(a){var s=a.stack.split(`
3
+ `).filter(function(n){return!n.match(t)},this);return s.map(function(n){if(n.indexOf(" > eval")>-1&&(n=n.replace(/ line (\d+)(?: > eval line \d+)* > eval:\d+:\d+/g,":$1")),n.indexOf("@")===-1&&n.indexOf(":")===-1)return new T({functionName:n});var i=/((.*".+"[^@]*)?[^@]*)(?:@)/,c=n.match(i),l=c&&c[1]?c[1]:void 0,d=this.extractLocation(n.replace(i,""));return new T({functionName:l,fileName:d[0],lineNumber:d[1],columnNumber:d[2],source:n})},this)},"ErrorStackParser$$parseFFOrSafari")}}o(ve,"ErrorStackParser");var he=new ve;var V=he;var y=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string"&&!process.browser,U=y&&typeof module<"u"&&typeof module.exports<"u"&&typeof m<"u"&&typeof __dirname<"u",z=y&&!U,Ve=typeof globalThis.Bun<"u",Se=typeof Deno<"u",q=!y&&!Se,J=q&&typeof window=="object"&&typeof document=="object"&&typeof document.createElement=="function"&&"sessionStorage"in window&&typeof importScripts!="function",Y=q&&typeof importScripts=="function"&&typeof self=="object",ze=typeof navigator=="object"&&typeof navigator.userAgent=="string"&&navigator.userAgent.indexOf("Chrome")==-1&&navigator.userAgent.indexOf("Safari")>-1,A=typeof read=="function"&&typeof load=="function";var G,C,X,K,M;async function W(){if(!y||(G=(await import(/* webpackIgnore */"node:url")).default,K=await import(/* webpackIgnore */"node:fs"),M=await import(/* webpackIgnore */"node:fs/promises"),X=(await import(/* webpackIgnore */"node:vm")).default,C=await import(/* webpackIgnore */"node:path"),B=C.sep,typeof m<"u"))return;let e=K,t=await import(/* webpackIgnore */"node:crypto"),r=await import(/* webpackIgnore */"ws"),a=await import(/* webpackIgnore */"node:child_process"),s={fs:e,crypto:t,ws:r,child_process:a};globalThis.require=function(n){return s[n]}}o(W,"initNodeModules");function we(e,t){return C.resolve(t||".",e)}o(we,"node_resolvePath");function Ee(e,t){return t===void 0&&(t=location),new URL(e,t).toString()}o(Ee,"browser_resolvePath");var x;y?x=we:A?x=o(e=>e,"resolvePath"):x=Ee;var B;y||(B="/");function Pe(e,t){return e.startsWith("file://")&&(e=e.slice(7)),e.includes("://")?{response:fetch(e)}:{binary:M.readFile(e).then(r=>new Uint8Array(r.buffer,r.byteOffset,r.byteLength))}}o(Pe,"node_getBinaryResponse");function ke(e,t){if(e.startsWith("file://")&&(e=e.slice(7)),e.includes("://"))throw new Error("Shell cannot fetch urls");return{binary:Promise.resolve(new Uint8Array(readbuffer(e)))}}o(ke,"shell_getBinaryResponse");function Ie(e,t){let r=new URL(e,location);return{response:fetch(r,t?{integrity:t}:{})}}o(Ie,"browser_getBinaryResponse");var _;y?_=Pe:A?_=ke:_=Ie;async function Q(e,t){let{response:r,binary:a}=_(e,t);if(a)return a;let s=await r;if(!s.ok)throw new Error(`Failed to load '${e}': request failed.`);return new Uint8Array(await s.arrayBuffer())}o(Q,"loadBinaryFile");var F;if(J)F=o(async e=>await import(/* webpackIgnore */e),"loadScript");else if(Y)F=o(async e=>{try{globalThis.importScripts(e)}catch(t){if(t instanceof TypeError)await import(/* webpackIgnore */e);else throw t}},"loadScript");else if(y)F=Ne;else if(A)F=load;else throw new Error("Cannot determine runtime environment");async function Ne(e){e.startsWith("file://")&&(e=e.slice(7)),e.includes("://")?X.runInThisContext(await(await fetch(e)).text()):await import(/* webpackIgnore */G.pathToFileURL(e).href)}o(Ne,"nodeLoadScript");async function Z(e){if(y){await W();let t=await M.readFile(e,{encoding:"utf8"});return JSON.parse(t)}else if(A){let t=read(e);return JSON.parse(t)}else return await(await fetch(e)).json()}o(Z,"loadLockFile");async function ee(){if(U)return __dirname;let e;try{throw new Error}catch(a){e=a}let t=V.parse(e)[0].fileName;if(y&&!t.startsWith("file://")&&(t=`file://${t}`),z){let a=await import(/* webpackIgnore */"node:path");return(await import(/* webpackIgnore */"node:url")).fileURLToPath(a.dirname(t))}let r=t.lastIndexOf(B);if(r===-1)throw new Error("Could not extract indexURL path from pyodide module location");return t.slice(0,r)}o(ee,"calculateDirname");function te(e){return e.substring(0,e.lastIndexOf("/")+1)||globalThis.location?.toString()||"."}o(te,"calculateInstallBaseUrl");function ne(e){let t=e.FS,r=e.FS.filesystems.MEMFS,a=e.PATH,s={DIR_MODE:16895,FILE_MODE:33279,mount:o(function(n){if(!n.opts.fileSystemHandle)throw new Error("opts.fileSystemHandle is required");return r.mount.apply(null,arguments)},"mount"),syncfs:o(async(n,i,c)=>{try{let l=s.getLocalSet(n),d=await s.getRemoteSet(n),f=i?d:l,u=i?l:d;await s.reconcile(n,f,u),c(null)}catch(l){c(l)}},"syncfs"),getLocalSet:o(n=>{let i=Object.create(null);function c(f){return f!=="."&&f!==".."}o(c,"isRealDir");function l(f){return u=>a.join2(f,u)}o(l,"toAbsolute");let d=t.readdir(n.mountpoint).filter(c).map(l(n.mountpoint));for(;d.length;){let f=d.pop(),u=t.stat(f);t.isDir(u.mode)&&d.push.apply(d,t.readdir(f).filter(c).map(l(f))),i[f]={timestamp:u.mtime,mode:u.mode}}return{type:"local",entries:i}},"getLocalSet"),getRemoteSet:o(async n=>{let i=Object.create(null),c=await Fe(n.opts.fileSystemHandle);for(let[l,d]of c)l!=="."&&(i[a.join2(n.mountpoint,l)]={timestamp:d.kind==="file"?new Date((await d.getFile()).lastModified):new Date,mode:d.kind==="file"?s.FILE_MODE:s.DIR_MODE});return{type:"remote",entries:i,handles:c}},"getRemoteSet"),loadLocalEntry:o(n=>{let c=t.lookupPath(n).node,l=t.stat(n);if(t.isDir(l.mode))return{timestamp:l.mtime,mode:l.mode};if(t.isFile(l.mode))return c.contents=r.getFileDataAsTypedArray(c),{timestamp:l.mtime,mode:l.mode,contents:c.contents};throw new Error("node type not supported")},"loadLocalEntry"),storeLocalEntry:o((n,i)=>{if(t.isDir(i.mode))t.mkdirTree(n,i.mode);else if(t.isFile(i.mode))t.writeFile(n,i.contents,{canOwn:!0});else throw new Error("node type not supported");t.chmod(n,i.mode),t.utime(n,i.timestamp,i.timestamp)},"storeLocalEntry"),removeLocalEntry:o(n=>{var i=t.stat(n);t.isDir(i.mode)?t.rmdir(n):t.isFile(i.mode)&&t.unlink(n)},"removeLocalEntry"),loadRemoteEntry:o(async n=>{if(n.kind==="file"){let i=await n.getFile();return{contents:new Uint8Array(await i.arrayBuffer()),mode:s.FILE_MODE,timestamp:new Date(i.lastModified)}}else{if(n.kind==="directory")return{mode:s.DIR_MODE,timestamp:new Date};throw new Error("unknown kind: "+n.kind)}},"loadRemoteEntry"),storeRemoteEntry:o(async(n,i,c)=>{let l=n.get(a.dirname(i)),d=t.isFile(c.mode)?await l.getFileHandle(a.basename(i),{create:!0}):await l.getDirectoryHandle(a.basename(i),{create:!0});if(d.kind==="file"){let f=await d.createWritable();await f.write(c.contents),await f.close()}n.set(i,d)},"storeRemoteEntry"),removeRemoteEntry:o(async(n,i)=>{await n.get(a.dirname(i)).removeEntry(a.basename(i)),n.delete(i)},"removeRemoteEntry"),reconcile:o(async(n,i,c)=>{let l=0,d=[];Object.keys(i.entries).forEach(function(p){let v=i.entries[p],P=c.entries[p];(!P||t.isFile(v.mode)&&v.timestamp.getTime()>P.timestamp.getTime())&&(d.push(p),l++)}),d.sort();let f=[];if(Object.keys(c.entries).forEach(function(p){i.entries[p]||(f.push(p),l++)}),f.sort().reverse(),!l)return;let u=i.type==="remote"?i.handles:c.handles;for(let p of d){let v=a.normalize(p.replace(n.mountpoint,"/")).substring(1);if(c.type==="local"){let P=u.get(v),se=await s.loadRemoteEntry(P);s.storeLocalEntry(p,se)}else{let P=s.loadLocalEntry(p);await s.storeRemoteEntry(u,v,P)}}for(let p of f)if(c.type==="local")s.removeLocalEntry(p);else{let v=a.normalize(p.replace(n.mountpoint,"/")).substring(1);await s.removeRemoteEntry(u,v)}},"reconcile")};e.FS.filesystems.NATIVEFS_ASYNC=s}o(ne,"initializeNativeFS");var Fe=o(async e=>{let t=[];async function r(s){for await(let n of s.values())t.push(n),n.kind==="directory"&&await r(n)}o(r,"collect"),await r(e);let a=new Map;a.set(".",e);for(let s of t){let n=(await e.resolve(s)).join("/");a.set(n,s)}return a},"getFsHandles");var re=H("AGFzbQEAAAABDANfAGAAAW9gAW8BfwMDAgECByECD2NyZWF0ZV9zZW50aW5lbAAAC2lzX3NlbnRpbmVsAAEKEwIHAPsBAPsbCwkAIAD7GvsUAAs=");var _e=async function(){if(!(globalThis.navigator&&(/iPad|iPhone|iPod/.test(navigator.userAgent)||navigator.platform==="MacIntel"&&typeof navigator.maxTouchPoints<"u"&&navigator.maxTouchPoints>1))){return;try{let t=await WebAssembly.compile(re);return await WebAssembly.instantiate(t)}catch(t){if(t instanceof WebAssembly.CompileError)return;throw t}}}();async function ie(){let e=await _e;if(e)return e.exports;let t=Symbol("error marker");return{create_sentinel:o(()=>t,"create_sentinel"),is_sentinel:o(r=>r===t,"is_sentinel")}}o(ie,"getSentinelImport");function oe(e){let t={noImageDecoding:!0,noAudioDecoding:!0,noWasmDecoding:!1,preRun:De(e),print:e.stdout,printErr:e.stderr,onExit(r){t.exitCode=r},thisProgram:e._sysExecutable,arguments:e.args,API:{config:e},locateFile:o(r=>e.indexURL+r,"locateFile"),instantiateWasm:Ue(e.indexURL)};return t}o(oe,"createSettings");function Re(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)}}o(Re,"createHomeDirectory");function Ae(e){return function(t){Object.assign(t.ENV,e)}}o(Ae,"setEnvironment");function Oe(e){return e?[async t=>{t.addRunDependency("fsInitHook");try{await e(t.FS,{sitePackages:t.API.sitePackages})}finally{t.removeRunDependency("fsInitHook")}}]:[]}o(Oe,"callFsInitHook");function Le(e){let t=e.HEAPU32[e._Py_Version>>>2],r=t>>>24&255,a=t>>>16&255,s=t>>>8&255;return[r,a,s]}o(Le,"computeVersionTuple");function Te(e){let t=Q(e);return async r=>{r.API.pyVersionTuple=Le(r);let[a,s]=r.API.pyVersionTuple;r.FS.mkdirTree("/lib"),r.API.sitePackages=`/lib/python${a}.${s}/site-packages`,r.FS.mkdirTree(r.API.sitePackages),r.addRunDependency("install-stdlib");try{let n=await t;r.FS.writeFile(`/lib/python${a}${s}.zip`,n)}catch(n){console.error("Error occurred while installing the standard library:"),console.error(n)}finally{r.removeRunDependency("install-stdlib")}}}o(Te,"installStdlib");function De(e){let t;return e.stdLibURL!=null?t=e.stdLibURL:t=e.indexURL+"python_stdlib.zip",[Te(t),Re(e.env.HOME),Ae(e.env),ne,...Oe(e.fsInit)]}o(De,"getFileSystemInitializationFuncs");function Ue(e){if(typeof WasmOffsetConverter<"u")return;let{binary:t,response:r}=_(e+"pyodide.asm.wasm"),a=ie();return function(s,n){return async function(){s.sentinel=await a;try{let i;r?i=await WebAssembly.instantiateStreaming(r,s):i=await WebAssembly.instantiate(await t,s);let{instance:c,module:l}=i;n(c,l)}catch(i){console.warn("wasm instantiation failed!"),console.warn(i)}}(),{}}}o(Ue,"getInstantiateWasmFunc");var ae="0.28.1";var O=ae;async function $(e={}){if(e.lockFileContents&&e.lockFileURL)throw new Error("Can't pass both lockFileContents and lockFileURL");await W();let t=e.indexURL||await ee();t=x(t),t.endsWith("/")||(t+="/");let r=e;if(!e.lockFileContents){let u=e.lockFileURL??t+"pyodide-lock.json";r.lockFileContents=Z(u),r.packageBaseUrl??=te(u)}if(r.indexURL=t,r.cdnUrl=r.packageBaseUrl??`https://cdn.jsdelivr.net/pyodide/v${O}/full/`,e.packageCacheDir){let u=x(e.packageCacheDir);u.endsWith("/")||(u+="/"),e.packageCacheDir=u}let a={fullStdLib:!1,jsglobals:globalThis,stdin:globalThis.prompt?globalThis.prompt:void 0,args:[],env:{},packages:[],packageCacheDir:r.packageBaseUrl,enableRunUntilComplete:!0,checkAPIVersion:!0,BUILD_ID:"0c0e2ff761547b9adb2156e2c54b8f253cfb8209e53008729249c6f0bed76fff"},s=Object.assign(a,r);s.env.HOME??="/home/pyodide",s.env.PYTHONINSPECT??="1";let n=oe(s),i=n.API;if(i.lockFilePromise=Promise.resolve(r.lockFileContents),typeof _createPyodideModule!="function"){let u=`${s.indexURL}pyodide.asm.js`;await F(u)}let c;if(e._loadSnapshot){let u=await e._loadSnapshot;ArrayBuffer.isView(u)?c=u:c=new Uint8Array(u),n.noInitialRun=!0,n.INITIAL_MEMORY=c.length}let l=await _createPyodideModule(n);if(n.exitCode!==void 0)throw new l.ExitStatus(n.exitCode);if(e.pyproxyToStringRepr&&i.setPyProxyToStringMethod(!0),e.convertNullToNone&&i.setCompatNullToNone(!0),i.version!==O&&s.checkAPIVersion)throw new Error(`Pyodide version does not match: '${O}' <==> '${i.version}'. If you updated the Pyodide version, make sure you also updated the 'indexURL' parameter passed to loadPyodide.`);l.locateFile=u=>{throw u.endsWith(".so")?new Error(`Failed to find dynamic library "${u}"`):new Error(`Unexpected call to locateFile("${u}")`)};let d;c&&(d=i.restoreSnapshot(c));let f=i.finalizeBootstrap(d,e._snapshotDeserializer);return i.sys.path.insert(0,""),i._pyodide.set_excepthook(),await i.packageIndexReady,i.initializeStreams(s.stdin,s.stdout,s.stderr),f}o($,"loadPyodide");globalThis.loadPyodide=$;return pe(Ce);})();
4
4
  try{Object.assign(exports,loadPyodide)}catch(_){}
5
5
  globalThis.loadPyodide=loadPyodide.loadPyodide;
6
6
  //# sourceMappingURL=pyodide.js.map