pyodide 0.24.1 → 0.25.0-alpha.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,4 +1,4 @@
1
- // Generated by dts-bundle-generator v6.13.0
1
+ // Generated by dts-bundle-generator v8.1.1
2
2
 
3
3
  /**
4
4
  *
@@ -9,12 +9,6 @@
9
9
  * version convention.
10
10
  */
11
11
  export declare const version: string;
12
- interface CanvasInterface {
13
- setCanvas2D(canvas: HTMLCanvasElement): void;
14
- getCanvas2D(): HTMLCanvasElement | undefined;
15
- setCanvas3D(canvas: HTMLCanvasElement): void;
16
- getCanvas3D(): HTMLCanvasElement | undefined;
17
- }
18
12
  /** @deprecated Use `import type { PyProxy } from "pyodide/ffi"` instead */
19
13
  interface PyProxy {
20
14
  [x: string]: any;
@@ -29,11 +23,10 @@ declare class PyProxy {
29
23
  /** @private */
30
24
  static [Symbol.hasInstance](obj: any): obj is PyProxy;
31
25
  /**
32
- * @private
33
26
  * @hideconstructor
34
27
  */
35
28
  constructor();
36
- /** @private */
29
+ /** @hidden */
37
30
  get [Symbol.toStringTag](): string;
38
31
  /**
39
32
  * The name of the type of the object.
@@ -51,6 +44,10 @@ declare class PyProxy {
51
44
  *
52
45
  */
53
46
  get type(): string;
47
+ /**
48
+ * Returns `str(o)` (unless `pyproxyToStringRepr: true` was passed to
49
+ * :js:func:`loadPyodide` in which case it will return `repr(o)`)
50
+ */
54
51
  toString(): string;
55
52
  /**
56
53
  * Destroy the :js:class:`~pyodide.ffi.PyProxy`. This will release the memory. Any further attempt
@@ -258,7 +255,7 @@ declare class PyIterable extends PyProxy {
258
255
  interface PyIterable extends PyIterableMethods {
259
256
  }
260
257
  /** @deprecated Use :js:class:`pyodide.ffi.PyIterable` instead. */
261
- export declare type PyProxyIterable = PyIterable;
258
+ export type PyProxyIterable = PyIterable;
262
259
  declare class PyIterableMethods {
263
260
  /**
264
261
  * This translates to the Python code ``iter(obj)``. Return an iterator
@@ -293,7 +290,7 @@ declare class PyIterator extends PyProxy {
293
290
  interface PyIterator extends PyIteratorMethods {
294
291
  }
295
292
  /** @deprecated Use :js:class:`pyodide.ffi.PyIterator` instead. */
296
- export declare type PyProxyIterator = PyIterator;
293
+ export type PyProxyIterator = PyIterator;
297
294
  declare class PyIteratorMethods {
298
295
  /** @private */
299
296
  [Symbol.iterator](): this;
@@ -426,6 +423,7 @@ declare class PySequence extends PyProxy {
426
423
  interface PySequence extends PySequenceMethods {
427
424
  }
428
425
  declare class PySequenceMethods {
426
+ /** @hidden */
429
427
  get [Symbol.isConcatSpreadable](): boolean;
430
428
  /**
431
429
  * See :js:meth:`Array.join`. The :js:meth:`Array.join` method creates and
@@ -483,7 +481,7 @@ declare class PySequenceMethods {
483
481
  * return value is added as a single element in the new array.
484
482
  * @param thisArg A value to use as ``this`` when executing ``callbackFn``.
485
483
  */
486
- map(callbackfn: (elt: any, index: number, array: any) => void, thisArg?: any): unknown[];
484
+ map<U>(callbackfn: (elt: any, index: number, array: any) => U, thisArg?: any): U[];
487
485
  /**
488
486
  * See :js:meth:`Array.filter`. Creates a shallow copy of a portion of a given
489
487
  * ``Sequence``, filtered down to just the elements from the given array that pass
@@ -609,68 +607,68 @@ interface PyMutableSequence extends PyMutableSequenceMethods {
609
607
  }
610
608
  declare class PyMutableSequenceMethods {
611
609
  /**
612
- * The :js:meth:`Array.reverse` method reverses a ``MutableSequence`` in
610
+ * The :js:meth:`Array.reverse` method reverses a :js:class:`PyMutableSequence` in
613
611
  * place.
614
- * @returns A reference to the same ``MutableSequence``
612
+ * @returns A reference to the same :js:class:`PyMutableSequence`
615
613
  */
616
- reverse(): this;
614
+ reverse(): PyMutableSequence;
617
615
  /**
618
616
  * The :js:meth:`Array.sort` method sorts the elements of a
619
- * ``MutableSequence`` in place.
617
+ * :js:class:`PyMutableSequence` in place.
620
618
  * @param compareFn A function that defines the sort order.
621
- * @returns A reference to the same ``MutableSequence``
619
+ * @returns A reference to the same :js:class:`PyMutableSequence`
622
620
  */
623
- sort(compareFn?: (a: any, b: any) => number): this;
621
+ sort(compareFn?: (a: any, b: any) => number): PyMutableSequence;
624
622
  /**
625
623
  * The :js:meth:`Array.splice` method changes the contents of a
626
- * ``MutableSequence`` by removing or replacing existing elements and/or
624
+ * :js:class:`PyMutableSequence` by removing or replacing existing elements and/or
627
625
  * adding new elements in place.
628
626
  * @param start Zero-based index at which to start changing the
629
- * ``MutableSequence``.
627
+ * :js:class:`PyMutableSequence`.
630
628
  * @param deleteCount An integer indicating the number of elements in the
631
- * ``MutableSequence`` to remove from ``start``.
632
- * @param items The elements to add to the ``MutableSequence``, beginning from
629
+ * :js:class:`PyMutableSequence` to remove from ``start``.
630
+ * @param items The elements to add to the :js:class:`PyMutableSequence`, beginning from
633
631
  * ``start``.
634
632
  * @returns An array containing the deleted elements.
635
633
  */
636
- splice(start: number, deleteCount?: number, ...items: any[]): void;
634
+ splice(start: number, deleteCount?: number, ...items: any[]): any[];
637
635
  /**
638
636
  * The :js:meth:`Array.push` method adds the specified elements to the end of
639
- * a ``MutableSequence``.
640
- * @param elts The element(s) to add to the end of the ``MutableSequence``.
637
+ * a :js:class:`PyMutableSequence`.
638
+ * @param elts The element(s) to add to the end of the :js:class:`PyMutableSequence`.
641
639
  * @returns The new length property of the object upon which the method was
642
640
  * called.
643
641
  */
644
642
  push(...elts: any[]): any;
645
643
  /**
646
644
  * The :js:meth:`Array.pop` method removes the last element from a
647
- * ``MutableSequence``.
648
- * @returns The removed element from the ``MutableSequence``; undefined if the
649
- * ``MutableSequence`` is empty.
645
+ * :js:class:`PyMutableSequence`.
646
+ * @returns The removed element from the :js:class:`PyMutableSequence`; undefined if the
647
+ * :js:class:`PyMutableSequence` is empty.
650
648
  */
651
- pop(): void;
649
+ pop(): any;
652
650
  /**
653
651
  * The :js:meth:`Array.shift` method removes the first element from a
654
- * ``MutableSequence``.
655
- * @returns The removed element from the ``MutableSequence``; undefined if the
656
- * ``MutableSequence`` is empty.
652
+ * :js:class:`PyMutableSequence`.
653
+ * @returns The removed element from the :js:class:`PyMutableSequence`; undefined if the
654
+ * :js:class:`PyMutableSequence` is empty.
657
655
  */
658
- shift(): void;
656
+ shift(): any;
659
657
  /**
660
658
  * The :js:meth:`Array.unshift` method adds the specified elements to the
661
- * beginning of a ``MutableSequence``.
662
- * @param elts The elements to add to the front of the ``MutableSequence``.
663
- * @returns The new length of the ``MutableSequence``.
659
+ * beginning of a :js:class:`PyMutableSequence`.
660
+ * @param elts The elements to add to the front of the :js:class:`PyMutableSequence`.
661
+ * @returns The new length of the :js:class:`PyMutableSequence`.
664
662
  */
665
663
  unshift(...elts: any[]): any;
666
664
  /**
667
665
  * The :js:meth:`Array.copyWithin` method shallow copies part of a
668
- * ``MutableSequence`` to another location in the same ``MutableSequence``
666
+ * :js:class:`PyMutableSequence` to another location in the same :js:class:`PyMutableSequence`
669
667
  * without modifying its length.
670
668
  * @param target Zero-based index at which to copy the sequence to.
671
669
  * @param start Zero-based index at which to start copying elements from.
672
670
  * @param end Zero-based index at which to end copying elements from.
673
- * @returns The modified ``MutableSequence``.
671
+ * @returns The modified :js:class:`PyMutableSequence`.
674
672
  */
675
673
  copyWithin(target: number, start?: number, end?: number): any;
676
674
  /**
@@ -692,7 +690,7 @@ declare class PyAwaitable extends PyProxy {
692
690
  interface PyAwaitable extends Promise<any> {
693
691
  }
694
692
  /** @deprecated Use :js:class:`pyodide.ffi.PyAwaitable` instead. */
695
- export declare type PyProxyAwaitable = PyAwaitable;
693
+ export type PyProxyAwaitable = PyAwaitable;
696
694
  declare class PyCallable extends PyProxy {
697
695
  /** @private */
698
696
  static [Symbol.hasInstance](obj: any): obj is PyCallable;
@@ -700,7 +698,7 @@ declare class PyCallable extends PyProxy {
700
698
  /**
701
699
  * @deprecated Use :js:class:`pyodide.ffi.PyCallable` instead.
702
700
  */
703
- export declare type PyProxyCallable = PyCallable;
701
+ export type PyProxyCallable = PyCallable;
704
702
  /** @deprecated Use `import type { PyCallable } from "pyodide/ffi"` instead */
705
703
  interface PyCallable extends PyCallableMethods {
706
704
  (...args: any[]): any;
@@ -736,6 +734,7 @@ declare class PyCallableMethods {
736
734
  * object with the keyword arguments.
737
735
  */
738
736
  callKwargs(...jsargs: any): any;
737
+ callSyncifying(...jsargs: any): Promise<any>;
739
738
  /**
740
739
  * The ``bind()`` method creates a new function that, when called, has its
741
740
  * ``this`` keyword set to the provided value, with a given sequence of
@@ -820,7 +819,6 @@ declare class PyBufferMethods {
820
819
  */
821
820
  getBuffer(type?: string): PyBufferView;
822
821
  }
823
- export declare type TypedArray = Int8Array | Uint8Array | Int16Array | Uint16Array | Int32Array | Uint32Array | Uint8ClampedArray | Float32Array | Float64Array;
824
822
  declare class PyDict extends PyProxy {
825
823
  /** @private */
826
824
  static [Symbol.hasInstance](obj: any): obj is PyProxy;
@@ -829,7 +827,7 @@ declare class PyDict extends PyProxy {
829
827
  interface PyDict extends PyProxyWithGet, PyProxyWithSet, PyProxyWithHas, PyProxyWithLength, PyIterable {
830
828
  }
831
829
  /** @deprecated Use :js:class:`pyodide.ffi.PyDict` instead. */
832
- export declare type PyProxyDict = PyDict;
830
+ export type PyProxyDict = PyDict;
833
831
  /** @deprecated Use `import type { PyBufferView } from "pyodide/ffi"` instead */
834
832
  declare class PyBufferView {
835
833
  /**
@@ -910,9 +908,7 @@ declare class PyBufferView {
910
908
  * Is it Fortran contiguous? See :py:attr:`memoryview.f_contiguous`.
911
909
  */
912
910
  f_contiguous: boolean;
913
- /** @private */
914
911
  _released: boolean;
915
- /** @private */
916
912
  _view_ptr: number;
917
913
  /** @private */
918
914
  constructor();
@@ -921,11 +917,39 @@ declare class PyBufferView {
921
917
  */
922
918
  release(): void;
923
919
  }
920
+ type InFuncType = () => null | undefined | string | ArrayBuffer | Uint8Array | number;
921
+ declare function setStdin(options?: {
922
+ stdin?: InFuncType;
923
+ read?: (buffer: Uint8Array) => number;
924
+ error?: boolean;
925
+ isatty?: boolean;
926
+ autoEOF?: boolean;
927
+ }): void;
928
+ declare function setStdout(options?: {
929
+ batched?: (output: string) => void;
930
+ raw?: (charCode: number) => void;
931
+ write?: (buffer: Uint8Array) => number;
932
+ isatty?: boolean;
933
+ }): void;
934
+ declare function setStderr(options?: {
935
+ batched?: (output: string) => void;
936
+ raw?: (charCode: number) => void;
937
+ write?: (buffer: Uint8Array) => number;
938
+ isatty?: boolean;
939
+ }): void;
924
940
  declare function loadPackage(names: string | PyProxy | Array<string>, options?: {
925
941
  messageCallback?: (message: string) => void;
926
942
  errorCallback?: (message: string) => void;
927
943
  checkIntegrity?: boolean;
928
944
  }): Promise<void>;
945
+ /** @deprecated Use `import type { TypedArray } from "pyodide/ffi"` instead */
946
+ export type TypedArray = Int8Array | Uint8Array | Int16Array | Uint16Array | Int32Array | Uint32Array | Uint8ClampedArray | Float32Array | Float64Array;
947
+ interface CanvasInterface {
948
+ setCanvas2D(canvas: HTMLCanvasElement): void;
949
+ getCanvas2D(): HTMLCanvasElement | undefined;
950
+ setCanvas3D(canvas: HTMLCanvasElement): void;
951
+ getCanvas3D(): HTMLCanvasElement | undefined;
952
+ }
929
953
  declare class PythonError extends Error {
930
954
  /**
931
955
  * The address of the error we are wrapping. We may later compare this
@@ -942,27 +966,7 @@ declare class PythonError extends Error {
942
966
  type: string;
943
967
  constructor(type: string, message: string, error_address: number);
944
968
  }
945
- declare type InFuncType = () => null | undefined | string | ArrayBuffer | Uint8Array | number;
946
- declare function setStdin(options?: {
947
- stdin?: InFuncType;
948
- read?: (buffer: Uint8Array) => number;
949
- error?: boolean;
950
- isatty?: boolean;
951
- autoEOF?: boolean;
952
- }): void;
953
- declare function setStdout(options?: {
954
- batched?: (output: string) => void;
955
- raw?: (charCode: number) => void;
956
- write?: (buffer: Uint8Array) => number;
957
- isatty?: boolean;
958
- }): void;
959
- declare function setStderr(options?: {
960
- batched?: (output: string) => void;
961
- raw?: (charCode: number) => void;
962
- write?: (buffer: Uint8Array) => number;
963
- isatty?: boolean;
964
- }): void;
965
- declare type NativeFS = {
969
+ type NativeFS = {
966
970
  syncfs: () => Promise<void>;
967
971
  };
968
972
  declare class PyodideAPI {
@@ -1035,10 +1039,8 @@ declare class PyodideAPI {
1035
1039
  */
1036
1040
  static PATH: any;
1037
1041
  /**
1038
- * This provides APIs to set a canvas for rendering graphics.
1039
- *
1040
- * For example, you need to set a canvas if you want to use the
1041
- * SDL library. See :ref:`using-sdl` for more information.
1042
+ * See :ref:`js-api-pyodide-canvas`.
1043
+ * @hidetype
1042
1044
  */
1043
1045
  static canvas: CanvasInterface;
1044
1046
  /**
@@ -1168,6 +1170,10 @@ declare class PyodideAPI {
1168
1170
  locals?: PyProxy;
1169
1171
  filename?: string;
1170
1172
  }): Promise<any>;
1173
+ static runPythonSyncifying(code: string, options?: {
1174
+ globals?: PyProxy;
1175
+ locals?: PyProxy;
1176
+ }): Promise<any>;
1171
1177
  /**
1172
1178
  * Registers the JavaScript object ``module`` as a JavaScript module named
1173
1179
  * ``name``. This module can then be imported from Python using the standard
@@ -1269,8 +1275,8 @@ declare class PyodideAPI {
1269
1275
  * @param path The absolute path in the Emscripten file system to mount the
1270
1276
  * native directory. If the directory does not exist, it will be created. If it
1271
1277
  * does exist, it must be empty.
1272
- * @param fileSystemHandle A handle returned by ``navigator.storage.getDirectory()``
1273
- * or ``window.showDirectoryPicker()``.
1278
+ * @param fileSystemHandle A handle returned by :js:func:`navigator.storage.getDirectory() <getDirectory>`
1279
+ * or :js:func:`window.showDirectoryPicker() <showDirectoryPicker>`.
1274
1280
  */
1275
1281
  static mountNativeFS(path: string, fileSystemHandle: FileSystemDirectoryHandle): Promise<NativeFS>;
1276
1282
  /**
@@ -1318,7 +1324,7 @@ declare class PyodideAPI {
1318
1324
  *
1319
1325
  * @hidetype
1320
1326
  * @alias
1321
- * @doc_kind class
1327
+ * @dockind class
1322
1328
  * @deprecated
1323
1329
  */
1324
1330
  static get PyBuffer(): typeof PyBufferView;
@@ -1327,7 +1333,7 @@ declare class PyodideAPI {
1327
1333
  *
1328
1334
  * @hidetype
1329
1335
  * @alias
1330
- * @doc_kind class
1336
+ * @dockind class
1331
1337
  * @deprecated
1332
1338
  */
1333
1339
  static get PyProxyBuffer(): typeof PyBuffer;
@@ -1336,7 +1342,7 @@ declare class PyodideAPI {
1336
1342
  *
1337
1343
  * @hidetype
1338
1344
  * @alias
1339
- * @doc_kind class
1345
+ * @dockind class
1340
1346
  * @deprecated
1341
1347
  */
1342
1348
  static get PythonError(): typeof PythonError;
@@ -1349,12 +1355,12 @@ declare class PyodideAPI {
1349
1355
  static setDebug(debug: boolean): boolean;
1350
1356
  }
1351
1357
  /** @hidetype */
1352
- export declare type PyodideInterface = typeof PyodideAPI;
1358
+ export type PyodideInterface = typeof PyodideAPI;
1353
1359
  /**
1354
1360
  * See documentation for loadPyodide.
1355
1361
  * @private
1356
1362
  */
1357
- export declare type ConfigType = {
1363
+ type ConfigType = {
1358
1364
  indexURL: string;
1359
1365
  packageCacheDir: string;
1360
1366
  lockFileURL: string;
@@ -1488,6 +1494,12 @@ export declare function loadPyodide(options?: {
1488
1494
  * while Pyodide bootstraps itself.
1489
1495
  */
1490
1496
  packages?: string[];
1497
+ /**
1498
+ * Opt into the old behavior where PyProxy.toString calls `repr` and not
1499
+ * `str`.
1500
+ * @deprecated
1501
+ */
1502
+ pyproxyToStringRepr?: boolean;
1491
1503
  /**
1492
1504
  * @ignore
1493
1505
  */
package/pyodide.js CHANGED
@@ -1,13 +1,12 @@
1
- "use strict";var loadPyodide=(()=>{var te=Object.create;var w=Object.defineProperty;var re=Object.getOwnPropertyDescriptor;var ne=Object.getOwnPropertyNames;var ie=Object.getPrototypeOf,oe=Object.prototype.hasOwnProperty;var m=(e,t)=>w(e,"name",{value:t,configurable:!0}),g=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,a)=>(typeof require<"u"?require:t)[a]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw new Error('Dynamic require of "'+e+'" is not supported')});var U=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),ae=(e,t)=>{for(var a in t)w(e,a,{get:t[a],enumerable:!0})},$=(e,t,a,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of ne(t))!oe.call(e,o)&&o!==a&&w(e,o,{get:()=>t[o],enumerable:!(s=re(t,o))||s.enumerable});return e};var b=(e,t,a)=>(a=e!=null?te(ie(e)):{},$(t||!e||!e.__esModule?w(a,"default",{value:e,enumerable:!0}):a,e)),se=e=>$(w({},"__esModule",{value:!0}),e);var C=U((R,j)=>{(function(e,t){"use strict";typeof define=="function"&&define.amd?define("stackframe",[],t):typeof R=="object"?j.exports=t():e.StackFrame=t()})(R,function(){"use strict";function e(u){return!isNaN(parseFloat(u))&&isFinite(u)}m(e,"_isNumber");function t(u){return u.charAt(0).toUpperCase()+u.substring(1)}m(t,"_capitalize");function a(u){return function(){return this[u]}}m(a,"_getter");var s=["isConstructor","isEval","isNative","isToplevel"],o=["columnNumber","lineNumber"],r=["fileName","functionName","source"],n=["args"],c=["evalOrigin"],i=s.concat(o,r,n,c);function l(u){if(u)for(var y=0;y<i.length;y++)u[i[y]]!==void 0&&this["set"+t(i[y])](u[i[y]])}m(l,"StackFrame"),l.prototype={getArgs:function(){return this.args},setArgs:function(u){if(Object.prototype.toString.call(u)!=="[object Array]")throw new TypeError("Args must be an Array");this.args=u},getEvalOrigin:function(){return this.evalOrigin},setEvalOrigin:function(u){if(u instanceof l)this.evalOrigin=u;else if(u instanceof Object)this.evalOrigin=new l(u);else throw new TypeError("Eval Origin must be an Object or StackFrame")},toString:function(){var u=this.getFileName()||"",y=this.getLineNumber()||"",h=this.getColumnNumber()||"",_=this.getFunctionName()||"";return this.getIsEval()?u?"[eval] ("+u+":"+y+":"+h+")":"[eval]:"+y+":"+h:_?_+" ("+u+":"+y+":"+h+")":u+":"+y+":"+h}},l.fromString=m(function(y){var h=y.indexOf("("),_=y.lastIndexOf(")"),Y=y.substring(0,h),J=y.substring(h+1,_).split(","),D=y.substring(_+1);if(D.indexOf("@")===0)var O=/@(.+?)(?::(\d+))?(?::(\d+))?$/.exec(D,""),Q=O[1],Z=O[2],ee=O[3];return new l({functionName:Y,args:J||void 0,fileName:Q,lineNumber:Z||void 0,columnNumber:ee||void 0})},"StackFrame$$fromString");for(var d=0;d<s.length;d++)l.prototype["get"+t(s[d])]=a(s[d]),l.prototype["set"+t(s[d])]=function(u){return function(y){this[u]=!!y}}(s[d]);for(var p=0;p<o.length;p++)l.prototype["get"+t(o[p])]=a(o[p]),l.prototype["set"+t(o[p])]=function(u){return function(y){if(!e(y))throw new TypeError(u+" must be a Number");this[u]=Number(y)}}(o[p]);for(var f=0;f<r.length;f++)l.prototype["get"+t(r[f])]=a(r[f]),l.prototype["set"+t(r[f])]=function(u){return function(y){this[u]=String(y)}}(r[f]);return l})});var A=U((N,M)=>{(function(e,t){"use strict";typeof define=="function"&&define.amd?define("error-stack-parser",["stackframe"],t):typeof N=="object"?M.exports=t(C()):e.ErrorStackParser=t(e.StackFrame)})(N,m(function(t){"use strict";var a=/(^|@)\S+:\d+/,s=/^\s*at .*(\S+:\d+|\(native\))/m,o=/^(eval@)?(\[native code])?$/;return{parse:m(function(n){if(typeof n.stacktrace<"u"||typeof n["opera#sourceloc"]<"u")return this.parseOpera(n);if(n.stack&&n.stack.match(s))return this.parseV8OrIE(n);if(n.stack)return this.parseFFOrSafari(n);throw new Error("Cannot parse given Error object")},"ErrorStackParser$$parse"),extractLocation:m(function(n){if(n.indexOf(":")===-1)return[n];var c=/(.+?)(?::(\d+))?(?::(\d+))?$/,i=c.exec(n.replace(/[()]/g,""));return[i[1],i[2]||void 0,i[3]||void 0]},"ErrorStackParser$$extractLocation"),parseV8OrIE:m(function(n){var c=n.stack.split(`
2
- `).filter(function(i){return!!i.match(s)},this);return c.map(function(i){i.indexOf("(eval ")>-1&&(i=i.replace(/eval code/g,"eval").replace(/(\(eval at [^()]*)|(,.*$)/g,""));var l=i.replace(/^\s+/,"").replace(/\(eval code/g,"(").replace(/^.*?\s+/,""),d=l.match(/ (\(.+\)$)/);l=d?l.replace(d[0],""):l;var p=this.extractLocation(d?d[1]:l),f=d&&l||void 0,u=["eval","<anonymous>"].indexOf(p[0])>-1?void 0:p[0];return new t({functionName:f,fileName:u,lineNumber:p[1],columnNumber:p[2],source:i})},this)},"ErrorStackParser$$parseV8OrIE"),parseFFOrSafari:m(function(n){var c=n.stack.split(`
3
- `).filter(function(i){return!i.match(o)},this);return c.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 t({functionName:i});var l=/((.*".+"[^@]*)?[^@]*)(?:@)/,d=i.match(l),p=d&&d[1]?d[1]:void 0,f=this.extractLocation(i.replace(l,""));return new t({functionName:p,fileName:f[0],lineNumber:f[1],columnNumber:f[2],source:i})},this)},"ErrorStackParser$$parseFFOrSafari"),parseOpera:m(function(n){return!n.stacktrace||n.message.indexOf(`
1
+ "use strict";var loadPyodide=(()=>{var ce=Object.create;var _=Object.defineProperty;var le=Object.getOwnPropertyDescriptor;var de=Object.getOwnPropertyNames;var fe=Object.getPrototypeOf,ue=Object.prototype.hasOwnProperty;var f=(t,e)=>_(t,"name",{value:e,configurable:!0}),g=(t=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:(e,c)=>(typeof require<"u"?require:e)[c]}):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),pe=(t,e)=>{for(var c in e)_(t,c,{get:e[c],enumerable:!0})},$=(t,e,c,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of de(e))!ue.call(t,a)&&a!==c&&_(t,a,{get:()=>e[a],enumerable:!(o=le(e,a))||o.enumerable});return t};var h=(t,e,c)=>(c=t!=null?ce(fe(t)):{},$(e||!t||!t.__esModule?_(c,"default",{value:t,enumerable:!0}):c,t)),me=t=>$(_({},"__esModule",{value:!0}),t);var B=U((R,C)=>{(function(t,e){"use strict";typeof define=="function"&&define.amd?define("stackframe",[],e):typeof R=="object"?C.exports=e():t.StackFrame=e()})(R,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 c(d){return function(){return this[d]}}f(c,"_getter");var o=["isConstructor","isEval","isNative","isToplevel"],a=["columnNumber","lineNumber"],r=["fileName","functionName","source"],n=["args"],u=["evalOrigin"],i=o.concat(a,r,n,u);function s(d){if(d)for(var y=0;y<i.length;y++)d[i[y]]!==void 0&&this["set"+e(i[y])](d[i[y]])}f(s,"StackFrame"),s.prototype={getArgs:function(){return this.args},setArgs:function(d){if(Object.prototype.toString.call(d)!=="[object Array]")throw new TypeError("Args must be an Array");this.args=d},getEvalOrigin:function(){return this.evalOrigin},setEvalOrigin:function(d){if(d instanceof s)this.evalOrigin=d;else if(d instanceof Object)this.evalOrigin=new s(d);else throw new TypeError("Eval Origin must be an Object or StackFrame")},toString:function(){var d=this.getFileName()||"",y=this.getLineNumber()||"",w=this.getColumnNumber()||"",E=this.getFunctionName()||"";return this.getIsEval()?d?"[eval] ("+d+":"+y+":"+w+")":"[eval]:"+y+":"+w:E?E+" ("+d+":"+y+":"+w+")":d+":"+y+":"+w}},s.fromString=f(function(y){var w=y.indexOf("("),E=y.lastIndexOf(")"),ne=y.substring(0,w),ie=y.substring(w+1,E).split(","),M=y.substring(E+1);if(M.indexOf("@")===0)var N=/@(.+?)(?::(\d+))?(?::(\d+))?$/.exec(M,""),oe=N[1],ae=N[2],se=N[3];return new s({functionName:ne,args:ie||void 0,fileName:oe,lineNumber:ae||void 0,columnNumber:se||void 0})},"StackFrame$$fromString");for(var l=0;l<o.length;l++)s.prototype["get"+e(o[l])]=c(o[l]),s.prototype["set"+e(o[l])]=function(d){return function(y){this[d]=!!y}}(o[l]);for(var m=0;m<a.length;m++)s.prototype["get"+e(a[m])]=c(a[m]),s.prototype["set"+e(a[m])]=function(d){return function(y){if(!t(y))throw new TypeError(d+" must be a Number");this[d]=Number(y)}}(a[m]);for(var p=0;p<r.length;p++)s.prototype["get"+e(r[p])]=c(r[p]),s.prototype["set"+e(r[p])]=function(d){return function(y){this[d]=String(y)}}(r[p]);return s})});var j=U((k,W)=>{(function(t,e){"use strict";typeof define=="function"&&define.amd?define("error-stack-parser",["stackframe"],e):typeof k=="object"?W.exports=e(B()):t.ErrorStackParser=e(t.StackFrame)})(k,f(function(e){"use strict";var c=/(^|@)\S+:\d+/,o=/^\s*at .*(\S+:\d+|\(native\))/m,a=/^(eval@)?(\[native code])?$/;return{parse:f(function(n){if(typeof n.stacktrace<"u"||typeof n["opera#sourceloc"]<"u")return this.parseOpera(n);if(n.stack&&n.stack.match(o))return this.parseV8OrIE(n);if(n.stack)return this.parseFFOrSafari(n);throw new Error("Cannot parse given Error object")},"ErrorStackParser$$parse"),extractLocation:f(function(n){if(n.indexOf(":")===-1)return[n];var u=/(.+?)(?::(\d+))?(?::(\d+))?$/,i=u.exec(n.replace(/[()]/g,""));return[i[1],i[2]||void 0,i[3]||void 0]},"ErrorStackParser$$extractLocation"),parseV8OrIE:f(function(n){var u=n.stack.split(`
2
+ `).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 s=i.replace(/^\s+/,"").replace(/\(eval code/g,"(").replace(/^.*?\s+/,""),l=s.match(/ (\(.+\)$)/);s=l?s.replace(l[0],""):s;var m=this.extractLocation(l?l[1]:s),p=l&&s||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(`
3
+ `).filter(function(i){return!i.match(a)},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 s=/((.*".+"[^@]*)?[^@]*)(?:@)/,l=i.match(s),m=l&&l[1]?l[1]:void 0,p=this.extractLocation(i.replace(s,""));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(`
4
4
  `)>-1&&n.message.split(`
5
5
  `).length>n.stacktrace.split(`
6
- `).length?this.parseOpera9(n):n.stack?this.parseOpera11(n):this.parseOpera10(n)},"ErrorStackParser$$parseOpera"),parseOpera9:m(function(n){for(var c=/Line (\d+).*script (?:in )?(\S+)/i,i=n.message.split(`
7
- `),l=[],d=2,p=i.length;d<p;d+=2){var f=c.exec(i[d]);f&&l.push(new t({fileName:f[2],lineNumber:f[1],source:i[d]}))}return l},"ErrorStackParser$$parseOpera9"),parseOpera10:m(function(n){for(var c=/Line (\d+).*script (?:in )?(\S+)(?:: In function (\S+))?$/i,i=n.stacktrace.split(`
8
- `),l=[],d=0,p=i.length;d<p;d+=2){var f=c.exec(i[d]);f&&l.push(new t({functionName:f[3]||void 0,fileName:f[2],lineNumber:f[1],source:i[d]}))}return l},"ErrorStackParser$$parseOpera10"),parseOpera11:m(function(n){var c=n.stack.split(`
9
- `).filter(function(i){return!!i.match(a)&&!i.match(/^Error created at/)},this);return c.map(function(i){var l=i.split("@"),d=this.extractLocation(l.pop()),p=l.shift()||"",f=p.replace(/<anonymous function(: (\w+))?>/,"$2").replace(/\([^)]*\)/g,"")||void 0,u;p.match(/\(([^)]*)\)/)&&(u=p.replace(/^[^(]+\(([^)]*)\)$/,"$1"));var y=u===void 0||u==="[arguments not available]"?void 0:u.split(",");return new t({functionName:f,args:y,fileName:d[0],lineNumber:d[1],columnNumber:d[2],source:i})},this)},"ErrorStackParser$$parseOpera11")}},"ErrorStackParser"))});var we={};ae(we,{loadPyodide:()=>T,version:()=>v});var X=b(A());var k=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string"&&typeof process.browser=="undefined",B,F,L,W,H;async function I(){if(!k||(B=(await import("url")).default,H=await import("fs/promises"),globalThis.fetch?F=fetch:F=(await import("node-fetch")).default,W=(await import("vm")).default,L=await import("path"),x=L.sep,typeof g!="undefined"))return;let e=await import("fs"),t=await import("crypto"),a=await import("ws"),s=await import("child_process"),o={fs:e,crypto:t,ws:a,child_process:s};globalThis.require=function(r){return o[r]}}m(I,"initNodeModules");function le(e,t){return L.resolve(t||".",e)}m(le,"node_resolvePath");function de(e,t){return t===void 0&&(t=location),new URL(e,t).toString()}m(de,"browser_resolvePath");var P;k?P=le:P=de;var x;k||(x="/");function ce(e,t){return e.startsWith("file://")&&(e=e.slice(7)),e.includes("://")?{response:F(e)}:{binary:H.readFile(e).then(a=>new Uint8Array(a.buffer,a.byteOffset,a.byteLength))}}m(ce,"node_getBinaryResponse");function ue(e,t){let a=new URL(e,location);return{response:fetch(a,t?{integrity:t}:{})}}m(ue,"browser_getBinaryResponse");var E;k?E=ce:E=ue;async function z(e,t){let{response:a,binary:s}=E(e,t);if(s)return s;let o=await a;if(!o.ok)throw new Error(`Failed to load '${e}': request failed.`);return new Uint8Array(await o.arrayBuffer())}m(z,"loadBinaryFile");var S;if(globalThis.document)S=m(async e=>await import(e),"loadScript");else if(globalThis.importScripts)S=m(async e=>{try{globalThis.importScripts(e)}catch(t){if(t instanceof TypeError)await import(e);else throw t}},"loadScript");else if(k)S=fe;else throw new Error("Cannot determine runtime environment");async function fe(e){e.startsWith("file://")&&(e=e.slice(7)),e.includes("://")?W.runInThisContext(await(await F(e)).text()):await import(B.pathToFileURL(e).href)}m(fe,"nodeLoadScript");function G(e){let t=e.FS,a=e.FS.filesystems.MEMFS,s=e.PATH,o={DIR_MODE:16895,FILE_MODE:33279,mount:function(r){if(!r.opts.fileSystemHandle)throw new Error("opts.fileSystemHandle is required");return a.mount.apply(null,arguments)},syncfs:async(r,n,c)=>{try{let i=o.getLocalSet(r),l=await o.getRemoteSet(r),d=n?l:i,p=n?i:l;await o.reconcile(r,d,p),c(null)}catch(i){c(i)}},getLocalSet:r=>{let n=Object.create(null);function c(d){return d!=="."&&d!==".."}m(c,"isRealDir");function i(d){return p=>s.join2(d,p)}m(i,"toAbsolute");let l=t.readdir(r.mountpoint).filter(c).map(i(r.mountpoint));for(;l.length;){let d=l.pop(),p=t.stat(d);t.isDir(p.mode)&&l.push.apply(l,t.readdir(d).filter(c).map(i(d))),n[d]={timestamp:p.mtime,mode:p.mode}}return{type:"local",entries:n}},getRemoteSet:async r=>{let n=Object.create(null),c=await me(r.opts.fileSystemHandle);for(let[i,l]of c)i!=="."&&(n[s.join2(r.mountpoint,i)]={timestamp:l.kind==="file"?(await l.getFile()).lastModifiedDate:new Date,mode:l.kind==="file"?o.FILE_MODE:o.DIR_MODE});return{type:"remote",entries:n,handles:c}},loadLocalEntry:r=>{let c=t.lookupPath(r).node,i=t.stat(r);if(t.isDir(i.mode))return{timestamp:i.mtime,mode:i.mode};if(t.isFile(i.mode))return c.contents=a.getFileDataAsTypedArray(c),{timestamp:i.mtime,mode:i.mode,contents:c.contents};throw new Error("node type not supported")},storeLocalEntry:(r,n)=>{if(t.isDir(n.mode))t.mkdirTree(r,n.mode);else if(t.isFile(n.mode))t.writeFile(r,n.contents,{canOwn:!0});else throw new Error("node type not supported");t.chmod(r,n.mode),t.utime(r,n.timestamp,n.timestamp)},removeLocalEntry:r=>{var n=t.stat(r);t.isDir(n.mode)?t.rmdir(r):t.isFile(n.mode)&&t.unlink(r)},loadRemoteEntry:async r=>{if(r.kind==="file"){let n=await r.getFile();return{contents:new Uint8Array(await n.arrayBuffer()),mode:o.FILE_MODE,timestamp:n.lastModifiedDate}}else{if(r.kind==="directory")return{mode:o.DIR_MODE,timestamp:new Date};throw new Error("unknown kind: "+r.kind)}},storeRemoteEntry:async(r,n,c)=>{let i=r.get(s.dirname(n)),l=t.isFile(c.mode)?await i.getFileHandle(s.basename(n),{create:!0}):await i.getDirectoryHandle(s.basename(n),{create:!0});if(l.kind==="file"){let d=await l.createWritable();await d.write(c.contents),await d.close()}r.set(n,l)},removeRemoteEntry:async(r,n)=>{await r.get(s.dirname(n)).removeEntry(s.basename(n)),r.delete(n)},reconcile:async(r,n,c)=>{let i=0,l=[];Object.keys(n.entries).forEach(function(f){let u=n.entries[f],y=c.entries[f];(!y||t.isFile(u.mode)&&u.timestamp.getTime()>y.timestamp.getTime())&&(l.push(f),i++)}),l.sort();let d=[];if(Object.keys(c.entries).forEach(function(f){n.entries[f]||(d.push(f),i++)}),d.sort().reverse(),!i)return;let p=n.type==="remote"?n.handles:c.handles;for(let f of l){let u=s.normalize(f.replace(r.mountpoint,"/")).substring(1);if(c.type==="local"){let y=p.get(u),h=await o.loadRemoteEntry(y);o.storeLocalEntry(f,h)}else{let y=o.loadLocalEntry(f);await o.storeRemoteEntry(p,u,y)}}for(let f of d)if(c.type==="local")o.removeLocalEntry(f);else{let u=s.normalize(f.replace(r.mountpoint,"/")).substring(1);await o.removeRemoteEntry(p,u)}}};e.FS.filesystems.NATIVEFS_ASYNC=o}m(G,"initializeNativeFS");var me=m(async e=>{let t=[];async function a(o){for await(let r of o.values())t.push(r),r.kind==="directory"&&await a(r)}m(a,"collect"),await a(e);let s=new Map;s.set(".",e);for(let o of t){let r=(await e.resolve(o)).join("/");s.set(r,o)}return s},"getFsHandles");function V(){let e={};return e.noImageDecoding=!0,e.noAudioDecoding=!0,e.noWasmDecoding=!1,e.preRun=[],e.quit=(t,a)=>{throw e.exited={status:t,toThrow:a},a},e}m(V,"createModule");function pe(e,t){e.preRun.push(function(){let a="/";try{e.FS.mkdirTree(t)}catch(s){console.error(`Error occurred while making a home directory '${t}':`),console.error(s),console.error(`Using '${a}' for a home directory instead`),t=a}e.FS.chdir(t)})}m(pe,"createHomeDirectory");function ye(e,t){e.preRun.push(function(){Object.assign(e.ENV,t)})}m(ye,"setEnvironment");function ge(e,t){e.preRun.push(()=>{for(let a of t)e.FS.mkdirTree(a),e.FS.mount(e.FS.filesystems.NODEFS,{root:a},a)})}m(ge,"mountLocalDirectories");function be(e,t){let a=z(t);e.preRun.push(()=>{let s=e._py_version_major(),o=e._py_version_minor();e.FS.mkdirTree("/lib"),e.FS.mkdirTree(`/lib/python${s}.${o}/site-packages`),e.addRunDependency("install-stdlib"),a.then(r=>{e.FS.writeFile(`/lib/python${s}${o}.zip`,r)}).catch(r=>{console.error("Error occurred while installing the standard library:"),console.error(r)}).finally(()=>{e.removeRunDependency("install-stdlib")})})}m(be,"installStdlib");function q(e,t){let a;t.stdLibURL!=null?a=t.stdLibURL:a=t.indexURL+"python_stdlib.zip",be(e,a),pe(e,t.env.HOME),ye(e,t.env),ge(e,t._node_mounts),e.preRun.push(()=>G(e))}m(q,"initializeFileSystem");function K(e,t){let{binary:a,response:s}=E(t+"pyodide.asm.wasm");e.instantiateWasm=function(o,r){return async function(){try{let n;s?n=await WebAssembly.instantiateStreaming(s,o):n=await WebAssembly.instantiate(await a,o);let{instance:c,module:i}=n;typeof WasmOffsetConverter!="undefined"&&(wasmOffsetConverter=new WasmOffsetConverter(wasmBinary,i)),r(c,i)}catch(n){console.warn("wasm instantiation failed!"),console.warn(n)}}(),{}}}m(K,"preloadWasm");var v="0.24.1";function he(e,t){return new Proxy(e,{get(a,s){return s==="get"?o=>{let r=a.get(o);return r===void 0&&(r=t.get(o)),r}:s==="has"?o=>a.has(o)||t.has(o):Reflect.get(a,s)}})}m(he,"wrapPythonGlobals");function ve(e,t){e.runPythonInternal_dict=e._pyodide._base.eval_code("{}"),e.importlib=e.runPythonInternal("import importlib; importlib");let a=e.importlib.import_module;e.sys=a("sys"),e.sys.path.insert(0,t.env.HOME),e.os=a("os");let s=e.runPythonInternal("import __main__; __main__.__dict__"),o=e.runPythonInternal("import builtins; builtins.__dict__");e.globals=he(s,o);let r=e._pyodide._importhook;function n(i){"__all__"in i||Object.defineProperty(i,"__all__",{get:()=>c.toPy(Object.getOwnPropertyNames(i).filter(l=>l!=="__all__")),enumerable:!1,configurable:!0})}m(n,"jsFinderHook"),r.register_js_finder.callKwargs({hook:n}),r.register_js_module("js",t.jsglobals);let c=e.makePublicAPI();return r.register_js_module("pyodide_js",c),e.pyodide_py=a("pyodide"),e.pyodide_code=a("pyodide.code"),e.pyodide_ffi=a("pyodide.ffi"),e.package_loader=a("pyodide._package_loader"),e.sitepackages=e.package_loader.SITE_PACKAGES.__str__(),e.dsodir=e.package_loader.DSO_DIR.__str__(),e.defaultLdLibraryPath=[e.dsodir,e.sitepackages],e.os.environ.__setitem__("LD_LIBRARY_PATH",e.defaultLdLibraryPath.join(":")),c.pyodide_py=e.pyodide_py,c.globals=e.globals,c}m(ve,"finalizeBootstrap");function _e(){if(typeof __dirname=="string")return __dirname;let e;try{throw new Error}catch(s){e=s}let t=X.default.parse(e)[0].fileName,a=t.lastIndexOf(x);if(a===-1)throw new Error("Could not extract indexURL path from pyodide module location");return t.slice(0,a)}m(_e,"calculateIndexURL");async function T(e={}){await I();let t=e.indexURL||_e();t=P(t),t.endsWith("/")||(t+="/"),e.indexURL=t;let a={fullStdLib:!1,jsglobals:globalThis,stdin:globalThis.prompt?globalThis.prompt:void 0,lockFileURL:t+"pyodide-lock.json",args:[],_node_mounts:[],env:{},packageCacheDir:t,packages:[]},s=Object.assign(a,e);if(e.homedir){if(console.warn("The homedir argument to loadPyodide is deprecated. Use 'env: { HOME: value }' instead of 'homedir: value'."),e.env&&e.env.HOME)throw new Error("Set both env.HOME and homedir arguments");s.env.HOME=s.homedir}s.env.HOME||(s.env.HOME="/home/pyodide");let o=V();o.print=s.stdout,o.printErr=s.stderr,o.arguments=s.args;let r={config:s};o.API=r,K(o,t),q(o,s);let n=new Promise(f=>o.postRun=f),c;if(r.bootstrapFinalizedPromise=new Promise(f=>c=f),o.locateFile=f=>s.indexURL+f,typeof _createPyodideModule!="function"){let f=`${s.indexURL}pyodide.asm.js`;await S(f)}if(await _createPyodideModule(o),await n,o.exited)throw o.exited.toThrow;if(r.version!==v)throw new Error(`Pyodide version does not match: '${v}' <==> '${r.version}'. If you updated the Pyodide version, make sure you also updated the 'indexURL' parameter passed to loadPyodide.`);o.locateFile=f=>{throw new Error("Didn't expect to load any more file_packager files!")};let[i,l]=r.rawRun("import _pyodide_core");i&&o.API.fatal_loading_error(`Failed to import _pyodide_core
10
- `,l);let d=ve(r,s);if(c(),d.version.includes("dev")||r.setCdnUrl(`https://cdn.jsdelivr.net/pyodide/v${d.version}/full/`),await r.packageIndexReady,r._pyodide._importhook.register_module_not_found_hook(r._import_name_to_package_name,r.lockfile_unvendored_stdlibs_and_test),r.lockfile_info.version!==v)throw new Error("Lock file version doesn't match Pyodide version");return r.package_loader.init_loaded_packages(),s.fullStdLib&&await d.loadPackage(r.lockfile_unvendored_stdlibs),r.initializeStreams(s.stdin,s.stdout,s.stderr),d}m(T,"loadPyodide");globalThis.loadPyodide=T;return se(we);})();
6
+ `).length?this.parseOpera9(n):n.stack?this.parseOpera11(n):this.parseOpera10(n)},"ErrorStackParser$$parseOpera"),parseOpera9:f(function(n){for(var u=/Line (\d+).*script (?:in )?(\S+)/i,i=n.message.split(`
7
+ `),s=[],l=2,m=i.length;l<m;l+=2){var p=u.exec(i[l]);p&&s.push(new e({fileName:p[2],lineNumber:p[1],source:i[l]}))}return s},"ErrorStackParser$$parseOpera9"),parseOpera10:f(function(n){for(var u=/Line (\d+).*script (?:in )?(\S+)(?:: In function (\S+))?$/i,i=n.stacktrace.split(`
8
+ `),s=[],l=0,m=i.length;l<m;l+=2){var p=u.exec(i[l]);p&&s.push(new e({functionName:p[3]||void 0,fileName:p[2],lineNumber:p[1],source:i[l]}))}return s},"ErrorStackParser$$parseOpera10"),parseOpera11:f(function(n){var u=n.stack.split(`
9
+ `).filter(function(i){return!!i.match(c)&&!i.match(/^Error created at/)},this);return u.map(function(i){var s=i.split("@"),l=this.extractLocation(s.pop()),m=s.shift()||"",p=m.replace(/<anonymous function(: (\w+))?>/,"$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:l[0],lineNumber:l[1],columnNumber:l[2],source:i})},this)},"ErrorStackParser$$parseOpera11")}},"ErrorStackParser"))});var Ne={};pe(Ne,{loadPyodide:()=>T,version:()=>b});var G=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",H=v&&!F,ye=typeof Deno<"u",z=!v&&!ye,q=z&&typeof window<"u"&&typeof document<"u"&&typeof document.createElement<"u"&&typeof sessionStorage<"u",V=z&&typeof importScripts<"u"&&typeof self<"u";var K,O,L,X,I,ge=`"fetch" is not defined, maybe you're using node < 18? From Pyodide >= 0.25.0, node >= 18 is required. Older versions of Node.js may work, but it is not guaranteed or supported. Falling back to "node-fetch".`;async function A(){if(!v||(K=(await import("url")).default,I=await import("fs/promises"),globalThis.fetch?O=fetch:(console.warn(ge),O=(await import("node-fetch")).default),X=(await import("vm")).default,L=await import("path"),D=L.sep,typeof g<"u"))return;let t=await import("fs"),e=await import("crypto"),c=await import("ws"),o=await import("child_process"),a={fs:t,crypto:e,ws:c,child_process:o};globalThis.require=function(r){return a[r]}}f(A,"initNodeModules");function he(t,e){return L.resolve(e||".",t)}f(he,"node_resolvePath");function ve(t,e){return e===void 0&&(e=location),new URL(t,e).toString()}f(ve,"browser_resolvePath");var x;v?x=he:x=ve;var D;v||(D="/");function we(t,e){return t.startsWith("file://")&&(t=t.slice(7)),t.includes("://")?{response:O(t)}:{binary:I.readFile(t).then(c=>new Uint8Array(c.buffer,c.byteOffset,c.byteLength))}}f(we,"node_getBinaryResponse");function be(t,e){let c=new URL(t,location);return{response:fetch(c,e?{integrity:e}:{})}}f(be,"browser_getBinaryResponse");var S;v?S=we:S=be;async function J(t,e){let{response:c,binary:o}=S(t,e);if(o)return o;let a=await c;if(!a.ok)throw new Error(`Failed to load '${t}': request failed.`);return new Uint8Array(await a.arrayBuffer())}f(J,"loadBinaryFile");var P;if(q)P=f(async t=>await import(t),"loadScript");else if(V)P=f(async t=>{try{globalThis.importScripts(t)}catch(e){if(e instanceof TypeError)await import(t);else throw e}},"loadScript");else if(v)P=Ee;else throw new Error("Cannot determine runtime environment");async function Ee(t){t.startsWith("file://")&&(t=t.slice(7)),t.includes("://")?X.runInThisContext(await(await O(t)).text()):await import(K.pathToFileURL(t).href)}f(Ee,"nodeLoadScript");async function Y(t){if(v){await A();let e=await I.readFile(t);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(o){t=o}let e=G.default.parse(t)[0].fileName;if(H){let o=await import("path");return(await import("url")).fileURLToPath(o.dirname(e))}let c=e.lastIndexOf(D);if(c===-1)throw new Error("Could not extract indexURL path from pyodide module location");return e.slice(0,c)}f(Q,"calculateDirname");function Z(t){let e=t.FS,c=t.FS.filesystems.MEMFS,o=t.PATH,a={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=a.getLocalSet(r),s=await a.getRemoteSet(r),l=n?s:i,m=n?i:s;await a.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 s=e.readdir(r.mountpoint).filter(u).map(i(r.mountpoint));for(;s.length;){let l=s.pop(),m=e.stat(l);e.isDir(m.mode)&&s.push.apply(s,e.readdir(l).filter(u).map(i(l))),n[l]={timestamp:m.mtime,mode:m.mode}}return{type:"local",entries:n}},getRemoteSet:async r=>{let n=Object.create(null),u=await _e(r.opts.fileSystemHandle);for(let[i,s]of u)i!=="."&&(n[o.join2(r.mountpoint,i)]={timestamp:s.kind==="file"?(await s.getFile()).lastModifiedDate:new Date,mode:s.kind==="file"?a.FILE_MODE:a.DIR_MODE});return{type:"remote",entries:n,handles:u}},loadLocalEntry:r=>{let u=e.lookupPath(r).node,i=e.stat(r);if(e.isDir(i.mode))return{timestamp:i.mtime,mode:i.mode};if(e.isFile(i.mode))return u.contents=c.getFileDataAsTypedArray(u),{timestamp:i.mtime,mode:i.mode,contents:u.contents};throw new Error("node type not supported")},storeLocalEntry:(r,n)=>{if(e.isDir(n.mode))e.mkdirTree(r,n.mode);else if(e.isFile(n.mode))e.writeFile(r,n.contents,{canOwn:!0});else throw new Error("node type not supported");e.chmod(r,n.mode),e.utime(r,n.timestamp,n.timestamp)},removeLocalEntry:r=>{var n=e.stat(r);e.isDir(n.mode)?e.rmdir(r):e.isFile(n.mode)&&e.unlink(r)},loadRemoteEntry:async r=>{if(r.kind==="file"){let n=await r.getFile();return{contents:new Uint8Array(await n.arrayBuffer()),mode:a.FILE_MODE,timestamp:n.lastModifiedDate}}else{if(r.kind==="directory")return{mode:a.DIR_MODE,timestamp:new Date};throw new Error("unknown kind: "+r.kind)}},storeRemoteEntry:async(r,n,u)=>{let i=r.get(o.dirname(n)),s=e.isFile(u.mode)?await i.getFileHandle(o.basename(n),{create:!0}):await i.getDirectoryHandle(o.basename(n),{create:!0});if(s.kind==="file"){let l=await s.createWritable();await l.write(u.contents),await l.close()}r.set(n,s)},removeRemoteEntry:async(r,n)=>{await r.get(o.dirname(n)).removeEntry(o.basename(n)),r.delete(n)},reconcile:async(r,n,u)=>{let i=0,s=[];Object.keys(n.entries).forEach(function(p){let d=n.entries[p],y=u.entries[p];(!y||e.isFile(d.mode)&&d.timestamp.getTime()>y.timestamp.getTime())&&(s.push(p),i++)}),s.sort();let l=[];if(Object.keys(u.entries).forEach(function(p){n.entries[p]||(l.push(p),i++)}),l.sort().reverse(),!i)return;let m=n.type==="remote"?n.handles:u.handles;for(let p of s){let d=o.normalize(p.replace(r.mountpoint,"/")).substring(1);if(u.type==="local"){let y=m.get(d),w=await a.loadRemoteEntry(y);a.storeLocalEntry(p,w)}else{let y=a.loadLocalEntry(p);await a.storeRemoteEntry(m,d,y)}}for(let p of l)if(u.type==="local")a.removeLocalEntry(p);else{let d=o.normalize(p.replace(r.mountpoint,"/")).substring(1);await a.removeRemoteEntry(m,d)}}};t.FS.filesystems.NATIVEFS_ASYNC=a}f(Z,"initializeNativeFS");var _e=f(async t=>{let e=[];async function c(a){for await(let r of a.values())e.push(r),r.kind==="directory"&&await c(r)}f(c,"collect"),await c(t);let o=new Map;o.set(".",t);for(let a of e){let r=(await t.resolve(a)).join("/");o.set(r,a)}return o},"getFsHandles");function ee(){let t={};return t.noImageDecoding=!0,t.noAudioDecoding=!0,t.noWasmDecoding=!1,t.preRun=[],t.quit=(e,c)=>{throw t.exited={status:e,toThrow:c},c},t}f(ee,"createModule");function Pe(t,e){t.preRun.push(function(){let c="/";try{t.FS.mkdirTree(e)}catch(o){console.error(`Error occurred while making a home directory '${e}':`),console.error(o),console.error(`Using '${c}' for a home directory instead`),e=c}t.FS.chdir(e)})}f(Pe,"createHomeDirectory");function Se(t,e){t.preRun.push(function(){Object.assign(t.ENV,e)})}f(Se,"setEnvironment");function Oe(t,e){t.preRun.push(()=>{for(let c of e)t.FS.mkdirTree(c),t.FS.mount(t.FS.filesystems.NODEFS,{root:c},c)})}f(Oe,"mountLocalDirectories");function xe(t,e){let c=J(e);t.preRun.push(()=>{let o=t._py_version_major(),a=t._py_version_minor();t.FS.mkdirTree("/lib"),t.FS.mkdirTree(`/lib/python${o}.${a}/site-packages`),t.addRunDependency("install-stdlib"),c.then(r=>{t.FS.writeFile(`/lib/python${o}${a}.zip`,r)}).catch(r=>{console.error("Error occurred while installing the standard library:"),console.error(r)}).finally(()=>{t.removeRunDependency("install-stdlib")})})}f(xe,"installStdlib");function te(t,e){let c;e.stdLibURL!=null?c=e.stdLibURL:c=e.indexURL+"python_stdlib.zip",xe(t,c),Pe(t,e.env.HOME),Se(t,e.env),Oe(t,e._node_mounts),t.preRun.push(()=>Z(t))}f(te,"initializeFileSystem");function re(t,e){let{binary:c,response:o}=S(e+"pyodide.asm.wasm");t.instantiateWasm=function(a,r){return async function(){try{let n;o?n=await WebAssembly.instantiateStreaming(o,a):n=await WebAssembly.instantiate(await c,a);let{instance:u,module:i}=n;typeof WasmOffsetConverter<"u"&&(wasmOffsetConverter=new WasmOffsetConverter(wasmBinary,i)),r(u,i)}catch(n){console.warn("wasm instantiation failed!"),console.warn(n)}}(),{}}}f(re,"preloadWasm");var b="0.25.0a1";async function T(t={}){await A();let e=t.indexURL||await Q();e=x(e),e.endsWith("/")||(e+="/"),t.indexURL=e;let c={fullStdLib:!1,jsglobals:globalThis,stdin:globalThis.prompt?globalThis.prompt:void 0,lockFileURL:e+"pyodide-lock.json",args:[],_node_mounts:[],env:{},packageCacheDir:e,packages:[]},o=Object.assign(c,t);if(t.homedir){if(console.warn("The homedir argument to loadPyodide is deprecated. Use 'env: { HOME: value }' instead of 'homedir: value'."),t.env&&t.env.HOME)throw new Error("Set both env.HOME and homedir arguments");o.env.HOME=o.homedir}o.env.HOME||(o.env.HOME="/home/pyodide");let a=ee();a.print=o.stdout,a.printErr=o.stderr,a.arguments=o.args;let r={config:o};a.API=r,r.lockFilePromise=Y(o.lockFileURL),re(a,e),te(a,o);let n=new Promise(s=>a.postRun=s);if(a.locateFile=s=>o.indexURL+s,typeof _createPyodideModule!="function"){let s=`${o.indexURL}pyodide.asm.js`;await P(s)}if(await _createPyodideModule(a),await n,a.exited)throw a.exited.toThrow;if(t.pyproxyToStringRepr&&r.setPyProxyToStringMethod(!0),r.version!==b)throw new Error(`Pyodide version does not match: '${b}' <==> '${r.version}'. If you updated the Pyodide version, make sure you also updated the 'indexURL' parameter passed to loadPyodide.`);a.locateFile=s=>{throw new Error("Didn't expect to load any more file_packager files!")};let u=r.finalizeBootstrap();if(u.version.includes("dev")||r.setCdnUrl(`https://cdn.jsdelivr.net/pyodide/v${u.version}/full/`),await r.packageIndexReady,r._pyodide._importhook.register_module_not_found_hook(r._import_name_to_package_name,r.lockfile_unvendored_stdlibs_and_test),r.lockfile_info.version!==b)throw new Error("Lock file version doesn't match Pyodide version");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(T,"loadPyodide");globalThis.loadPyodide=T;return me(Ne);})();
11
10
  try{Object.assign(exports,loadPyodide)}catch(_){}
12
11
  globalThis.loadPyodide=loadPyodide.loadPyodide;
13
12
  //# sourceMappingURL=pyodide.js.map