Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

pyodide

Package Overview
Dependencies
Maintainers
3
Versions
52
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pyodide - npm Package Compare versions

Comparing version 0.24.1 to 0.25.0-alpha.1

83

ffi.d.ts

@@ -1,2 +0,2 @@

// Generated by dts-bundle-generator v6.13.0
// Generated by dts-bundle-generator v8.1.1

@@ -16,7 +16,6 @@ interface PyProxy {

/**
* @private
* @hideconstructor
*/
constructor();
/** @private */
/** @hidden */
get [Symbol.toStringTag](): string;

@@ -39,2 +38,6 @@ /**

get type(): string;
/**
* Returns `str(o)` (unless `pyproxyToStringRepr: true` was passed to
* :js:func:`loadPyodide` in which case it will return `repr(o)`)
*/
toString(): string;

@@ -418,2 +421,6 @@ /**

}
/**
* A :js:class:`~pyodide.ffi.PyProxy` whose proxied Python object is an
* :py:class:`~collections.abc.Sequence` (i.e., a :py:class:`list`)
*/
declare class PySequence extends PyProxy {

@@ -426,2 +433,3 @@ /** @private */

declare class PySequenceMethods {
/** @hidden */
get [Symbol.isConcatSpreadable](): boolean;

@@ -484,3 +492,3 @@ /**

*/
map(callbackfn: (elt: any, index: number, array: any) => void, thisArg?: any): unknown[];
map<U>(callbackfn: (elt: any, index: number, array: any) => U, thisArg?: any): U[];
/**

@@ -602,2 +610,6 @@ * See :js:meth:`Array.filter`. Creates a shallow copy of a portion of a given

}
/**
* A :js:class:`~pyodide.ffi.PyProxy` whose proxied Python object is an
* :py:class:`~collections.abc.MutableSequence` (i.e., a :py:class:`list`)
*/
declare class PyMutableSequence extends PyProxy {

@@ -611,31 +623,31 @@ /** @private */

/**
* The :js:meth:`Array.reverse` method reverses a ``MutableSequence`` in
* The :js:meth:`Array.reverse` method reverses a :js:class:`PyMutableSequence` in
* place.
* @returns A reference to the same ``MutableSequence``
* @returns A reference to the same :js:class:`PyMutableSequence`
*/
reverse(): this;
reverse(): PyMutableSequence;
/**
* The :js:meth:`Array.sort` method sorts the elements of a
* ``MutableSequence`` in place.
* :js:class:`PyMutableSequence` in place.
* @param compareFn A function that defines the sort order.
* @returns A reference to the same ``MutableSequence``
* @returns A reference to the same :js:class:`PyMutableSequence`
*/
sort(compareFn?: (a: any, b: any) => number): this;
sort(compareFn?: (a: any, b: any) => number): PyMutableSequence;
/**
* The :js:meth:`Array.splice` method changes the contents of a
* ``MutableSequence`` by removing or replacing existing elements and/or
* :js:class:`PyMutableSequence` by removing or replacing existing elements and/or
* adding new elements in place.
* @param start Zero-based index at which to start changing the
* ``MutableSequence``.
* :js:class:`PyMutableSequence`.
* @param deleteCount An integer indicating the number of elements in the
* ``MutableSequence`` to remove from ``start``.
* @param items The elements to add to the ``MutableSequence``, beginning from
* :js:class:`PyMutableSequence` to remove from ``start``.
* @param items The elements to add to the :js:class:`PyMutableSequence`, beginning from
* ``start``.
* @returns An array containing the deleted elements.
*/
splice(start: number, deleteCount?: number, ...items: any[]): void;
splice(start: number, deleteCount?: number, ...items: any[]): any[];
/**
* The :js:meth:`Array.push` method adds the specified elements to the end of
* a ``MutableSequence``.
* @param elts The element(s) to add to the end of the ``MutableSequence``.
* a :js:class:`PyMutableSequence`.
* @param elts The element(s) to add to the end of the :js:class:`PyMutableSequence`.
* @returns The new length property of the object upon which the method was

@@ -647,19 +659,19 @@ * called.

* The :js:meth:`Array.pop` method removes the last element from a
* ``MutableSequence``.
* @returns The removed element from the ``MutableSequence``; undefined if the
* ``MutableSequence`` is empty.
* :js:class:`PyMutableSequence`.
* @returns The removed element from the :js:class:`PyMutableSequence`; undefined if the
* :js:class:`PyMutableSequence` is empty.
*/
pop(): void;
pop(): any;
/**
* The :js:meth:`Array.shift` method removes the first element from a
* ``MutableSequence``.
* @returns The removed element from the ``MutableSequence``; undefined if the
* ``MutableSequence`` is empty.
* :js:class:`PyMutableSequence`.
* @returns The removed element from the :js:class:`PyMutableSequence`; undefined if the
* :js:class:`PyMutableSequence` is empty.
*/
shift(): void;
shift(): any;
/**
* The :js:meth:`Array.unshift` method adds the specified elements to the
* beginning of a ``MutableSequence``.
* @param elts The elements to add to the front of the ``MutableSequence``.
* @returns The new length of the ``MutableSequence``.
* beginning of a :js:class:`PyMutableSequence`.
* @param elts The elements to add to the front of the :js:class:`PyMutableSequence`.
* @returns The new length of the :js:class:`PyMutableSequence`.
*/

@@ -669,3 +681,3 @@ unshift(...elts: any[]): any;

* The :js:meth:`Array.copyWithin` method shallow copies part of a
* ``MutableSequence`` to another location in the same ``MutableSequence``
* :js:class:`PyMutableSequence` to another location in the same :js:class:`PyMutableSequence`
* without modifying its length.

@@ -675,3 +687,3 @@ * @param target Zero-based index at which to copy the sequence to.

* @param end Zero-based index at which to end copying elements from.
* @returns The modified ``MutableSequence``.
* @returns The modified :js:class:`PyMutableSequence`.
*/

@@ -702,3 +714,3 @@ copyWithin(target: number, start?: number, end?: number): any;

* A :js:class:`~pyodide.ffi.PyProxy` whose proxied Python object is
* :std:term:`callable` (i.e., has an :py:meth:`~operator.__call__` method).
* :std:term:`callable` (i.e., has an :py:meth:`~object.__call__` method).
*/

@@ -743,2 +755,3 @@ declare class PyCallable extends PyProxy {

callKwargs(...jsargs: any): any;
callSyncifying(...jsargs: any): Promise<any>;
/**

@@ -834,3 +847,2 @@ * The ``bind()`` method creates a new function that, when called, has its

}
export declare type TypedArray = Int8Array | Uint8Array | Int16Array | Uint16Array | Int32Array | Uint32Array | Uint8ClampedArray | Float32Array | Float64Array;
/**

@@ -976,5 +988,3 @@ * A :js:class:`~pyodide.ffi.PyProxy` whose proxied Python object is a :py:class:`dict`.

f_contiguous: boolean;
/** @private */
_released: boolean;
/** @private */
_view_ptr: number;

@@ -988,6 +998,7 @@ /** @private */

}
export type TypedArray = Int8Array | Uint8Array | Int16Array | Uint16Array | Int32Array | Uint32Array | Uint8ClampedArray | Float32Array | Float64Array;
/**
* A JavaScript error caused by a Python exception.
*
* In order to reduce the risk of large memory leaks, the :py:exc:`PythonError`
* In order to reduce the risk of large memory leaks, the :js:class:`PythonError`
* contains no reference to the Python exception that caused it. You can find

@@ -1055,2 +1066,2 @@ * the actual Python exception that caused this error as

export type {};
export type {PyAsyncGenerator, PyAsyncIterable, PyAsyncIterator, PyAwaitable, PyBuffer, PyBufferView, PyCallable, PyDict, PyGenerator, PyIterable, PyIterator, PyProxy, PyProxyWithGet, PyProxyWithHas, PyProxyWithLength, PyProxyWithSet, PythonError};
export type {PyAsyncGenerator, PyAsyncIterable, PyAsyncIterator, PyAwaitable, PyBuffer, PyBufferView, PyCallable, PyDict, PyGenerator, PyIterable, PyIterator, PyMutableSequence, PyProxy, PyProxyWithGet, PyProxyWithHas, PyProxyWithLength, PyProxyWithSet, PySequence, PythonError};
{
"name": "pyodide",
"version": "0.24.1",
"version": "0.25.0-alpha.1",
"description": "The Pyodide JavaScript package",

@@ -20,6 +20,5 @@ "keywords": [

"@types/assert": "^1.5.6",
"@types/emscripten": "^1.39.5",
"@types/expect": "^24.3.0",
"@types/mocha": "^9.1.0",
"@types/node": "^17.0.25",
"@types/node": "^20.8.4",
"@types/ws": "^8.5.3",

@@ -29,3 +28,3 @@ "chai": "^4.3.6",

"cross-env": "^7.0.3",
"dts-bundle-generator": "^6.7.0",
"dts-bundle-generator": "^8.1.1",
"error-stack-parser": "^2.1.4",

@@ -40,4 +39,5 @@ "esbuild": "^0.17.12",

"tsd": "^0.24.1",
"typedoc": "^0.22.15",
"typescript": "^4.6.4"
"typedoc": "^0.25.1",
"typescript": "^4.6.4",
"wabt": "^1.0.32"
},

@@ -51,2 +51,5 @@ "main": "pyodide.js",

},
"./ffi": {
"types": "./ffi.d.ts"
},
"./pyodide.asm.wasm": "./pyodide.asm.wasm",

@@ -84,3 +87,3 @@ "./pyodide.asm.js": "./pyodide.asm.js",

"test": "npm-run-all test:*",
"test:unit": "cross-env TEST_NODE=1 ts-mocha -p tsconfig.test.json test/unit/**/*.test.ts",
"test:unit": "cross-env TEST_NODE=1 ts-mocha --node-option=experimental-loader=./test/loader.mjs --node-option=experimental-wasm-stack-switching -p tsconfig.test.json test/unit/**/*.test.*",
"test:node": "cross-env TEST_NODE=1 mocha test/integration/**/*.test.js",

@@ -102,5 +105,2 @@ "test:browser": "mocha test/integration/**/*.test.js",

"chai"
],
"file": [
"test/conftest.js"
]

@@ -107,0 +107,0 @@ },

@@ -1,2 +0,2 @@

// Generated by dts-bundle-generator v6.13.0
// Generated by dts-bundle-generator v8.1.1

@@ -12,8 +12,2 @@ /**

export declare const version: string;
interface CanvasInterface {
setCanvas2D(canvas: HTMLCanvasElement): void;
getCanvas2D(): HTMLCanvasElement | undefined;
setCanvas3D(canvas: HTMLCanvasElement): void;
getCanvas3D(): HTMLCanvasElement | undefined;
}
/** @deprecated Use `import type { PyProxy } from "pyodide/ffi"` instead */

@@ -33,7 +27,6 @@ interface PyProxy {

/**
* @private
* @hideconstructor
*/
constructor();
/** @private */
/** @hidden */
get [Symbol.toStringTag](): string;

@@ -56,2 +49,6 @@ /**

get type(): string;
/**
* Returns `str(o)` (unless `pyproxyToStringRepr: true` was passed to
* :js:func:`loadPyodide` in which case it will return `repr(o)`)
*/
toString(): string;

@@ -264,3 +261,3 @@ /**

/** @deprecated Use :js:class:`pyodide.ffi.PyIterable` instead. */
export declare type PyProxyIterable = PyIterable;
export type PyProxyIterable = PyIterable;
declare class PyIterableMethods {

@@ -300,3 +297,3 @@ /**

/** @deprecated Use :js:class:`pyodide.ffi.PyIterator` instead. */
export declare type PyProxyIterator = PyIterator;
export type PyProxyIterator = PyIterator;
declare class PyIteratorMethods {

@@ -434,2 +431,3 @@ /** @private */

declare class PySequenceMethods {
/** @hidden */
get [Symbol.isConcatSpreadable](): boolean;

@@ -492,3 +490,3 @@ /**

*/
map(callbackfn: (elt: any, index: number, array: any) => void, thisArg?: any): unknown[];
map<U>(callbackfn: (elt: any, index: number, array: any) => U, thisArg?: any): U[];
/**

@@ -619,31 +617,31 @@ * See :js:meth:`Array.filter`. Creates a shallow copy of a portion of a given

/**
* The :js:meth:`Array.reverse` method reverses a ``MutableSequence`` in
* The :js:meth:`Array.reverse` method reverses a :js:class:`PyMutableSequence` in
* place.
* @returns A reference to the same ``MutableSequence``
* @returns A reference to the same :js:class:`PyMutableSequence`
*/
reverse(): this;
reverse(): PyMutableSequence;
/**
* The :js:meth:`Array.sort` method sorts the elements of a
* ``MutableSequence`` in place.
* :js:class:`PyMutableSequence` in place.
* @param compareFn A function that defines the sort order.
* @returns A reference to the same ``MutableSequence``
* @returns A reference to the same :js:class:`PyMutableSequence`
*/
sort(compareFn?: (a: any, b: any) => number): this;
sort(compareFn?: (a: any, b: any) => number): PyMutableSequence;
/**
* The :js:meth:`Array.splice` method changes the contents of a
* ``MutableSequence`` by removing or replacing existing elements and/or
* :js:class:`PyMutableSequence` by removing or replacing existing elements and/or
* adding new elements in place.
* @param start Zero-based index at which to start changing the
* ``MutableSequence``.
* :js:class:`PyMutableSequence`.
* @param deleteCount An integer indicating the number of elements in the
* ``MutableSequence`` to remove from ``start``.
* @param items The elements to add to the ``MutableSequence``, beginning from
* :js:class:`PyMutableSequence` to remove from ``start``.
* @param items The elements to add to the :js:class:`PyMutableSequence`, beginning from
* ``start``.
* @returns An array containing the deleted elements.
*/
splice(start: number, deleteCount?: number, ...items: any[]): void;
splice(start: number, deleteCount?: number, ...items: any[]): any[];
/**
* The :js:meth:`Array.push` method adds the specified elements to the end of
* a ``MutableSequence``.
* @param elts The element(s) to add to the end of the ``MutableSequence``.
* a :js:class:`PyMutableSequence`.
* @param elts The element(s) to add to the end of the :js:class:`PyMutableSequence`.
* @returns The new length property of the object upon which the method was

@@ -655,19 +653,19 @@ * called.

* The :js:meth:`Array.pop` method removes the last element from a
* ``MutableSequence``.
* @returns The removed element from the ``MutableSequence``; undefined if the
* ``MutableSequence`` is empty.
* :js:class:`PyMutableSequence`.
* @returns The removed element from the :js:class:`PyMutableSequence`; undefined if the
* :js:class:`PyMutableSequence` is empty.
*/
pop(): void;
pop(): any;
/**
* The :js:meth:`Array.shift` method removes the first element from a
* ``MutableSequence``.
* @returns The removed element from the ``MutableSequence``; undefined if the
* ``MutableSequence`` is empty.
* :js:class:`PyMutableSequence`.
* @returns The removed element from the :js:class:`PyMutableSequence`; undefined if the
* :js:class:`PyMutableSequence` is empty.
*/
shift(): void;
shift(): any;
/**
* The :js:meth:`Array.unshift` method adds the specified elements to the
* beginning of a ``MutableSequence``.
* @param elts The elements to add to the front of the ``MutableSequence``.
* @returns The new length of the ``MutableSequence``.
* beginning of a :js:class:`PyMutableSequence`.
* @param elts The elements to add to the front of the :js:class:`PyMutableSequence`.
* @returns The new length of the :js:class:`PyMutableSequence`.
*/

@@ -677,3 +675,3 @@ unshift(...elts: any[]): any;

* The :js:meth:`Array.copyWithin` method shallow copies part of a
* ``MutableSequence`` to another location in the same ``MutableSequence``
* :js:class:`PyMutableSequence` to another location in the same :js:class:`PyMutableSequence`
* without modifying its length.

@@ -683,3 +681,3 @@ * @param target Zero-based index at which to copy the sequence to.

* @param end Zero-based index at which to end copying elements from.
* @returns The modified ``MutableSequence``.
* @returns The modified :js:class:`PyMutableSequence`.
*/

@@ -706,3 +704,3 @@ copyWithin(target: number, start?: number, end?: number): any;

/** @deprecated Use :js:class:`pyodide.ffi.PyAwaitable` instead. */
export declare type PyProxyAwaitable = PyAwaitable;
export type PyProxyAwaitable = PyAwaitable;
declare class PyCallable extends PyProxy {

@@ -715,3 +713,3 @@ /** @private */

*/
export declare type PyProxyCallable = PyCallable;
export type PyProxyCallable = PyCallable;
/** @deprecated Use `import type { PyCallable } from "pyodide/ffi"` instead */

@@ -752,2 +750,3 @@ interface PyCallable extends PyCallableMethods {

callKwargs(...jsargs: any): any;
callSyncifying(...jsargs: any): Promise<any>;
/**

@@ -837,3 +836,2 @@ * The ``bind()`` method creates a new function that, when called, has its

}
export declare type TypedArray = Int8Array | Uint8Array | Int16Array | Uint16Array | Int32Array | Uint32Array | Uint8ClampedArray | Float32Array | Float64Array;
declare class PyDict extends PyProxy {

@@ -847,3 +845,3 @@ /** @private */

/** @deprecated Use :js:class:`pyodide.ffi.PyDict` instead. */
export declare type PyProxyDict = PyDict;
export type PyProxyDict = PyDict;
/** @deprecated Use `import type { PyBufferView } from "pyodide/ffi"` instead */

@@ -929,5 +927,3 @@ declare class PyBufferView {

f_contiguous: boolean;
/** @private */
_released: boolean;
/** @private */
_view_ptr: number;

@@ -941,2 +937,22 @@ /** @private */

}
type InFuncType = () => null | undefined | string | ArrayBuffer | Uint8Array | number;
declare function setStdin(options?: {
stdin?: InFuncType;
read?: (buffer: Uint8Array) => number;
error?: boolean;
isatty?: boolean;
autoEOF?: boolean;
}): void;
declare function setStdout(options?: {
batched?: (output: string) => void;
raw?: (charCode: number) => void;
write?: (buffer: Uint8Array) => number;
isatty?: boolean;
}): void;
declare function setStderr(options?: {
batched?: (output: string) => void;
raw?: (charCode: number) => void;
write?: (buffer: Uint8Array) => number;
isatty?: boolean;
}): void;
declare function loadPackage(names: string | PyProxy | Array<string>, options?: {

@@ -947,2 +963,10 @@ messageCallback?: (message: string) => void;

}): Promise<void>;
/** @deprecated Use `import type { TypedArray } from "pyodide/ffi"` instead */
export type TypedArray = Int8Array | Uint8Array | Int16Array | Uint16Array | Int32Array | Uint32Array | Uint8ClampedArray | Float32Array | Float64Array;
interface CanvasInterface {
setCanvas2D(canvas: HTMLCanvasElement): void;
getCanvas2D(): HTMLCanvasElement | undefined;
setCanvas3D(canvas: HTMLCanvasElement): void;
getCanvas3D(): HTMLCanvasElement | undefined;
}
declare class PythonError extends Error {

@@ -964,23 +988,3 @@ /**

}
declare type InFuncType = () => null | undefined | string | ArrayBuffer | Uint8Array | number;
declare function setStdin(options?: {
stdin?: InFuncType;
read?: (buffer: Uint8Array) => number;
error?: boolean;
isatty?: boolean;
autoEOF?: boolean;
}): void;
declare function setStdout(options?: {
batched?: (output: string) => void;
raw?: (charCode: number) => void;
write?: (buffer: Uint8Array) => number;
isatty?: boolean;
}): void;
declare function setStderr(options?: {
batched?: (output: string) => void;
raw?: (charCode: number) => void;
write?: (buffer: Uint8Array) => number;
isatty?: boolean;
}): void;
declare type NativeFS = {
type NativeFS = {
syncfs: () => Promise<void>;

@@ -1058,6 +1062,4 @@ };

/**
* This provides APIs to set a canvas for rendering graphics.
*
* For example, you need to set a canvas if you want to use the
* SDL library. See :ref:`using-sdl` for more information.
* See :ref:`js-api-pyodide-canvas`.
* @hidetype
*/

@@ -1192,2 +1194,6 @@ static canvas: CanvasInterface;

}): Promise<any>;
static runPythonSyncifying(code: string, options?: {
globals?: PyProxy;
locals?: PyProxy;
}): Promise<any>;
/**

@@ -1294,4 +1300,4 @@ * Registers the JavaScript object ``module`` as a JavaScript module named

* does exist, it must be empty.
* @param fileSystemHandle A handle returned by ``navigator.storage.getDirectory()``
* or ``window.showDirectoryPicker()``.
* @param fileSystemHandle A handle returned by :js:func:`navigator.storage.getDirectory() <getDirectory>`
* or :js:func:`window.showDirectoryPicker() <showDirectoryPicker>`.
*/

@@ -1344,3 +1350,3 @@ static mountNativeFS(path: string, fileSystemHandle: FileSystemDirectoryHandle): Promise<NativeFS>;

* @alias
* @doc_kind class
* @dockind class
* @deprecated

@@ -1354,3 +1360,3 @@ */

* @alias
* @doc_kind class
* @dockind class
* @deprecated

@@ -1364,3 +1370,3 @@ */

* @alias
* @doc_kind class
* @dockind class
* @deprecated

@@ -1378,3 +1384,3 @@ */

/** @hidetype */
export declare type PyodideInterface = typeof PyodideAPI;
export type PyodideInterface = typeof PyodideAPI;
/**

@@ -1384,3 +1390,3 @@ * See documentation for loadPyodide.

*/
export declare type ConfigType = {
type ConfigType = {
indexURL: string;

@@ -1520,2 +1526,8 @@ packageCacheDir: string;

/**
* Opt into the old behavior where PyProxy.toString calls `repr` and not
* `str`.
* @deprecated
*/
pyproxyToStringRepr?: boolean;
/**
* @ignore

@@ -1522,0 +1534,0 @@ */

@@ -1,13 +0,12 @@

"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(`
`).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(`
`).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(`
"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(`
`).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(`
`).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&&n.message.split(`
`).length>n.stacktrace.split(`
`).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(`
`),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(`
`),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(`
`).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
`,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);})();
`).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(`
`),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(`
`),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(`
`).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);})();
try{Object.assign(exports,loadPyodide)}catch(_){}
globalThis.loadPyodide=loadPyodide.loadPyodide;
//# sourceMappingURL=pyodide.js.map

@@ -53,26 +53,2 @@ # Pyodide JavaScript package

### Node.js versions <0.17
- `Node.js` versions 14.x and 16.x: to use certain features of Pyodide you
need to manually install `node-fetch`, e.g. by doing `npm install node-fetch`.
- `Node.js v14.x`: you need to pass the option `--experimental-wasm-bigint`
when starting Node. Note that this flag is not documented by `node --help`
and moreover, if you pass `--experimental-wasm-bigint` to node >14 it is an
error:
```
$ node -v
v14.20.0
$ node --experimental-wasm-bigint hello_python.js
warning: no blob constructor, cannot create blobs with mimetypes
warning: no BlobBuilder
Loading distutils
Loaded distutils
Python says that 1+1= 2
```
See the [documentation](https://pyodide.org/en/stable/) fore more details.
## Details

@@ -79,0 +55,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc