pyodide 0.26.0-alpha.4 → 0.26.0-alpha.6

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 v8.1.1
1
+ // Generated by dts-bundle-generator v8.1.2
2
2
 
3
3
  /**
4
4
  *
@@ -9,6 +9,34 @@
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
+ type InFuncType = () => null | undefined | string | ArrayBuffer | Uint8Array | number;
19
+ declare function setStdin(options?: {
20
+ stdin?: InFuncType;
21
+ read?: (buffer: Uint8Array) => number;
22
+ error?: boolean;
23
+ isatty?: boolean;
24
+ autoEOF?: boolean;
25
+ }): void;
26
+ declare function setStdout(options?: {
27
+ batched?: (output: string) => void;
28
+ raw?: (charCode: number) => void;
29
+ write?: (buffer: Uint8Array) => number;
30
+ isatty?: boolean;
31
+ }): void;
32
+ declare function setStderr(options?: {
33
+ batched?: (output: string) => void;
34
+ raw?: (charCode: number) => void;
35
+ write?: (buffer: Uint8Array) => number;
36
+ isatty?: boolean;
37
+ }): void;
38
+ /** @deprecated Use `import type { TypedArray } from "pyodide/ffi"` instead */
39
+ export type TypedArray = Int8Array | Uint8Array | Int16Array | Uint16Array | Int32Array | Uint32Array | Uint8ClampedArray | Float32Array | Float64Array;
12
40
  /** @deprecated Use `import type { PyProxy } from "pyodide/ffi"` instead */
13
41
  interface PyProxy {
14
42
  [x: string]: any;
@@ -42,7 +70,7 @@ declare class PyProxy {
42
70
  get type(): string;
43
71
  /**
44
72
  * Returns `str(o)` (unless `pyproxyToStringRepr: true` was passed to
45
- * :js:func:`loadPyodide` in which case it will return `repr(o)`)
73
+ * :js:func:`~globalThis.loadPyodide` in which case it will return `repr(o)`)
46
74
  */
47
75
  toString(): string;
48
76
  /**
@@ -141,6 +169,21 @@ declare class PyGetItemMethods {
141
169
  * @returns The corresponding value.
142
170
  */
143
171
  get(key: any): any;
172
+ /**
173
+ * Returns the object treated as a json adaptor.
174
+ *
175
+ * With a JsonAdaptor:
176
+ * 1. property access / modification / deletion is implemented with
177
+ * :meth:`~object.__getitem__`, :meth:`~object.__setitem__`, and
178
+ * :meth:`~object.__delitem__` respectively.
179
+ * 2. If an attribute is accessed and the result implements
180
+ * :meth:`~object.__getitem__` then the result will also be a json
181
+ * adaptor.
182
+ *
183
+ * For instance, ``JSON.stringify(proxy.asJsJson())`` acts like an
184
+ * inverse to Python's :py:func:`json.loads`.
185
+ */
186
+ asJsJson(): PyProxy & {};
144
187
  }
145
188
  declare class PyProxyWithSet extends PyProxy {
146
189
  /** @private */
@@ -230,7 +273,7 @@ declare class PyIteratorMethods {
230
273
  *
231
274
  * This will be used implicitly by ``for(let x of proxy){}``.
232
275
  *
233
- * @param any The value to send to the generator. The value will be assigned
276
+ * @param arg The value to send to the generator. The value will be assigned
234
277
  * as a result of a yield expression.
235
278
  * @returns An Object with two properties: ``done`` and ``value``. When the
236
279
  * generator yields ``some_value``, ``next`` returns ``{done : false, value :
@@ -252,7 +295,7 @@ declare class PyGeneratorMethods {
252
295
  *
253
296
  * See the documentation for :js:meth:`Generator.throw`.
254
297
  *
255
- * @param exception Error The error to throw into the generator. Must be an
298
+ * @param exc Error The error to throw into the generator. Must be an
256
299
  * instanceof ``Error``.
257
300
  * @returns An Object with two properties: ``done`` and ``value``. When the
258
301
  * generator yields ``some_value``, ``return`` returns ``{done : false, value
@@ -270,7 +313,7 @@ declare class PyGeneratorMethods {
270
313
  * :py:exc:`GeneratorExit` or :py:exc:`StopIteration`, that error is propagated. See
271
314
  * the documentation for :js:meth:`Generator.return`.
272
315
  *
273
- * @param any The value to return from the generator.
316
+ * @param v The value to return from the generator.
274
317
  * @returns An Object with two properties: ``done`` and ``value``. When the
275
318
  * generator yields ``some_value``, ``return`` returns ``{done : false, value
276
319
  * : some_value}``. When the generator raises a
@@ -296,7 +339,7 @@ declare class PyAsyncIteratorMethods {
296
339
  *
297
340
  * This will be used implicitly by ``for(let x of proxy){}``.
298
341
  *
299
- * @param any The value to send to a generator. The value will be assigned as
342
+ * @param arg The value to send to a generator. The value will be assigned as
300
343
  * a result of a yield expression.
301
344
  * @returns An Object with two properties: ``done`` and ``value``. When the
302
345
  * iterator yields ``some_value``, ``next`` returns ``{done : false, value :
@@ -318,7 +361,7 @@ declare class PyAsyncGeneratorMethods {
318
361
  *
319
362
  * See the documentation for :js:meth:`AsyncGenerator.throw`.
320
363
  *
321
- * @param exception Error The error to throw into the generator. Must be an
364
+ * @param exc Error The error to throw into the generator. Must be an
322
365
  * instanceof ``Error``.
323
366
  * @returns An Object with two properties: ``done`` and ``value``. When the
324
367
  * generator yields ``some_value``, ``return`` returns ``{done : false, value
@@ -336,7 +379,7 @@ declare class PyAsyncGeneratorMethods {
336
379
  * :py:exc:`GeneratorExit` or :py:exc:`StopAsyncIteration`, that error is
337
380
  * propagated. See the documentation for :js:meth:`AsyncGenerator.throw`
338
381
  *
339
- * @param any The value to return from the generator.
382
+ * @param v The value to return from the generator.
340
383
  * @returns An Object with two properties: ``done`` and ``value``. When the
341
384
  * generator yields ``some_value``, ``return`` returns ``{done : false, value
342
385
  * : some_value}``. When the generator raises a :py:exc:`StopAsyncIteration`
@@ -415,7 +458,7 @@ declare class PySequenceMethods {
415
458
  * See :js:meth:`Array.filter`. Creates a shallow copy of a portion of a given
416
459
  * ``Sequence``, filtered down to just the elements from the given array that pass
417
460
  * the test implemented by the provided function.
418
- * @param callbackfn A function to execute for each element in the array. It
461
+ * @param predicate A function to execute for each element in the array. It
419
462
  * should return a truthy value to keep the element in the resulting array,
420
463
  * and a falsy value otherwise.
421
464
  * @param thisArg A value to use as ``this`` when executing ``predicate``.
@@ -424,7 +467,7 @@ declare class PySequenceMethods {
424
467
  /**
425
468
  * See :js:meth:`Array.some`. Tests whether at least one element in the
426
469
  * ``Sequence`` passes the test implemented by the provided function.
427
- * @param callbackfn A function to execute for each element in the
470
+ * @param predicate A function to execute for each element in the
428
471
  * ``Sequence``. It should return a truthy value to indicate the element
429
472
  * passes the test, and a falsy value otherwise.
430
473
  * @param thisArg A value to use as ``this`` when executing ``predicate``.
@@ -433,7 +476,7 @@ declare class PySequenceMethods {
433
476
  /**
434
477
  * See :js:meth:`Array.every`. Tests whether every element in the ``Sequence``
435
478
  * passes the test implemented by the provided function.
436
- * @param callbackfn A function to execute for each element in the
479
+ * @param predicate A function to execute for each element in the
437
480
  * ``Sequence``. It should return a truthy value to indicate the element
438
481
  * passes the test, and a falsy value otherwise.
439
482
  * @param thisArg A value to use as ``this`` when executing ``predicate``.
@@ -446,7 +489,6 @@ declare class PySequenceMethods {
446
489
  * running the reducer across all elements of the Sequence is a single value.
447
490
  * @param callbackfn A function to execute for each element in the ``Sequence``. Its
448
491
  * return value is discarded.
449
- * @param thisArg A value to use as ``this`` when executing ``callbackfn``.
450
492
  */
451
493
  reduce(callbackfn: (previousValue: any, currentValue: any, currentIndex: number, array: any) => any, initialValue?: any): any;
452
494
  /**
@@ -455,7 +497,6 @@ declare class PySequenceMethods {
455
497
  * single value.
456
498
  * @param callbackfn A function to execute for each element in the Sequence.
457
499
  * Its return value is discarded.
458
- * @param thisArg A value to use as ``this`` when executing ``callbackFn``.
459
500
  */
460
501
  reduceRight(callbackfn: (previousValue: any, currentValue: any, currentIndex: number, array: any) => any, initialValue: any): any;
461
502
  /**
@@ -526,6 +567,22 @@ declare class PySequenceMethods {
526
567
  * the provided testing function.
527
568
  */
528
569
  findIndex(predicate: (value: any, index: number, obj: any[]) => any, thisArg?: any): number;
570
+ toJSON(this: any): unknown[];
571
+ /**
572
+ * Returns the object treated as a json adaptor.
573
+ *
574
+ * With a JsonAdaptor:
575
+ * 1. property access / modification / deletion is implemented with
576
+ * :meth:`~object.__getitem__`, :meth:`~object.__setitem__`, and
577
+ * :meth:`~object.__delitem__` respectively.
578
+ * 2. If an attribute is accessed and the result implements
579
+ * :meth:`~object.__getitem__` then the result will also be a json
580
+ * adaptor.
581
+ *
582
+ * For instance, ``JSON.stringify(proxy.asJsJson())`` acts like an
583
+ * inverse to Python's :py:func:`json.loads`.
584
+ */
585
+ asJsJson(): PyProxy & {};
529
586
  }
530
587
  declare class PyMutableSequence extends PyProxy {
531
588
  /** @private */
@@ -652,6 +709,26 @@ declare class PyCallableMethods {
652
709
  * @returns The result from the function call.
653
710
  */
654
711
  call(thisArg: any, ...jsargs: any): any;
712
+ /**
713
+ * Call the Python function. The first parameter controls various parameters
714
+ * that change the way the call is performed.
715
+ *
716
+ * @param options
717
+ * @param options.kwargs If true, the last argument is treated as a collection
718
+ * of keyword arguments.
719
+ * @param options.promising If true, the call is made with stack switching
720
+ * enabled. Not needed if the callee is an async
721
+ * Python function.
722
+ * @param options.relaxed If true, extra arguments are ignored instead of
723
+ * raising a :py:exc:`TypeError`.
724
+ * @param jsargs Arguments to the Python function.
725
+ * @returns
726
+ */
727
+ callWithOptions({ relaxed, kwargs, promising, }: {
728
+ relaxed?: boolean;
729
+ kwargs?: boolean;
730
+ promising?: boolean;
731
+ }, ...jsargs: any): any;
655
732
  /**
656
733
  * Call the function with keyword arguments. The last argument must be an
657
734
  * object with the keyword arguments.
@@ -675,8 +752,8 @@ declare class PyCallableMethods {
675
752
  * will be ignored. This matches the behavior of JavaScript functions more
676
753
  * accurately.
677
754
  *
678
- * Missing arguments are **NOT** filled with `None`. If too few arguments are
679
- * passed, this will still raise a TypeError. Also, if the same argument is
755
+ * Missing arguments are **NOT** filled with ``None``. If too few arguments are
756
+ * passed, this will still raise a :py:exc:`TypeError`. Also, if the same argument is
680
757
  * passed as both a keyword argument and a positional argument, it will raise
681
758
  * an error.
682
759
  *
@@ -684,11 +761,11 @@ declare class PyCallableMethods {
684
761
  */
685
762
  callKwargsRelaxed(...jsargs: any): any;
686
763
  /**
687
- * Call the function with stack switching enabled. Functions called this way
688
- * can use
689
- * :py:meth:`PyodideFuture.syncify() <pyodide.webloop.PyodideFuture.syncify>`
690
- * to block until a :py:class:`~asyncio.Future` or :js:class:`Promise` is
691
- * resolved. Only works in runtimes with JS Promise integration.
764
+ * Call the function with stack switching enabled. The last argument must be
765
+ * an object with the keyword arguments. Functions called this way can use
766
+ * :py:meth:`~pyodide.ffi.run_sync` to block until an
767
+ * :py:class:`~collections.abc.Awaitable` is resolved. Only works in runtimes
768
+ * with JS Promise integration.
692
769
  *
693
770
  * .. admonition:: Experimental
694
771
  * :class: warning
@@ -697,13 +774,13 @@ declare class PyCallableMethods {
697
774
  *
698
775
  * @experimental
699
776
  */
700
- callSyncifying(...jsargs: any): Promise<any>;
777
+ callPromising(...jsargs: any): Promise<any>;
701
778
  /**
702
779
  * Call the function with stack switching enabled. The last argument must be
703
780
  * an object with the keyword arguments. Functions called this way can use
704
- * :py:meth:`PyodideFuture.syncify() <pyodide.webloop.PyodideFuture.syncify>`
705
- * to block until a :py:class:`~asyncio.Future` or :js:class:`Promise` is
706
- * resolved. Only works in runtimes with JS Promise integration.
781
+ * :py:meth:`~pyodide.ffi.run_sync` to block until an
782
+ * :py:class:`~collections.abc.Awaitable` is resolved. Only works in runtimes
783
+ * with JS Promise integration.
707
784
  *
708
785
  * .. admonition:: Experimental
709
786
  * :class: warning
@@ -712,7 +789,7 @@ declare class PyCallableMethods {
712
789
  *
713
790
  * @experimental
714
791
  */
715
- callSyncifyingKwargs(...jsargs: any): Promise<any>;
792
+ callPromisingKwargs(...jsargs: any): Promise<any>;
716
793
  /**
717
794
  * The ``bind()`` method creates a new function that, when called, has its
718
795
  * ``this`` keyword set to the provided value, with a given sequence of
@@ -790,7 +867,7 @@ declare class PyBufferMethods {
790
867
  * @param type The type of the :js:attr:`~pyodide.ffi.PyBufferView.data` field
791
868
  * in the output. Should be one of: ``"i8"``, ``"u8"``, ``"u8clamped"``,
792
869
  * ``"i16"``, ``"u16"``, ``"i32"``, ``"u32"``, ``"i32"``, ``"u32"``,
793
- * ``"i64"``, ``"u64"``, ``"f32"``, ``"f64``, or ``"dataview"``. This argument
870
+ * ``"i64"``, ``"u64"``, ``"f32"``, ``"f64"``, or ``"dataview"``. This argument
794
871
  * is optional, if absent :js:meth:`~pyodide.ffi.PyBuffer.getBuffer` will try
795
872
  * to determine the appropriate output type based on the buffer format string
796
873
  * (see :std:ref:`struct-format-strings`).
@@ -835,7 +912,8 @@ declare class PyBufferView {
835
912
  ndim: number;
836
913
  /**
837
914
  * The total number of bytes the buffer takes up. This is equal to
838
- * :js:attr:`buff.data.byteLength <TypedArray.byteLength>`. See :py:attr:`memoryview.nbytes`.
915
+ * :js:attr:`buff.data.byteLength <TypedArray.byteLength>`. See
916
+ * :py:attr:`memoryview.nbytes`.
839
917
  */
840
918
  nbytes: number;
841
919
  /**
@@ -884,7 +962,13 @@ declare class PyBufferView {
884
962
  * Is it Fortran contiguous? See :py:attr:`memoryview.f_contiguous`.
885
963
  */
886
964
  f_contiguous: boolean;
965
+ /**
966
+ * @private
967
+ */
887
968
  _released: boolean;
969
+ /**
970
+ * @private
971
+ */
888
972
  _view_ptr: number;
889
973
  /** @private */
890
974
  constructor();
@@ -893,47 +977,19 @@ declare class PyBufferView {
893
977
  */
894
978
  release(): void;
895
979
  }
896
- type InFuncType = () => null | undefined | string | ArrayBuffer | Uint8Array | number;
897
- declare function setStdin(options?: {
898
- stdin?: InFuncType;
899
- read?: (buffer: Uint8Array) => number;
900
- error?: boolean;
901
- isatty?: boolean;
902
- autoEOF?: boolean;
903
- }): void;
904
- declare function setStdout(options?: {
905
- batched?: (output: string) => void;
906
- raw?: (charCode: number) => void;
907
- write?: (buffer: Uint8Array) => number;
908
- isatty?: boolean;
909
- }): void;
910
- declare function setStderr(options?: {
911
- batched?: (output: string) => void;
912
- raw?: (charCode: number) => void;
913
- write?: (buffer: Uint8Array) => number;
914
- isatty?: boolean;
915
- }): void;
916
980
  type PackageType = "package" | "cpython_module" | "shared_library" | "static_library";
917
- export type PackageData = {
981
+ interface PackageData {
918
982
  name: string;
919
983
  version: string;
920
984
  fileName: string;
921
985
  /** @experimental */
922
986
  packageType: PackageType;
923
- };
987
+ }
924
988
  declare function loadPackage(names: string | PyProxy | Array<string>, options?: {
925
989
  messageCallback?: (message: string) => void;
926
990
  errorCallback?: (message: string) => void;
927
991
  checkIntegrity?: boolean;
928
992
  }): Promise<Array<PackageData>>;
929
- /** @deprecated Use `import type { TypedArray } from "pyodide/ffi"` instead */
930
- export type TypedArray = Int8Array | Uint8Array | Int16Array | Uint16Array | Int32Array | Uint32Array | Uint8ClampedArray | Float32Array | Float64Array;
931
- interface CanvasInterface {
932
- setCanvas2D(canvas: HTMLCanvasElement): void;
933
- getCanvas2D(): HTMLCanvasElement | undefined;
934
- setCanvas3D(canvas: HTMLCanvasElement): void;
935
- getCanvas3D(): HTMLCanvasElement | undefined;
936
- }
937
993
  declare class PythonError extends Error {
938
994
  /**
939
995
  * The address of the error we are wrapping. We may later compare this
@@ -1329,12 +1385,13 @@ declare class PyodideAPI {
1329
1385
  * @returns The old value of the debug flag.
1330
1386
  */
1331
1387
  static setDebug(debug: boolean): boolean;
1388
+ static makeMemorySnapshot(): Uint8Array;
1332
1389
  }
1333
- /** @hidetype */
1390
+ /** @hidden */
1334
1391
  export type PyodideInterface = typeof PyodideAPI;
1335
1392
  /**
1336
1393
  * See documentation for loadPyodide.
1337
- * @private
1394
+ * @hidden
1338
1395
  */
1339
1396
  type ConfigType = {
1340
1397
  indexURL: string;
@@ -1352,6 +1409,7 @@ type ConfigType = {
1352
1409
  [key: string]: string;
1353
1410
  };
1354
1411
  packages: string[];
1412
+ _makeSnapshot: boolean;
1355
1413
  };
1356
1414
  /**
1357
1415
  * Load the main Pyodide wasm module and initialize it.
@@ -1464,8 +1522,8 @@ export declare function loadPyodide(options?: {
1464
1522
  */
1465
1523
  packages?: string[];
1466
1524
  /**
1467
- * Opt into the old behavior where PyProxy.toString calls `repr` and not
1468
- * `str`.
1525
+ * Opt into the old behavior where :js:func:`PyProxy.toString() <pyodide.ffi.PyProxy.toString>`
1526
+ * calls :py:func:`repr` and not :py:class:`str() <str>`.
1469
1527
  * @deprecated
1470
1528
  */
1471
1529
  pyproxyToStringRepr?: boolean;
@@ -1473,7 +1531,15 @@ export declare function loadPyodide(options?: {
1473
1531
  * @ignore
1474
1532
  */
1475
1533
  _node_mounts?: string[];
1534
+ /**
1535
+ * @ignore
1536
+ */
1537
+ _makeSnapshot?: boolean;
1538
+ /**
1539
+ * @ignore
1540
+ */
1541
+ _loadSnapshot?: Uint8Array | ArrayBuffer | PromiseLike<Uint8Array | ArrayBuffer>;
1476
1542
  }): Promise<PyodideInterface>;
1477
1543
 
1478
1544
  export type {};
1479
- export type {};
1545
+ export type {PackageData};
package/pyodide.js CHANGED
@@ -1,14 +1,12 @@
1
- "use strict";var loadPyodide=(()=>{var ce=Object.create;var b=Object.defineProperty;var le=Object.getOwnPropertyDescriptor;var de=Object.getOwnPropertyNames;var fe=Object.getPrototypeOf,ue=Object.prototype.hasOwnProperty;var f=(t,e)=>b(t,"name",{value:e,configurable:!0}),y=(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 $=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),pe=(t,e)=>{for(var c in e)b(t,c,{get:e[c],enumerable:!0})},M=(t,e,c,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of de(e))!ue.call(t,a)&&a!==c&&b(t,a,{get:()=>e[a],enumerable:!(o=le(e,a))||o.enumerable});return t};var v=(t,e,c)=>(c=t!=null?ce(fe(t)):{},M(e||!t||!t.__esModule?b(c,"default",{value:t,enumerable:!0}):c,t)),me=t=>M(b({},"__esModule",{value:!0}),t);var C=$((k,U)=>{(function(t,e){"use strict";typeof define=="function"&&define.amd?define("stackframe",[],e):typeof k=="object"?U.exports=e():t.StackFrame=e()})(k,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 g=0;g<i.length;g++)d[i[g]]!==void 0&&this["set"+e(i[g])](d[i[g]])}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()||"",g=this.getLineNumber()||"",w=this.getColumnNumber()||"",_=this.getFunctionName()||"";return this.getIsEval()?d?"[eval] ("+d+":"+g+":"+w+")":"[eval]:"+g+":"+w:_?_+" ("+d+":"+g+":"+w+")":d+":"+g+":"+w}},s.fromString=f(function(g){var w=g.indexOf("("),_=g.lastIndexOf(")"),ne=g.substring(0,w),ie=g.substring(w+1,_).split(","),T=g.substring(_+1);if(T.indexOf("@")===0)var R=/@(.+?)(?::(\d+))?(?::(\d+))?$/.exec(T,""),oe=R[1],ae=R[2],se=R[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(g){this[d]=!!g}}(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(g){if(!t(g))throw new TypeError(d+" must be a Number");this[d]=Number(g)}}(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(g){this[d]=String(g)}}(r[p]);return s})});var W=$((x,B)=>{(function(t,e){"use strict";typeof define=="function"&&define.amd?define("error-stack-parser",["stackframe"],e):typeof x=="object"?B.exports=e(C()):t.ErrorStackParser=e(t.StackFrame)})(x,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(`
1
+ "use strict";var loadPyodide=(()=>{var ae=Object.create;var w=Object.defineProperty;var se=Object.getOwnPropertyDescriptor;var ce=Object.getOwnPropertyNames;var le=Object.getPrototypeOf,de=Object.prototype.hasOwnProperty;var f=(t,e)=>w(t,"name",{value:e,configurable:!0}),g=(t=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:(e,o)=>(typeof require<"u"?require:e)[o]}):t)(function(t){if(typeof require<"u")return require.apply(this,arguments);throw new Error('Dynamic require of "'+t+'" is not supported')});var M=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),fe=(t,e)=>{for(var o in e)w(t,o,{get:e[o],enumerable:!0})},U=(t,e,o,a)=>{if(e&&typeof e=="object"||typeof e=="function")for(let l of ce(e))!de.call(t,l)&&l!==o&&w(t,l,{get:()=>e[l],enumerable:!(a=se(e,l))||a.enumerable});return t};var h=(t,e,o)=>(o=t!=null?ae(le(t)):{},U(e||!t||!t.__esModule?w(o,"default",{value:t,enumerable:!0}):o,t)),ue=t=>U(w({},"__esModule",{value:!0}),t);var C=M((P,$)=>{(function(t,e){"use strict";typeof define=="function"&&define.amd?define("stackframe",[],e):typeof P=="object"?$.exports=e():t.StackFrame=e()})(P,function(){"use strict";function t(d){return!isNaN(parseFloat(d))&&isFinite(d)}f(t,"_isNumber");function e(d){return d.charAt(0).toUpperCase()+d.substring(1)}f(e,"_capitalize");function o(d){return function(){return this[d]}}f(o,"_getter");var a=["isConstructor","isEval","isNative","isToplevel"],l=["columnNumber","lineNumber"],r=["fileName","functionName","source"],n=["args"],u=["evalOrigin"],i=a.concat(l,r,n,u);function c(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(c,"StackFrame"),c.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 c)this.evalOrigin=d;else if(d instanceof Object)this.evalOrigin=new c(d);else throw new TypeError("Eval Origin must be an Object or StackFrame")},toString:function(){var d=this.getFileName()||"",y=this.getLineNumber()||"",E=this.getColumnNumber()||"",b=this.getFunctionName()||"";return this.getIsEval()?d?"[eval] ("+d+":"+y+":"+E+")":"[eval]:"+y+":"+E:b?b+" ("+d+":"+y+":"+E+")":d+":"+y+":"+E}},c.fromString=f(function(y){var E=y.indexOf("("),b=y.lastIndexOf(")"),te=y.substring(0,E),re=y.substring(E+1,b).split(","),T=y.substring(b+1);if(T.indexOf("@")===0)var N=/@(.+?)(?::(\d+))?(?::(\d+))?$/.exec(T,""),ne=N[1],ie=N[2],oe=N[3];return new c({functionName:te,args:re||void 0,fileName:ne,lineNumber:ie||void 0,columnNumber:oe||void 0})},"StackFrame$$fromString");for(var s=0;s<a.length;s++)c.prototype["get"+e(a[s])]=o(a[s]),c.prototype["set"+e(a[s])]=function(d){return function(y){this[d]=!!y}}(a[s]);for(var m=0;m<l.length;m++)c.prototype["get"+e(l[m])]=o(l[m]),c.prototype["set"+e(l[m])]=function(d){return function(y){if(!t(y))throw new TypeError(d+" must be a Number");this[d]=Number(y)}}(l[m]);for(var p=0;p<r.length;p++)c.prototype["get"+e(r[p])]=o(r[p]),c.prototype["set"+e(r[p])]=function(d){return function(y){this[d]=String(y)}}(r[p]);return c})});var j=M((x,W)=>{(function(t,e){"use strict";typeof define=="function"&&define.amd?define("error-stack-parser",["stackframe"],e):typeof x=="object"?W.exports=e(C()):t.ErrorStackParser=e(t.StackFrame)})(x,f(function(e){"use strict";var o=/(^|@)\S+:\d+/,a=/^\s*at .*(\S+:\d+|\(native\))/m,l=/^(eval@)?(\[native code])?$/;return{parse:f(function(n){if(typeof n.stacktrace<"u"||typeof n["opera#sourceloc"]<"u")return this.parseOpera(n);if(n.stack&&n.stack.match(a))return this.parseV8OrIE(n);if(n.stack)return this.parseFFOrSafari(n);throw new Error("Cannot parse given Error object")},"ErrorStackParser$$parse"),extractLocation: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(a)},this);return u.map(function(i){i.indexOf("(eval ")>-1&&(i=i.replace(/eval code/g,"eval").replace(/(\(eval at [^()]*)|(,.*$)/g,""));var c=i.replace(/^\s+/,"").replace(/\(eval code/g,"(").replace(/^.*?\s+/,""),s=c.match(/ (\(.+\)$)/);c=s?c.replace(s[0],""):c;var m=this.extractLocation(s?s[1]:c),p=s&&c||void 0,d=["eval","<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(l)},this);return u.map(function(i){if(i.indexOf(" > eval")>-1&&(i=i.replace(/ line (\d+)(?: > eval line \d+)* > eval:\d+:\d+/g,":$1")),i.indexOf("@")===-1&&i.indexOf(":")===-1)return new e({functionName:i});var c=/((.*".+"[^@]*)?[^@]*)(?:@)/,s=i.match(c),m=s&&s[1]?s[1]:void 0,p=this.extractLocation(i.replace(c,""));return new e({functionName:m,fileName:p[0],lineNumber:p[1],columnNumber:p[2],source:i})},this)},"ErrorStackParser$$parseFFOrSafari"),parseOpera:f(function(n){return!n.stacktrace||n.message.indexOf(`
4
4
  `)>-1&&n.message.split(`
5
5
  `).length>n.stacktrace.split(`
6
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 g=d===void 0||d==="[arguments not available]"?void 0:d.split(",");return new e({functionName:p,args:g,fileName:l[0],lineNumber:l[1],columnNumber:l[2],source:i})},this)},"ErrorStackParser$$parseOpera11")}},"ErrorStackParser"))});var Re={};pe(Re,{loadPyodide:()=>D,version:()=>E});var K=v(W());var h=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string"&&typeof process.browser>"u",P=h&&typeof module<"u"&&typeof module.exports<"u"&&typeof y<"u"&&typeof __dirname<"u",j=h&&!P,ge=typeof Deno<"u",H=!h&&!ge,z=H&&typeof window<"u"&&typeof document<"u"&&typeof document.createElement<"u"&&typeof sessionStorage<"u"&&typeof importScripts>"u",q=H&&typeof importScripts<"u"&&typeof self<"u",Fe=typeof navigator<"u"&&typeof navigator.userAgent<"u"&&navigator.userAgent.indexOf("Chrome")==-1&&navigator.userAgent.indexOf("Safari")>-1;var J,F,X,V,I;async function L(){if(!h||(J=(await import(/* webpackIgnore */"node:url")).default,V=await import(/* webpackIgnore */"node:fs"),I=await import(/* webpackIgnore */"node:fs/promises"),X=(await import(/* webpackIgnore */"node:vm")).default,F=await import(/* webpackIgnore */"node:path"),A=F.sep,typeof y<"u"))return;let t=V,e=await import(/* webpackIgnore */"node:crypto"),c=await import(/* webpackIgnore */"ws"),o=await import(/* webpackIgnore */"node:child_process"),a={fs:t,crypto:e,ws:c,child_process:o};globalThis.require=function(r){return a[r]}}f(L,"initNodeModules");function ye(t,e){return F.resolve(e||".",t)}f(ye,"node_resolvePath");function ve(t,e){return e===void 0&&(e=location),new URL(t,e).toString()}f(ve,"browser_resolvePath");var N;h?N=ye:N=ve;var A;h||(A="/");function he(t,e){return t.startsWith("file://")&&(t=t.slice(7)),t.includes("://")?{response:fetch(t)}:{binary:I.readFile(t).then(c=>new Uint8Array(c.buffer,c.byteOffset,c.byteLength))}}f(he,"node_getBinaryResponse");function we(t,e){let c=new URL(t,location);return{response:fetch(c,e?{integrity:e}:{})}}f(we,"browser_getBinaryResponse");var O;h?O=he:O=we;async function G(t,e){let{response:c,binary:o}=O(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(G,"loadBinaryFile");var S;if(z)S=f(async t=>await import(/* webpackIgnore */t),"loadScript");else if(q)S=f(async t=>{try{globalThis.importScripts(t)}catch(e){if(e instanceof TypeError)await import(/* webpackIgnore */t);else throw e}},"loadScript");else if(h)S=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 fetch(t)).text()):await import(/* webpackIgnore */J.pathToFileURL(t).href)}f(Ee,"nodeLoadScript");async function Y(t){if(h){await L();let e=await I.readFile(t,{encoding:"utf8"});return JSON.parse(e)}else return await(await fetch(t)).json()}f(Y,"loadLockFile");async function Q(){if(P)return __dirname;let t;try{throw new Error}catch(o){t=o}let e=K.default.parse(t)[0].fileName;if(j){let o=await import(/* webpackIgnore */"node:path");return(await import(/* webpackIgnore */"node:url")).fileURLToPath(o.dirname(e))}let c=e.lastIndexOf(A);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],g=u.entries[p];(!g||e.isFile(d.mode)&&d.timestamp.getTime()>g.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 g=m.get(d),w=await a.loadRemoteEntry(g);a.storeLocalEntry(p,w)}else{let g=a.loadLocalEntry(p);await a.storeRemoteEntry(m,d,g)}}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 be(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(be,"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 Ne(t,e){let c=G(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(Ne,"installStdlib");function te(t,e){let c;e.stdLibURL!=null?c=e.stdLibURL:c=e.indexURL+"python_stdlib.zip",Ne(t,c),be(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}=O(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 E="0.26.0a4";async function D(t={}){await L();let e=t.indexURL||await Q();e=N(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);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 S(s)}if(await _createPyodideModule(a),await n,a.exited)throw a.exited.toThrow;if(t.pyproxyToStringRepr&&r.setPyProxyToStringMethod(!0),r.version!==E)throw new Error(`Pyodide version does not match: '${E}' <==> '${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.set_excepthook(),r._pyodide._importhook.register_module_not_found_hook(r._import_name_to_package_name,r.lockfile_unvendored_stdlibs_and_test),r.lockfile_info.version!==E)throw new Error(`Lock file version doesn't match Pyodide version.
10
- lockfile version: ${r.lockfile_info.version}
11
- pyodide version: ${E}`);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(D,"loadPyodide");globalThis.loadPyodide=D;return me(Re);})();
7
+ `),c=[],s=2,m=i.length;s<m;s+=2){var p=u.exec(i[s]);p&&c.push(new e({fileName:p[2],lineNumber:p[1],source:i[s]}))}return c},"ErrorStackParser$$parseOpera9"),parseOpera10:f(function(n){for(var u=/Line (\d+).*script (?:in )?(\S+)(?:: In function (\S+))?$/i,i=n.stacktrace.split(`
8
+ `),c=[],s=0,m=i.length;s<m;s+=2){var p=u.exec(i[s]);p&&c.push(new e({functionName:p[3]||void 0,fileName:p[2],lineNumber:p[1],source:i[s]}))}return c},"ErrorStackParser$$parseOpera10"),parseOpera11:f(function(n){var u=n.stack.split(`
9
+ `).filter(function(i){return!!i.match(o)&&!i.match(/^Error created at/)},this);return u.map(function(i){var c=i.split("@"),s=this.extractLocation(c.pop()),m=c.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:s[0],lineNumber:s[1],columnNumber:s[2],source:i})},this)},"ErrorStackParser$$parseOpera11")}},"ErrorStackParser"))});var Ne={};fe(Ne,{loadPyodide:()=>D,version:()=>O});var K=h(j());var v=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string"&&typeof process.browser>"u",F=v&&typeof module<"u"&&typeof module.exports<"u"&&typeof g<"u"&&typeof __dirname<"u",B=v&&!F,pe=typeof Deno<"u",H=!v&&!pe,z=H&&typeof window=="object"&&typeof document=="object"&&typeof document.createElement=="function"&&typeof sessionStorage=="object"&&typeof importScripts!="function",q=H&&typeof importScripts=="function"&&typeof self=="object",ke=typeof navigator=="object"&&typeof navigator.userAgent=="string"&&navigator.userAgent.indexOf("Chrome")==-1&&navigator.userAgent.indexOf("Safari")>-1;var J,k,X,V,I;async function A(){if(!v||(J=(await import(/* webpackIgnore */"node:url")).default,V=await import(/* webpackIgnore */"node:fs"),I=await import(/* webpackIgnore */"node:fs/promises"),X=(await import(/* webpackIgnore */"node:vm")).default,k=await import(/* webpackIgnore */"node:path"),L=k.sep,typeof g<"u"))return;let t=V,e=await import(/* webpackIgnore */"node:crypto"),o=await import(/* webpackIgnore */"ws"),a=await import(/* webpackIgnore */"node:child_process"),l={fs:t,crypto:e,ws:o,child_process:a};globalThis.require=function(r){return l[r]}}f(A,"initNodeModules");function me(t,e){return k.resolve(e||".",t)}f(me,"node_resolvePath");function ye(t,e){return e===void 0&&(e=location),new URL(t,e).toString()}f(ye,"browser_resolvePath");var R;v?R=me:R=ye;var L;v||(L="/");function ge(t,e){return t.startsWith("file://")&&(t=t.slice(7)),t.includes("://")?{response:fetch(t)}:{binary:I.readFile(t).then(o=>new Uint8Array(o.buffer,o.byteOffset,o.byteLength))}}f(ge,"node_getBinaryResponse");function he(t,e){let o=new URL(t,location);return{response:fetch(o,e?{integrity:e}:{})}}f(he,"browser_getBinaryResponse");var _;v?_=ge:_=he;async function G(t,e){let{response:o,binary:a}=_(t,e);if(a)return a;let l=await o;if(!l.ok)throw new Error(`Failed to load '${t}': request failed.`);return new Uint8Array(await l.arrayBuffer())}f(G,"loadBinaryFile");var S;if(z)S=f(async t=>await import(/* webpackIgnore */t),"loadScript");else if(q)S=f(async t=>{try{globalThis.importScripts(t)}catch(e){if(e instanceof TypeError)await import(/* webpackIgnore */t);else throw e}},"loadScript");else if(v)S=ve;else throw new Error("Cannot determine runtime environment");async function ve(t){t.startsWith("file://")&&(t=t.slice(7)),t.includes("://")?X.runInThisContext(await(await fetch(t)).text()):await import(/* webpackIgnore */J.pathToFileURL(t).href)}f(ve,"nodeLoadScript");async function Y(t){if(v){await A();let e=await I.readFile(t,{encoding:"utf8"});return JSON.parse(e)}else return await(await fetch(t)).json()}f(Y,"loadLockFile");async function Q(){if(F)return __dirname;let t;try{throw new Error}catch(a){t=a}let e=K.default.parse(t)[0].fileName;if(B){let a=await import(/* webpackIgnore */"node:path");return(await import(/* webpackIgnore */"node:url")).fileURLToPath(a.dirname(e))}let o=e.lastIndexOf(L);if(o===-1)throw new Error("Could not extract indexURL path from pyodide module location");return e.slice(0,o)}f(Q,"calculateDirname");function Z(t){let e=t.FS,o=t.FS.filesystems.MEMFS,a=t.PATH,l={DIR_MODE:16895,FILE_MODE:33279,mount:function(r){if(!r.opts.fileSystemHandle)throw new Error("opts.fileSystemHandle is required");return o.mount.apply(null,arguments)},syncfs:async(r,n,u)=>{try{let i=l.getLocalSet(r),c=await l.getRemoteSet(r),s=n?c:i,m=n?i:c;await l.reconcile(r,s,m),u(null)}catch(i){u(i)}},getLocalSet:r=>{let n=Object.create(null);function u(s){return s!=="."&&s!==".."}f(u,"isRealDir");function i(s){return m=>a.join2(s,m)}f(i,"toAbsolute");let c=e.readdir(r.mountpoint).filter(u).map(i(r.mountpoint));for(;c.length;){let s=c.pop(),m=e.stat(s);e.isDir(m.mode)&&c.push.apply(c,e.readdir(s).filter(u).map(i(s))),n[s]={timestamp:m.mtime,mode:m.mode}}return{type:"local",entries:n}},getRemoteSet:async r=>{let n=Object.create(null),u=await Ee(r.opts.fileSystemHandle);for(let[i,c]of u)i!=="."&&(n[a.join2(r.mountpoint,i)]={timestamp:c.kind==="file"?(await c.getFile()).lastModifiedDate:new Date,mode:c.kind==="file"?l.FILE_MODE:l.DIR_MODE});return{type:"remote",entries: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=o.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:l.FILE_MODE,timestamp:n.lastModifiedDate}}else{if(r.kind==="directory")return{mode:l.DIR_MODE,timestamp:new Date};throw new Error("unknown kind: "+r.kind)}},storeRemoteEntry:async(r,n,u)=>{let i=r.get(a.dirname(n)),c=e.isFile(u.mode)?await i.getFileHandle(a.basename(n),{create:!0}):await i.getDirectoryHandle(a.basename(n),{create:!0});if(c.kind==="file"){let s=await c.createWritable();await s.write(u.contents),await s.close()}r.set(n,c)},removeRemoteEntry:async(r,n)=>{await r.get(a.dirname(n)).removeEntry(a.basename(n)),r.delete(n)},reconcile:async(r,n,u)=>{let i=0,c=[];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())&&(c.push(p),i++)}),c.sort();let s=[];if(Object.keys(u.entries).forEach(function(p){n.entries[p]||(s.push(p),i++)}),s.sort().reverse(),!i)return;let m=n.type==="remote"?n.handles:u.handles;for(let p of c){let d=a.normalize(p.replace(r.mountpoint,"/")).substring(1);if(u.type==="local"){let y=m.get(d),E=await l.loadRemoteEntry(y);l.storeLocalEntry(p,E)}else{let y=l.loadLocalEntry(p);await l.storeRemoteEntry(m,d,y)}}for(let p of s)if(u.type==="local")l.removeLocalEntry(p);else{let d=a.normalize(p.replace(r.mountpoint,"/")).substring(1);await l.removeRemoteEntry(m,d)}}};t.FS.filesystems.NATIVEFS_ASYNC=l}f(Z,"initializeNativeFS");var Ee=f(async t=>{let e=[];async function o(l){for await(let r of l.values())e.push(r),r.kind==="directory"&&await o(r)}f(o,"collect"),await o(t);let a=new Map;a.set(".",t);for(let l of e){let r=(await t.resolve(l)).join("/");a.set(r,l)}return a},"getFsHandles");function ee(t){let e={noImageDecoding:!0,noAudioDecoding:!0,noWasmDecoding:!1,preRun:Oe(t),quit(o,a){throw e.exited={status:o,toThrow:a},a},print:t.stdout,printErr:t.stderr,arguments:t.args,API:{config:t},locateFile:o=>t.indexURL+o,instantiateWasm:Re(t.indexURL)};return e}f(ee,"createSettings");function be(t){return function(e){let o="/";try{e.FS.mkdirTree(t)}catch(a){console.error(`Error occurred while making a home directory '${t}':`),console.error(a),console.error(`Using '${o}' for a home directory instead`),t=o}e.FS.chdir(t)}}f(be,"createHomeDirectory");function we(t){return function(e){Object.assign(e.ENV,t)}}f(we,"setEnvironment");function Se(t){return e=>{for(let o of t)e.FS.mkdirTree(o),e.FS.mount(e.FS.filesystems.NODEFS,{root:o},o)}}f(Se,"mountLocalDirectories");function _e(t){let e=G(t);return o=>{let a=o._py_version_major(),l=o._py_version_minor();o.FS.mkdirTree("/lib"),o.FS.mkdirTree(`/lib/python${a}.${l}/site-packages`),o.addRunDependency("install-stdlib"),e.then(r=>{o.FS.writeFile(`/lib/python${a}${l}.zip`,r)}).catch(r=>{console.error("Error occurred while installing the standard library:"),console.error(r)}).finally(()=>{o.removeRunDependency("install-stdlib")})}}f(_e,"installStdlib");function Oe(t){let e;return t.stdLibURL!=null?e=t.stdLibURL:e=t.indexURL+"python_stdlib.zip",[_e(e),be(t.env.HOME),we(t.env),Se(t._node_mounts),Z]}f(Oe,"getFileSystemInitializationFuncs");function Re(t){let{binary:e,response:o}=_(t+"pyodide.asm.wasm");return function(a,l){return async function(){try{let r;o?r=await WebAssembly.instantiateStreaming(o,a):r=await WebAssembly.instantiate(await e,a);let{instance:n,module:u}=r;typeof WasmOffsetConverter<"u"&&(wasmOffsetConverter=new WasmOffsetConverter(wasmBinary,u)),l(n,u)}catch(r){console.warn("wasm instantiation failed!"),console.warn(r)}}(),{}}}f(Re,"getInstantiateWasmFunc");var O="0.26.0a6";async function D(t={}){await A();let e=t.indexURL||await Q();e=R(e),e.endsWith("/")||(e+="/"),t.indexURL=e;let o={fullStdLib:!1,jsglobals:globalThis,stdin:globalThis.prompt?globalThis.prompt:void 0,lockFileURL:e+"pyodide-lock.json",args:[],_node_mounts:[],env:{},packageCacheDir:e,packages:[]},a=Object.assign(o,t);a.env.HOME||(a.env.HOME="/home/pyodide");let l=ee(a),r=l.API;if(r.lockFilePromise=Y(a.lockFileURL),typeof _createPyodideModule!="function"){let s=`${a.indexURL}pyodide.asm.js`;await S(s)}let n;if(t._loadSnapshot){let s=await t._loadSnapshot;ArrayBuffer.isView(s)?n=s:n=new Uint8Array(s),l.noInitialRun=!0,l.INITIAL_MEMORY=n.length}let u=await _createPyodideModule(l);if(l.exited)throw l.exited.toThrow;if(t.pyproxyToStringRepr&&r.setPyProxyToStringMethod(!0),r.version!==O)throw new Error(`Pyodide version does not match: '${O}' <==> '${r.version}'. If you updated the Pyodide version, make sure you also updated the 'indexURL' parameter passed to loadPyodide.`);u.locateFile=s=>{throw new Error("Didn't expect to load any more file_packager files!")};let i;n&&(i=r.restoreSnapshot(n));let c=r.finalizeBootstrap(i);return r.sys.path.insert(0,r.config.env.HOME),c.version.includes("dev")||r.setCdnUrl(`https://cdn.jsdelivr.net/pyodide/v${c.version}/full/`),r._pyodide.set_excepthook(),await r.packageIndexReady,r.initializeStreams(a.stdin,a.stdout,a.stderr),c}f(D,"loadPyodide");globalThis.loadPyodide=D;return ue(Ne);})();
12
10
  try{Object.assign(exports,loadPyodide)}catch(_){}
13
11
  globalThis.loadPyodide=loadPyodide.loadPyodide;
14
12
  //# sourceMappingURL=pyodide.js.map