pyodide 0.21.1 → 0.21.2

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.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"pyodide.js","sources":["../src/js/node_modules/stackframe/stackframe.js","../src/js/node_modules/error-stack-parser/error-stack-parser.js","../src/js/compat.ts","../src/js/module.ts","../src/js/pyodide.ts","../src/js/pyodide.umd.ts"],"sourcesContent":["(function(root, factory) {\n 'use strict';\n // Universal Module Definition (UMD) to support AMD, CommonJS/Node.js, Rhino, and browsers.\n\n /* istanbul ignore next */\n if (typeof define === 'function' && define.amd) {\n define('stackframe', [], factory);\n } else if (typeof exports === 'object') {\n module.exports = factory();\n } else {\n root.StackFrame = factory();\n }\n}(this, function() {\n 'use strict';\n function _isNumber(n) {\n return !isNaN(parseFloat(n)) && isFinite(n);\n }\n\n function _capitalize(str) {\n return str.charAt(0).toUpperCase() + str.substring(1);\n }\n\n function _getter(p) {\n return function() {\n return this[p];\n };\n }\n\n var booleanProps = ['isConstructor', 'isEval', 'isNative', 'isToplevel'];\n var numericProps = ['columnNumber', 'lineNumber'];\n var stringProps = ['fileName', 'functionName', 'source'];\n var arrayProps = ['args'];\n var objectProps = ['evalOrigin'];\n\n var props = booleanProps.concat(numericProps, stringProps, arrayProps, objectProps);\n\n function StackFrame(obj) {\n if (!obj) return;\n for (var i = 0; i < props.length; i++) {\n if (obj[props[i]] !== undefined) {\n this['set' + _capitalize(props[i])](obj[props[i]]);\n }\n }\n }\n\n StackFrame.prototype = {\n getArgs: function() {\n return this.args;\n },\n setArgs: function(v) {\n if (Object.prototype.toString.call(v) !== '[object Array]') {\n throw new TypeError('Args must be an Array');\n }\n this.args = v;\n },\n\n getEvalOrigin: function() {\n return this.evalOrigin;\n },\n setEvalOrigin: function(v) {\n if (v instanceof StackFrame) {\n this.evalOrigin = v;\n } else if (v instanceof Object) {\n this.evalOrigin = new StackFrame(v);\n } else {\n throw new TypeError('Eval Origin must be an Object or StackFrame');\n }\n },\n\n toString: function() {\n var fileName = this.getFileName() || '';\n var lineNumber = this.getLineNumber() || '';\n var columnNumber = this.getColumnNumber() || '';\n var functionName = this.getFunctionName() || '';\n if (this.getIsEval()) {\n if (fileName) {\n return '[eval] (' + fileName + ':' + lineNumber + ':' + columnNumber + ')';\n }\n return '[eval]:' + lineNumber + ':' + columnNumber;\n }\n if (functionName) {\n return functionName + ' (' + fileName + ':' + lineNumber + ':' + columnNumber + ')';\n }\n return fileName + ':' + lineNumber + ':' + columnNumber;\n }\n };\n\n StackFrame.fromString = function StackFrame$$fromString(str) {\n var argsStartIndex = str.indexOf('(');\n var argsEndIndex = str.lastIndexOf(')');\n\n var functionName = str.substring(0, argsStartIndex);\n var args = str.substring(argsStartIndex + 1, argsEndIndex).split(',');\n var locationString = str.substring(argsEndIndex + 1);\n\n if (locationString.indexOf('@') === 0) {\n var parts = /@(.+?)(?::(\\d+))?(?::(\\d+))?$/.exec(locationString, '');\n var fileName = parts[1];\n var lineNumber = parts[2];\n var columnNumber = parts[3];\n }\n\n return new StackFrame({\n functionName: functionName,\n args: args || undefined,\n fileName: fileName,\n lineNumber: lineNumber || undefined,\n columnNumber: columnNumber || undefined\n });\n };\n\n for (var i = 0; i < booleanProps.length; i++) {\n StackFrame.prototype['get' + _capitalize(booleanProps[i])] = _getter(booleanProps[i]);\n StackFrame.prototype['set' + _capitalize(booleanProps[i])] = (function(p) {\n return function(v) {\n this[p] = Boolean(v);\n };\n })(booleanProps[i]);\n }\n\n for (var j = 0; j < numericProps.length; j++) {\n StackFrame.prototype['get' + _capitalize(numericProps[j])] = _getter(numericProps[j]);\n StackFrame.prototype['set' + _capitalize(numericProps[j])] = (function(p) {\n return function(v) {\n if (!_isNumber(v)) {\n throw new TypeError(p + ' must be a Number');\n }\n this[p] = Number(v);\n };\n })(numericProps[j]);\n }\n\n for (var k = 0; k < stringProps.length; k++) {\n StackFrame.prototype['get' + _capitalize(stringProps[k])] = _getter(stringProps[k]);\n StackFrame.prototype['set' + _capitalize(stringProps[k])] = (function(p) {\n return function(v) {\n this[p] = String(v);\n };\n })(stringProps[k]);\n }\n\n return StackFrame;\n}));\n","(function(root, factory) {\n 'use strict';\n // Universal Module Definition (UMD) to support AMD, CommonJS/Node.js, Rhino, and browsers.\n\n /* istanbul ignore next */\n if (typeof define === 'function' && define.amd) {\n define('error-stack-parser', ['stackframe'], factory);\n } else if (typeof exports === 'object') {\n module.exports = factory(require('stackframe'));\n } else {\n root.ErrorStackParser = factory(root.StackFrame);\n }\n}(this, function ErrorStackParser(StackFrame) {\n 'use strict';\n\n var FIREFOX_SAFARI_STACK_REGEXP = /(^|@)\\S+:\\d+/;\n var CHROME_IE_STACK_REGEXP = /^\\s*at .*(\\S+:\\d+|\\(native\\))/m;\n var SAFARI_NATIVE_CODE_REGEXP = /^(eval@)?(\\[native code])?$/;\n\n return {\n /**\n * Given an Error object, extract the most information from it.\n *\n * @param {Error} error object\n * @return {Array} of StackFrames\n */\n parse: function ErrorStackParser$$parse(error) {\n if (typeof error.stacktrace !== 'undefined' || typeof error['opera#sourceloc'] !== 'undefined') {\n return this.parseOpera(error);\n } else if (error.stack && error.stack.match(CHROME_IE_STACK_REGEXP)) {\n return this.parseV8OrIE(error);\n } else if (error.stack) {\n return this.parseFFOrSafari(error);\n } else {\n throw new Error('Cannot parse given Error object');\n }\n },\n\n // Separate line and column numbers from a string of the form: (URI:Line:Column)\n extractLocation: function ErrorStackParser$$extractLocation(urlLike) {\n // Fail-fast but return locations like \"(native)\"\n if (urlLike.indexOf(':') === -1) {\n return [urlLike];\n }\n\n var regExp = /(.+?)(?::(\\d+))?(?::(\\d+))?$/;\n var parts = regExp.exec(urlLike.replace(/[()]/g, ''));\n return [parts[1], parts[2] || undefined, parts[3] || undefined];\n },\n\n parseV8OrIE: function ErrorStackParser$$parseV8OrIE(error) {\n var filtered = error.stack.split('\\n').filter(function(line) {\n return !!line.match(CHROME_IE_STACK_REGEXP);\n }, this);\n\n return filtered.map(function(line) {\n if (line.indexOf('(eval ') > -1) {\n // Throw away eval information until we implement stacktrace.js/stackframe#8\n line = line.replace(/eval code/g, 'eval').replace(/(\\(eval at [^()]*)|(,.*$)/g, '');\n }\n var sanitizedLine = line.replace(/^\\s+/, '').replace(/\\(eval code/g, '(').replace(/^.*?\\s+/, '');\n\n // capture and preseve the parenthesized location \"(/foo/my bar.js:12:87)\" in\n // case it has spaces in it, as the string is split on \\s+ later on\n var location = sanitizedLine.match(/ (\\(.+\\)$)/);\n\n // remove the parenthesized location from the line, if it was matched\n sanitizedLine = location ? sanitizedLine.replace(location[0], '') : sanitizedLine;\n\n // if a location was matched, pass it to extractLocation() otherwise pass all sanitizedLine\n // because this line doesn't have function name\n var locationParts = this.extractLocation(location ? location[1] : sanitizedLine);\n var functionName = location && sanitizedLine || undefined;\n var fileName = ['eval', '<anonymous>'].indexOf(locationParts[0]) > -1 ? undefined : locationParts[0];\n\n return new StackFrame({\n functionName: functionName,\n fileName: fileName,\n lineNumber: locationParts[1],\n columnNumber: locationParts[2],\n source: line\n });\n }, this);\n },\n\n parseFFOrSafari: function ErrorStackParser$$parseFFOrSafari(error) {\n var filtered = error.stack.split('\\n').filter(function(line) {\n return !line.match(SAFARI_NATIVE_CODE_REGEXP);\n }, this);\n\n return filtered.map(function(line) {\n // Throw away eval information until we implement stacktrace.js/stackframe#8\n if (line.indexOf(' > eval') > -1) {\n line = line.replace(/ line (\\d+)(?: > eval line \\d+)* > eval:\\d+:\\d+/g, ':$1');\n }\n\n if (line.indexOf('@') === -1 && line.indexOf(':') === -1) {\n // Safari eval frames only have function names and nothing else\n return new StackFrame({\n functionName: line\n });\n } else {\n var functionNameRegex = /((.*\".+\"[^@]*)?[^@]*)(?:@)/;\n var matches = line.match(functionNameRegex);\n var functionName = matches && matches[1] ? matches[1] : undefined;\n var locationParts = this.extractLocation(line.replace(functionNameRegex, ''));\n\n return new StackFrame({\n functionName: functionName,\n fileName: locationParts[0],\n lineNumber: locationParts[1],\n columnNumber: locationParts[2],\n source: line\n });\n }\n }, this);\n },\n\n parseOpera: function ErrorStackParser$$parseOpera(e) {\n if (!e.stacktrace || (e.message.indexOf('\\n') > -1 &&\n e.message.split('\\n').length > e.stacktrace.split('\\n').length)) {\n return this.parseOpera9(e);\n } else if (!e.stack) {\n return this.parseOpera10(e);\n } else {\n return this.parseOpera11(e);\n }\n },\n\n parseOpera9: function ErrorStackParser$$parseOpera9(e) {\n var lineRE = /Line (\\d+).*script (?:in )?(\\S+)/i;\n var lines = e.message.split('\\n');\n var result = [];\n\n for (var i = 2, len = lines.length; i < len; i += 2) {\n var match = lineRE.exec(lines[i]);\n if (match) {\n result.push(new StackFrame({\n fileName: match[2],\n lineNumber: match[1],\n source: lines[i]\n }));\n }\n }\n\n return result;\n },\n\n parseOpera10: function ErrorStackParser$$parseOpera10(e) {\n var lineRE = /Line (\\d+).*script (?:in )?(\\S+)(?:: In function (\\S+))?$/i;\n var lines = e.stacktrace.split('\\n');\n var result = [];\n\n for (var i = 0, len = lines.length; i < len; i += 2) {\n var match = lineRE.exec(lines[i]);\n if (match) {\n result.push(\n new StackFrame({\n functionName: match[3] || undefined,\n fileName: match[2],\n lineNumber: match[1],\n source: lines[i]\n })\n );\n }\n }\n\n return result;\n },\n\n // Opera 10.65+ Error.stack very similar to FF/Safari\n parseOpera11: function ErrorStackParser$$parseOpera11(error) {\n var filtered = error.stack.split('\\n').filter(function(line) {\n return !!line.match(FIREFOX_SAFARI_STACK_REGEXP) && !line.match(/^Error created at/);\n }, this);\n\n return filtered.map(function(line) {\n var tokens = line.split('@');\n var locationParts = this.extractLocation(tokens.pop());\n var functionCall = (tokens.shift() || '');\n var functionName = functionCall\n .replace(/<anonymous function(: (\\w+))?>/, '$2')\n .replace(/\\([^)]*\\)/g, '') || undefined;\n var argsRaw;\n if (functionCall.match(/\\(([^)]*)\\)/)) {\n argsRaw = functionCall.replace(/^[^(]+\\(([^)]*)\\)$/, '$1');\n }\n var args = (argsRaw === undefined || argsRaw === '[arguments not available]') ?\n undefined : argsRaw.split(',');\n\n return new StackFrame({\n functionName: functionName,\n args: args,\n fileName: locationParts[0],\n lineNumber: locationParts[1],\n columnNumber: locationParts[2],\n source: line\n });\n }, this);\n }\n };\n}));\n","// Detect if we're in node\ndeclare var process: any;\n\nexport const IN_NODE =\n typeof process !== \"undefined\" &&\n process.release &&\n process.release.name === \"node\" &&\n typeof process.browser ===\n \"undefined\"; /* This last condition checks if we run the browser shim of process */\n\nlet nodeUrlMod: any;\nlet nodeFetch: any;\nlet nodeVmMod: any;\n/** @private */\nexport let nodeFsPromisesMod: any;\n\ndeclare var globalThis: {\n importScripts: (url: string) => void;\n document?: any;\n fetch?: any;\n};\n\n/**\n * If we're in node, it's most convenient to import various node modules on\n * initialization. Otherwise, this does nothing.\n * @private\n */\nexport async function initNodeModules() {\n if (!IN_NODE) {\n return;\n }\n // @ts-ignore\n nodeUrlMod = (await import(\"url\")).default;\n nodeFsPromisesMod = await import(\"fs/promises\");\n if (globalThis.fetch) {\n nodeFetch = fetch;\n } else {\n // @ts-ignore\n nodeFetch = (await import(\"node-fetch\")).default;\n }\n // @ts-ignore\n nodeVmMod = (await import(\"vm\")).default;\n if (typeof require !== \"undefined\") {\n return;\n }\n // Emscripten uses `require`, so if it's missing (because we were imported as\n // an ES6 module) we need to polyfill `require` with `import`. `import` is\n // async and `require` is synchronous, so we import all packages that might be\n // required up front and define require to look them up in this table.\n\n // These are all the packages required in pyodide.asm.js. You can get this\n // list with:\n // $ grep -o 'require(\"[a-z]*\")' pyodide.asm.js | sort -u\n const fs = await import(\"fs\");\n const crypto = await import(\"crypto\");\n const ws = await import(\"ws\");\n const child_process = await import(\"child_process\");\n const node_modules: { [mode: string]: any } = {\n fs,\n crypto,\n ws,\n child_process,\n };\n // Since we're in an ES6 module, this is only modifying the module namespace,\n // it's still private to Pyodide.\n (globalThis as any).require = function (mod: string): any {\n return node_modules[mod];\n };\n}\n\n/**\n * Load a binary file, only for use in Node. If the path explicitly is a URL,\n * then fetch from a URL, else load from the file system.\n * @param indexURL base path to resolve relative paths\n * @param path the path to load\n * @param checksum sha-256 checksum of the package\n * @returns An ArrayBuffer containing the binary data\n * @private\n */\nasync function node_loadBinaryFile(\n indexURL: string,\n path: string,\n _file_sub_resource_hash?: string | undefined // Ignoring sub resource hash. See issue-2431.\n): Promise<Uint8Array> {\n if (!path.startsWith(\"/\") && !path.includes(\"://\")) {\n // If path starts with a \"/\" or starts with a protocol \"blah://\", we\n // interpret it as an absolute path, otherwise \"resolve\" it by\n // joining it with indexURL.\n path = `${indexURL}${path}`;\n }\n if (path.startsWith(\"file://\")) {\n // handle file:// with filesystem operations rather than with fetch.\n path = path.slice(\"file://\".length);\n }\n if (path.includes(\"://\")) {\n // If it has a protocol, make a fetch request\n let response = await nodeFetch(path);\n if (!response.ok) {\n throw new Error(`Failed to load '${path}': request failed.`);\n }\n return new Uint8Array(await response.arrayBuffer());\n } else {\n // Otherwise get it from the file system\n const data = await nodeFsPromisesMod.readFile(path);\n return new Uint8Array(data.buffer, data.byteOffset, data.byteLength);\n }\n}\n\n/**\n * Load a binary file, only for use in browser. Resolves relative paths against\n * indexURL.\n *\n * @param indexURL base path to resolve relative paths\n * @param path the path to load\n * @param subResourceHash the sub resource hash for fetch() integrity check\n * @returns A Uint8Array containing the binary data\n * @private\n */\nasync function browser_loadBinaryFile(\n indexURL: string,\n path: string,\n subResourceHash: string | undefined\n): Promise<Uint8Array> {\n // @ts-ignore\n const base = new URL(indexURL, location);\n const url = new URL(path, base);\n let options = subResourceHash ? { integrity: subResourceHash } : {};\n // @ts-ignore\n let response = await fetch(url, options);\n if (!response.ok) {\n throw new Error(`Failed to load '${url}': request failed.`);\n }\n return new Uint8Array(await response.arrayBuffer());\n}\n\n/** @private */\nexport let loadBinaryFile: (\n indexURL: string,\n path: string,\n file_sub_resource_hash?: string | undefined\n) => Promise<Uint8Array>;\nif (IN_NODE) {\n loadBinaryFile = node_loadBinaryFile;\n} else {\n loadBinaryFile = browser_loadBinaryFile;\n}\n\n/**\n * Currently loadScript is only used once to load `pyodide.asm.js`.\n * @param url\n * @async\n * @private\n */\nexport let loadScript: (url: string) => Promise<void>;\n\nif (globalThis.document) {\n // browser\n loadScript = async (url) => await import(url);\n} else if (globalThis.importScripts) {\n // webworker\n loadScript = async (url) => {\n // This is async only for consistency\n try {\n // use importScripts in classic web worker\n globalThis.importScripts(url);\n } catch (e) {\n // importScripts throws TypeError in a module type web worker, use import instead\n if (e instanceof TypeError) {\n await import(url);\n } else {\n throw e;\n }\n }\n };\n} else if (IN_NODE) {\n loadScript = nodeLoadScript;\n} else {\n throw new Error(\"Cannot determine runtime environment\");\n}\n\n/**\n * Load a text file and executes it as Javascript\n * @param url The path to load. May be a url or a relative file system path.\n * @private\n */\nasync function nodeLoadScript(url: string) {\n if (url.startsWith(\"file://\")) {\n // handle file:// with filesystem operations rather than with fetch.\n url = url.slice(\"file://\".length);\n }\n if (url.includes(\"://\")) {\n // If it's a url, load it with fetch then eval it.\n nodeVmMod.runInThisContext(await (await nodeFetch(url)).text());\n } else {\n // Otherwise, hopefully it is a relative path we can load from the file\n // system.\n await import(nodeUrlMod.pathToFileURL(url).href);\n }\n}\n","/** @private */\nexport interface Module {\n noImageDecoding: boolean;\n noAudioDecoding: boolean;\n noWasmDecoding: boolean;\n preRun: { (): void }[];\n print: (a: string) => void;\n printErr: (a: string) => void;\n ENV: { [key: string]: string };\n preloadedWasm: any;\n FS: any;\n}\n\n/**\n * The Emscripten Module.\n *\n * @private\n */\nexport function createModule(): any {\n let Module: any = {};\n Module.noImageDecoding = true;\n Module.noAudioDecoding = true;\n Module.noWasmDecoding = false; // we preload wasm using the built in plugin now\n Module.preloadedWasm = {};\n Module.preRun = [];\n return Module;\n}\n\n/**\n *\n * @param stdin\n * @param stdout\n * @param stderr\n * @private\n */\nexport function setStandardStreams(\n Module: Module,\n stdin?: () => string,\n stdout?: (a: string) => void,\n stderr?: (a: string) => void\n) {\n // For stdout and stderr, emscripten provides convenient wrappers that save us the trouble of converting the bytes into a string\n if (stdout) {\n Module.print = stdout;\n }\n\n if (stderr) {\n Module.printErr = stderr;\n }\n\n // For stdin, we have to deal with the low level API ourselves\n if (stdin) {\n Module.preRun.push(function () {\n Module.FS.init(createStdinWrapper(stdin), null, null);\n });\n }\n}\n\nfunction createStdinWrapper(stdin: () => string) {\n // When called, it asks the user for one whole line of input (stdin)\n // Then, it passes the individual bytes of the input to emscripten, one after another.\n // And finally, it terminates it with null.\n const encoder = new TextEncoder();\n let input = new Uint8Array(0);\n let inputIndex = -1; // -1 means that we just returned null\n function stdinWrapper() {\n try {\n if (inputIndex === -1) {\n let text = stdin();\n if (text === undefined || text === null) {\n return null;\n }\n if (typeof text !== \"string\") {\n throw new TypeError(\n `Expected stdin to return string, null, or undefined, got type ${typeof text}.`\n );\n }\n if (!text.endsWith(\"\\n\")) {\n text += \"\\n\";\n }\n input = encoder.encode(text);\n inputIndex = 0;\n }\n\n if (inputIndex < input.length) {\n let character = input[inputIndex];\n inputIndex++;\n return character;\n } else {\n inputIndex = -1;\n return null;\n }\n } catch (e) {\n // emscripten will catch this and set an IOError which is unhelpful for\n // debugging.\n console.error(\"Error thrown in stdin:\");\n console.error(e);\n throw e;\n }\n }\n return stdinWrapper;\n}\n\n/**\n * Make the home directory inside the virtual file system,\n * then change the working directory to it.\n *\n * @param path\n * @private\n */\nexport function setHomeDirectory(Module: Module, path: string) {\n Module.preRun.push(function () {\n const fallbackPath = \"/\";\n try {\n Module.FS.mkdirTree(path);\n } catch (e) {\n console.error(`Error occurred while making a home directory '${path}':`);\n console.error(e);\n console.error(`Using '${fallbackPath}' for a home directory instead`);\n path = fallbackPath;\n }\n Module.ENV.HOME = path;\n Module.FS.chdir(path);\n });\n}\n","/**\n * The main bootstrap code for loading pyodide.\n */\nimport ErrorStackParser from \"error-stack-parser\";\nimport { loadScript, loadBinaryFile, initNodeModules } from \"./compat\";\n\nimport { createModule, setStandardStreams, setHomeDirectory } from \"./module\";\n\nimport type { PyodideInterface } from \"./api.js\";\nimport type { PyProxy, PyProxyDict } from \"./pyproxy.gen\";\nexport type { PyodideInterface };\n\nexport type {\n PyProxy,\n PyProxyWithLength,\n PyProxyDict,\n PyProxyWithGet,\n PyProxyWithSet,\n PyProxyWithHas,\n PyProxyIterable,\n PyProxyIterator,\n PyProxyAwaitable,\n PyProxyBuffer,\n PyProxyCallable,\n TypedArray,\n PyBuffer,\n} from \"./pyproxy.gen\";\n\nexport type Py2JsResult = any;\n\n/**\n * A proxy around globals that falls back to checking for a builtin if has or\n * get fails to find a global with the given key. Note that this proxy is\n * transparent to js2python: it won't notice that this wrapper exists at all and\n * will translate this proxy to the globals dictionary.\n * @private\n */\nfunction wrapPythonGlobals(\n globals_dict: PyProxyDict,\n builtins_dict: PyProxyDict\n) {\n return new Proxy(globals_dict, {\n get(target, symbol) {\n if (symbol === \"get\") {\n return (key: any) => {\n let result = target.get(key);\n if (result === undefined) {\n result = builtins_dict.get(key);\n }\n return result;\n };\n }\n if (symbol === \"has\") {\n return (key: any) => target.has(key) || builtins_dict.has(key);\n }\n return Reflect.get(target, symbol);\n },\n });\n}\n\nfunction unpackPyodidePy(Module: any, pyodide_py_tar: Uint8Array) {\n const fileName = \"/pyodide_py.tar\";\n let stream = Module.FS.open(fileName, \"w\");\n Module.FS.write(\n stream,\n pyodide_py_tar,\n 0,\n pyodide_py_tar.byteLength,\n undefined,\n true\n );\n Module.FS.close(stream);\n const code_ptr = Module.stringToNewUTF8(`\nfrom sys import version_info\npyversion = f\"python{version_info.major}.{version_info.minor}\"\nimport shutil\nshutil.unpack_archive(\"/pyodide_py.tar\", f\"/lib/{pyversion}/site-packages/\")\ndel shutil\nimport importlib\nimportlib.invalidate_caches()\ndel importlib\n `);\n let errcode = Module._PyRun_SimpleString(code_ptr);\n if (errcode) {\n throw new Error(\"OOPS!\");\n }\n Module._free(code_ptr);\n Module.FS.unlink(fileName);\n}\n\n/**\n * This function is called after the emscripten module is finished initializing,\n * so eval_code is newly available.\n * It finishes the bootstrap so that once it is complete, it is possible to use\n * the core `pyodide` apis. (But package loading is not ready quite yet.)\n * @private\n */\nfunction finalizeBootstrap(API: any, config: ConfigType) {\n // First make internal dict so that we can use runPythonInternal.\n // runPythonInternal uses a separate namespace, so we don't pollute the main\n // environment with variables from our setup.\n API.runPythonInternal_dict = API._pyodide._base.eval_code(\"{}\") as PyProxy;\n API.importlib = API.runPythonInternal(\"import importlib; importlib\");\n let import_module = API.importlib.import_module;\n\n API.sys = import_module(\"sys\");\n API.sys.path.insert(0, config.homedir);\n\n // Set up globals\n let globals = API.runPythonInternal(\n \"import __main__; __main__.__dict__\"\n ) as PyProxyDict;\n let builtins = API.runPythonInternal(\n \"import builtins; builtins.__dict__\"\n ) as PyProxyDict;\n API.globals = wrapPythonGlobals(globals, builtins);\n\n // Set up key Javascript modules.\n let importhook = API._pyodide._importhook;\n importhook.register_js_finder();\n importhook.register_js_module(\"js\", config.jsglobals);\n\n importhook.register_unvendored_stdlib_finder();\n\n let pyodide = API.makePublicAPI();\n importhook.register_js_module(\"pyodide_js\", pyodide);\n\n // import pyodide_py. We want to ensure that as much stuff as possible is\n // already set up before importing pyodide_py to simplify development of\n // pyodide_py code (Otherwise it's very hard to keep track of which things\n // aren't set up yet.)\n API.pyodide_py = import_module(\"pyodide\");\n API.pyodide_code = import_module(\"pyodide.code\");\n API.pyodide_ffi = import_module(\"pyodide.ffi\");\n API.package_loader = import_module(\"pyodide._package_loader\");\n API.version = API.pyodide_py.__version__;\n\n // copy some last constants onto public API.\n pyodide.pyodide_py = API.pyodide_py;\n pyodide.version = API.version;\n pyodide.globals = API.globals;\n return pyodide;\n}\n\ndeclare function _createPyodideModule(Module: any): Promise<void>;\n\n/**\n * If indexURL isn't provided, throw an error and catch it and then parse our\n * file name out from the stack trace.\n *\n * Question: But getting the URL from error stack trace is well... really\n * hacky. Can't we use\n * [`document.currentScript`](https://developer.mozilla.org/en-US/docs/Web/API/Document/currentScript)\n * or\n * [`import.meta.url`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/import.meta)\n * instead?\n *\n * Answer: `document.currentScript` works for the browser main thread.\n * `import.meta` works for es6 modules. In a classic webworker, I think there\n * is no approach that works. Also we would need some third approach for node\n * when loading a commonjs module using `require`. On the other hand, this\n * stack trace approach works for every case without any feature detection\n * code.\n */\nfunction calculateIndexURL(): string {\n let err: Error;\n try {\n throw new Error();\n } catch (e) {\n err = e as Error;\n }\n let fileName = ErrorStackParser.parse(err)[0].fileName!;\n const indexOfLastSlash = fileName.includes(\"/\")\n ? fileName.lastIndexOf(\"/\")\n : fileName.lastIndexOf(\"\\\\\");\n if (indexOfLastSlash === -1) {\n throw new Error(\n \"Could not extract indexURL path from pyodide module location\"\n );\n }\n return fileName.slice(0, indexOfLastSlash);\n}\n\n/**\n * See documentation for loadPyodide.\n * @private\n */\nexport type ConfigType = {\n indexURL: string;\n lockFileURL: string;\n homedir: string;\n fullStdLib?: boolean;\n stdin?: () => string;\n stdout?: (msg: string) => void;\n stderr?: (msg: string) => void;\n jsglobals?: object;\n};\n\n/**\n * Load the main Pyodide wasm module and initialize it.\n *\n * Only one copy of Pyodide can be loaded in a given JavaScript global scope\n * because Pyodide uses global variables to load packages. If an attempt is made\n * to load a second copy of Pyodide, :any:`loadPyodide` will throw an error.\n * (This can be fixed once `Firefox adopts support for ES6 modules in webworkers\n * <https://bugzilla.mozilla.org/show_bug.cgi?id=1247687>`_.)\n *\n * @returns The :ref:`js-api-pyodide` module.\n * @memberof globalThis\n * @async\n */\nexport async function loadPyodide(\n options: {\n /**\n * The URL from which Pyodide will load the main Pyodide runtime and\n * packages. Defaults to the url that pyodide is loaded from with the file\n * name (pyodide.js or pyodide.mjs) removed. It is recommended that you\n * leave this undefined, providing an incorrect value can cause broken\n * behavior.\n */\n indexURL?: string;\n\n /**\n * The URL from which Pyodide will load the Pyodide \"repodata.json\" lock\n * file. Defaults to ``${indexURL}/repodata.json``. You can produce custom\n * lock files with :any:`micropip.freeze`\n */\n lockFileURL?: string;\n\n /**\n * The home directory which Pyodide will use inside virtual file system. Default: \"/home/pyodide\"\n */\n homedir?: string;\n\n /** Load the full Python standard library.\n * Setting this to false excludes following modules: distutils.\n * Default: true\n */\n fullStdLib?: boolean;\n /**\n * Override the standard input callback. Should ask the user for one line of input.\n */\n stdin?: () => string;\n /**\n * Override the standard output callback.\n * Default: undefined\n */\n stdout?: (msg: string) => void;\n /**\n * Override the standard error output callback.\n * Default: undefined\n */\n stderr?: (msg: string) => void;\n jsglobals?: object;\n } = {}\n): Promise<PyodideInterface> {\n if (!options.indexURL) {\n options.indexURL = calculateIndexURL();\n }\n if (!options.indexURL.endsWith(\"/\")) {\n options.indexURL += \"/\";\n }\n\n const default_config = {\n fullStdLib: true,\n jsglobals: globalThis,\n stdin: globalThis.prompt ? globalThis.prompt : undefined,\n homedir: \"/home/pyodide\",\n lockFileURL: options.indexURL! + \"repodata.json\",\n };\n const config = Object.assign(default_config, options) as ConfigType;\n await initNodeModules();\n const pyodide_py_tar_promise = loadBinaryFile(\n config.indexURL,\n \"pyodide_py.tar\"\n );\n\n const Module = createModule();\n const API: any = { config };\n Module.API = API;\n\n setStandardStreams(Module, config.stdin, config.stdout, config.stderr);\n setHomeDirectory(Module, config.homedir);\n\n const moduleLoaded = new Promise((r) => (Module.postRun = r));\n\n // locateFile tells Emscripten where to find the data files that initialize\n // the file system.\n Module.locateFile = (path: string) => config.indexURL + path;\n const scriptSrc = `${config.indexURL}pyodide.asm.js`;\n await loadScript(scriptSrc);\n\n // _createPyodideModule is specified in the Makefile by the linker flag:\n // `-s EXPORT_NAME=\"'_createPyodideModule'\"`\n await _createPyodideModule(Module);\n\n // There is some work to be done between the module being \"ready\" and postRun\n // being called.\n await moduleLoaded;\n\n // Disable further loading of Emscripten file_packager stuff.\n Module.locateFile = (path: string) => {\n throw new Error(\"Didn't expect to load any more file_packager files!\");\n };\n\n const pyodide_py_tar = await pyodide_py_tar_promise;\n unpackPyodidePy(Module, pyodide_py_tar);\n Module._pyodide_init();\n\n const pyodide = finalizeBootstrap(API, config);\n // API.runPython works starting here.\n if (!pyodide.version.includes(\"dev\")) {\n // Currently only used in Node to download packages the first time they are\n // loaded. But in other cases it's harmless.\n API.setCdnUrl(`https://cdn.jsdelivr.net/pyodide/v${pyodide.version}/full/`);\n }\n await API.packageIndexReady;\n if (API.repodata_info.version !== pyodide.version) {\n throw new Error(\"Lock file version doesn't match Pyodide version\");\n }\n if (config.fullStdLib) {\n await pyodide.loadPackage([\"distutils\"]);\n }\n pyodide.runPython(\"print('Python initialization complete')\");\n return pyodide;\n}\n","import { loadPyodide } from \"./pyodide\";\nexport { loadPyodide };\n(globalThis as any).loadPyodide = loadPyodide;\n"],"names":["module","_isNumber","n","isNaN","parseFloat","isFinite","_capitalize","str","charAt","toUpperCase","substring","_getter","p","this","booleanProps","numericProps","stringProps","arrayProps","objectProps","props","concat","StackFrame","obj","i","length","undefined","prototype","getArgs","args","setArgs","v","Object","toString","call","TypeError","getEvalOrigin","evalOrigin","setEvalOrigin","fileName","getFileName","lineNumber","getLineNumber","columnNumber","getColumnNumber","functionName","getFunctionName","getIsEval","fromString","argsStartIndex","indexOf","argsEndIndex","lastIndexOf","split","locationString","parts","exec","Boolean","j","Number","k","String","factory","FIREFOX_SAFARI_STACK_REGEXP","CHROME_IE_STACK_REGEXP","SAFARI_NATIVE_CODE_REGEXP","require$$0","parse","error","stacktrace","parseOpera","stack","match","parseV8OrIE","parseFFOrSafari","Error","extractLocation","urlLike","replace","filter","line","map","sanitizedLine","location","locationParts","source","functionNameRegex","matches","e","message","parseOpera9","parseOpera11","parseOpera10","lineRE","lines","result","len","push","argsRaw","tokens","pop","functionCall","shift","IN_NODE","process","release","name","browser","nodeUrlMod","nodeFetch","nodeVmMod","nodeFsPromisesMod","loadBinaryFile","loadScript","async","indexURL","path","_file_sub_resource_hash","startsWith","includes","slice","response","ok","Uint8Array","arrayBuffer","data","readFile","buffer","byteOffset","byteLength","subResourceHash","base","URL","url","options","integrity","fetch","globalThis","document","import","importScripts","runInThisContext","text","pathToFileURL","href","setStandardStreams","Module","stdin","stdout","stderr","print","printErr","preRun","FS","init","encoder","TextEncoder","input","inputIndex","stdinWrapper","endsWith","encode","character","console","createStdinWrapper","finalizeBootstrap","API","config","runPythonInternal_dict","_pyodide","_base","eval_code","importlib","runPythonInternal","import_module","sys","insert","homedir","globals","builtins","builtins_dict","Proxy","get","target","symbol","key","has","Reflect","importhook","_importhook","register_js_finder","register_js_module","jsglobals","register_unvendored_stdlib_finder","pyodide","makePublicAPI","pyodide_py","pyodide_code","pyodide_ffi","package_loader","version","__version__","loadPyodide","err","ErrorStackParser","indexOfLastSlash","calculateIndexURL","default_config","fullStdLib","prompt","lockFileURL","assign","default","require","node_modules","fs","crypto","ws","child_process","mod","initNodeModules","pyodide_py_tar_promise","mkdirTree","ENV","HOME","chdir","setHomeDirectory","moduleLoaded","Promise","r","postRun","locateFile","scriptSrc","_createPyodideModule","pyodide_py_tar","stream","open","write","close","code_ptr","stringToNewUTF8","_PyRun_SimpleString","_free","unlink","unpackPyodidePy","_pyodide_init","setCdnUrl","packageIndexReady","repodata_info","loadPackage","runPython"],"mappings":"igBAQQA,eAIA,WAEJ,SAASC,UAAUC,GACf,OAAQC,MAAMC,WAAWF,KAAOG,SAASH,GAG7C,SAASI,YAAYC,KACjB,OAAOA,IAAIC,OAAO,GAAGC,cAAgBF,IAAIG,UAAU,GAGvD,SAASC,QAAQC,GACb,OAAO,WACH,OAAOC,KAAKD,IAIpB,IAAIE,aAAe,CAAC,gBAAiB,SAAU,WAAY,cACvDC,aAAe,CAAC,eAAgB,cAChCC,YAAc,CAAC,WAAY,eAAgB,UAC3CC,WAAa,CAAC,QACdC,YAAc,CAAC,cAEfC,MAAQL,aAAaM,OAAOL,aAAcC,YAAaC,WAAYC,aAEvE,SAASG,WAAWC,KAChB,GAAKA,IACL,IAAK,IAAIC,EAAI,EAAGA,EAAIJ,MAAMK,OAAQD,SACRE,IAAlBH,IAAIH,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QM,QAAQjF,SAAS,QAG5B+C,IAAIgF,UAAU,qCAAqCpD,QAAQM,uBAEvDlC,IAAIiF,kBACNjF,IAAIkF,cAAchD,UAAYN,QAAQM,QACxC,MAAM,IAAI7H,MAAM,mDAMlB,OAJI4F,OAAOyC,kBACHd,QAAQuD,YAAY,CAAC,cAE7BvD,QAAQwD,UAAU,2CACXxD,OACT,CCnUCzD,WAAmBiE,YAAcA"}
package/pyodide.mjs.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"pyodide.mjs","sources":["../src/js/node_modules/error-stack-parser/error-stack-parser.js","../src/js/node_modules/stackframe/stackframe.js","../src/js/compat.ts","../src/js/module.ts","../src/js/pyodide.ts"],"sourcesContent":["(function(root, factory) {\n 'use strict';\n // Universal Module Definition (UMD) to support AMD, CommonJS/Node.js, Rhino, and browsers.\n\n /* istanbul ignore next */\n if (typeof define === 'function' && define.amd) {\n define('error-stack-parser', ['stackframe'], factory);\n } else if (typeof exports === 'object') {\n module.exports = factory(require('stackframe'));\n } else {\n root.ErrorStackParser = factory(root.StackFrame);\n }\n}(this, function ErrorStackParser(StackFrame) {\n 'use strict';\n\n var FIREFOX_SAFARI_STACK_REGEXP = /(^|@)\\S+:\\d+/;\n var CHROME_IE_STACK_REGEXP = /^\\s*at .*(\\S+:\\d+|\\(native\\))/m;\n var SAFARI_NATIVE_CODE_REGEXP = /^(eval@)?(\\[native code])?$/;\n\n return {\n /**\n * Given an Error object, extract the most information from it.\n *\n * @param {Error} error object\n * @return {Array} of StackFrames\n */\n parse: function ErrorStackParser$$parse(error) {\n if (typeof error.stacktrace !== 'undefined' || typeof error['opera#sourceloc'] !== 'undefined') {\n return this.parseOpera(error);\n } else if (error.stack && error.stack.match(CHROME_IE_STACK_REGEXP)) {\n return this.parseV8OrIE(error);\n } else if (error.stack) {\n return this.parseFFOrSafari(error);\n } else {\n throw new Error('Cannot parse given Error object');\n }\n },\n\n // Separate line and column numbers from a string of the form: (URI:Line:Column)\n extractLocation: function ErrorStackParser$$extractLocation(urlLike) {\n // Fail-fast but return locations like \"(native)\"\n if (urlLike.indexOf(':') === -1) {\n return [urlLike];\n }\n\n var regExp = /(.+?)(?::(\\d+))?(?::(\\d+))?$/;\n var parts = regExp.exec(urlLike.replace(/[()]/g, ''));\n return [parts[1], parts[2] || undefined, parts[3] || undefined];\n },\n\n parseV8OrIE: function ErrorStackParser$$parseV8OrIE(error) {\n var filtered = error.stack.split('\\n').filter(function(line) {\n return !!line.match(CHROME_IE_STACK_REGEXP);\n }, this);\n\n return filtered.map(function(line) {\n if (line.indexOf('(eval ') > -1) {\n // Throw away eval information until we implement stacktrace.js/stackframe#8\n line = line.replace(/eval code/g, 'eval').replace(/(\\(eval at [^()]*)|(,.*$)/g, '');\n }\n var sanitizedLine = line.replace(/^\\s+/, '').replace(/\\(eval code/g, '(').replace(/^.*?\\s+/, '');\n\n // capture and preseve the parenthesized location \"(/foo/my bar.js:12:87)\" in\n // case it has spaces in it, as the string is split on \\s+ later on\n var location = sanitizedLine.match(/ (\\(.+\\)$)/);\n\n // remove the parenthesized location from the line, if it was matched\n sanitizedLine = location ? sanitizedLine.replace(location[0], '') : sanitizedLine;\n\n // if a location was matched, pass it to extractLocation() otherwise pass all sanitizedLine\n // because this line doesn't have function name\n var locationParts = this.extractLocation(location ? location[1] : sanitizedLine);\n var functionName = location && sanitizedLine || undefined;\n var fileName = ['eval', '<anonymous>'].indexOf(locationParts[0]) > -1 ? undefined : locationParts[0];\n\n return new StackFrame({\n functionName: functionName,\n fileName: fileName,\n lineNumber: locationParts[1],\n columnNumber: locationParts[2],\n source: line\n });\n }, this);\n },\n\n parseFFOrSafari: function ErrorStackParser$$parseFFOrSafari(error) {\n var filtered = error.stack.split('\\n').filter(function(line) {\n return !line.match(SAFARI_NATIVE_CODE_REGEXP);\n }, this);\n\n return filtered.map(function(line) {\n // Throw away eval information until we implement stacktrace.js/stackframe#8\n if (line.indexOf(' > eval') > -1) {\n line = line.replace(/ line (\\d+)(?: > eval line \\d+)* > eval:\\d+:\\d+/g, ':$1');\n }\n\n if (line.indexOf('@') === -1 && line.indexOf(':') === -1) {\n // Safari eval frames only have function names and nothing else\n return new StackFrame({\n functionName: line\n });\n } else {\n var functionNameRegex = /((.*\".+\"[^@]*)?[^@]*)(?:@)/;\n var matches = line.match(functionNameRegex);\n var functionName = matches && matches[1] ? matches[1] : undefined;\n var locationParts = this.extractLocation(line.replace(functionNameRegex, ''));\n\n return new StackFrame({\n functionName: functionName,\n fileName: locationParts[0],\n lineNumber: locationParts[1],\n columnNumber: locationParts[2],\n source: line\n });\n }\n }, this);\n },\n\n parseOpera: function ErrorStackParser$$parseOpera(e) {\n if (!e.stacktrace || (e.message.indexOf('\\n') > -1 &&\n e.message.split('\\n').length > e.stacktrace.split('\\n').length)) {\n return this.parseOpera9(e);\n } else if (!e.stack) {\n return this.parseOpera10(e);\n } else {\n return this.parseOpera11(e);\n }\n },\n\n parseOpera9: function ErrorStackParser$$parseOpera9(e) {\n var lineRE = /Line (\\d+).*script (?:in )?(\\S+)/i;\n var lines = e.message.split('\\n');\n var result = [];\n\n for (var i = 2, len = lines.length; i < len; i += 2) {\n var match = lineRE.exec(lines[i]);\n if (match) {\n result.push(new StackFrame({\n fileName: match[2],\n lineNumber: match[1],\n source: lines[i]\n }));\n }\n }\n\n return result;\n },\n\n parseOpera10: function ErrorStackParser$$parseOpera10(e) {\n var lineRE = /Line (\\d+).*script (?:in )?(\\S+)(?:: In function (\\S+))?$/i;\n var lines = e.stacktrace.split('\\n');\n var result = [];\n\n for (var i = 0, len = lines.length; i < len; i += 2) {\n var match = lineRE.exec(lines[i]);\n if (match) {\n result.push(\n new StackFrame({\n functionName: match[3] || undefined,\n fileName: match[2],\n lineNumber: match[1],\n source: lines[i]\n })\n );\n }\n }\n\n return result;\n },\n\n // Opera 10.65+ Error.stack very similar to FF/Safari\n parseOpera11: function ErrorStackParser$$parseOpera11(error) {\n var filtered = error.stack.split('\\n').filter(function(line) {\n return !!line.match(FIREFOX_SAFARI_STACK_REGEXP) && !line.match(/^Error created at/);\n }, this);\n\n return filtered.map(function(line) {\n var tokens = line.split('@');\n var locationParts = this.extractLocation(tokens.pop());\n var functionCall = (tokens.shift() || '');\n var functionName = functionCall\n .replace(/<anonymous function(: (\\w+))?>/, '$2')\n .replace(/\\([^)]*\\)/g, '') || undefined;\n var argsRaw;\n if (functionCall.match(/\\(([^)]*)\\)/)) {\n argsRaw = functionCall.replace(/^[^(]+\\(([^)]*)\\)$/, '$1');\n }\n var args = (argsRaw === undefined || argsRaw === '[arguments not available]') ?\n undefined : argsRaw.split(',');\n\n return new StackFrame({\n functionName: functionName,\n args: args,\n fileName: locationParts[0],\n lineNumber: locationParts[1],\n columnNumber: locationParts[2],\n source: line\n });\n }, this);\n }\n };\n}));\n","(function(root, factory) {\n 'use strict';\n // Universal Module Definition (UMD) to support AMD, CommonJS/Node.js, Rhino, and browsers.\n\n /* istanbul ignore next */\n if (typeof define === 'function' && define.amd) {\n define('stackframe', [], factory);\n } else if (typeof exports === 'object') {\n module.exports = factory();\n } else {\n root.StackFrame = factory();\n }\n}(this, function() {\n 'use strict';\n function _isNumber(n) {\n return !isNaN(parseFloat(n)) && isFinite(n);\n }\n\n function _capitalize(str) {\n return str.charAt(0).toUpperCase() + str.substring(1);\n }\n\n function _getter(p) {\n return function() {\n return this[p];\n };\n }\n\n var booleanProps = ['isConstructor', 'isEval', 'isNative', 'isToplevel'];\n var numericProps = ['columnNumber', 'lineNumber'];\n var stringProps = ['fileName', 'functionName', 'source'];\n var arrayProps = ['args'];\n var objectProps = ['evalOrigin'];\n\n var props = booleanProps.concat(numericProps, stringProps, arrayProps, objectProps);\n\n function StackFrame(obj) {\n if (!obj) return;\n for (var i = 0; i < props.length; i++) {\n if (obj[props[i]] !== undefined) {\n this['set' + _capitalize(props[i])](obj[props[i]]);\n }\n }\n }\n\n StackFrame.prototype = {\n getArgs: function() {\n return this.args;\n },\n setArgs: function(v) {\n if (Object.prototype.toString.call(v) !== '[object Array]') {\n throw new TypeError('Args must be an Array');\n }\n this.args = v;\n },\n\n getEvalOrigin: function() {\n return this.evalOrigin;\n },\n setEvalOrigin: function(v) {\n if (v instanceof StackFrame) {\n this.evalOrigin = v;\n } else if (v instanceof Object) {\n this.evalOrigin = new StackFrame(v);\n } else {\n throw new TypeError('Eval Origin must be an Object or StackFrame');\n }\n },\n\n toString: function() {\n var fileName = this.getFileName() || '';\n var lineNumber = this.getLineNumber() || '';\n var columnNumber = this.getColumnNumber() || '';\n var functionName = this.getFunctionName() || '';\n if (this.getIsEval()) {\n if (fileName) {\n return '[eval] (' + fileName + ':' + lineNumber + ':' + columnNumber + ')';\n }\n return '[eval]:' + lineNumber + ':' + columnNumber;\n }\n if (functionName) {\n return functionName + ' (' + fileName + ':' + lineNumber + ':' + columnNumber + ')';\n }\n return fileName + ':' + lineNumber + ':' + columnNumber;\n }\n };\n\n StackFrame.fromString = function StackFrame$$fromString(str) {\n var argsStartIndex = str.indexOf('(');\n var argsEndIndex = str.lastIndexOf(')');\n\n var functionName = str.substring(0, argsStartIndex);\n var args = str.substring(argsStartIndex + 1, argsEndIndex).split(',');\n var locationString = str.substring(argsEndIndex + 1);\n\n if (locationString.indexOf('@') === 0) {\n var parts = /@(.+?)(?::(\\d+))?(?::(\\d+))?$/.exec(locationString, '');\n var fileName = parts[1];\n var lineNumber = parts[2];\n var columnNumber = parts[3];\n }\n\n return new StackFrame({\n functionName: functionName,\n args: args || undefined,\n fileName: fileName,\n lineNumber: lineNumber || undefined,\n columnNumber: columnNumber || undefined\n });\n };\n\n for (var i = 0; i < booleanProps.length; i++) {\n StackFrame.prototype['get' + _capitalize(booleanProps[i])] = _getter(booleanProps[i]);\n StackFrame.prototype['set' + _capitalize(booleanProps[i])] = (function(p) {\n return function(v) {\n this[p] = Boolean(v);\n };\n })(booleanProps[i]);\n }\n\n for (var j = 0; j < numericProps.length; j++) {\n StackFrame.prototype['get' + _capitalize(numericProps[j])] = _getter(numericProps[j]);\n StackFrame.prototype['set' + _capitalize(numericProps[j])] = (function(p) {\n return function(v) {\n if (!_isNumber(v)) {\n throw new TypeError(p + ' must be a Number');\n }\n this[p] = Number(v);\n };\n })(numericProps[j]);\n }\n\n for (var k = 0; k < stringProps.length; k++) {\n StackFrame.prototype['get' + _capitalize(stringProps[k])] = _getter(stringProps[k]);\n StackFrame.prototype['set' + _capitalize(stringProps[k])] = (function(p) {\n return function(v) {\n this[p] = String(v);\n };\n })(stringProps[k]);\n }\n\n return StackFrame;\n}));\n","// Detect if we're in node\ndeclare var process: any;\n\nexport const IN_NODE =\n typeof process !== \"undefined\" &&\n process.release &&\n process.release.name === \"node\" &&\n typeof process.browser ===\n \"undefined\"; /* This last condition checks if we run the browser shim of process */\n\nlet nodeUrlMod: any;\nlet nodeFetch: any;\nlet nodeVmMod: any;\n/** @private */\nexport let nodeFsPromisesMod: any;\n\ndeclare var globalThis: {\n importScripts: (url: string) => void;\n document?: any;\n fetch?: any;\n};\n\n/**\n * If we're in node, it's most convenient to import various node modules on\n * initialization. Otherwise, this does nothing.\n * @private\n */\nexport async function initNodeModules() {\n if (!IN_NODE) {\n return;\n }\n // @ts-ignore\n nodeUrlMod = (await import(\"url\")).default;\n nodeFsPromisesMod = await import(\"fs/promises\");\n if (globalThis.fetch) {\n nodeFetch = fetch;\n } else {\n // @ts-ignore\n nodeFetch = (await import(\"node-fetch\")).default;\n }\n // @ts-ignore\n nodeVmMod = (await import(\"vm\")).default;\n if (typeof require !== \"undefined\") {\n return;\n }\n // Emscripten uses `require`, so if it's missing (because we were imported as\n // an ES6 module) we need to polyfill `require` with `import`. `import` is\n // async and `require` is synchronous, so we import all packages that might be\n // required up front and define require to look them up in this table.\n\n // These are all the packages required in pyodide.asm.js. You can get this\n // list with:\n // $ grep -o 'require(\"[a-z]*\")' pyodide.asm.js | sort -u\n const fs = await import(\"fs\");\n const crypto = await import(\"crypto\");\n const ws = await import(\"ws\");\n const child_process = await import(\"child_process\");\n const node_modules: { [mode: string]: any } = {\n fs,\n crypto,\n ws,\n child_process,\n };\n // Since we're in an ES6 module, this is only modifying the module namespace,\n // it's still private to Pyodide.\n (globalThis as any).require = function (mod: string): any {\n return node_modules[mod];\n };\n}\n\n/**\n * Load a binary file, only for use in Node. If the path explicitly is a URL,\n * then fetch from a URL, else load from the file system.\n * @param indexURL base path to resolve relative paths\n * @param path the path to load\n * @param checksum sha-256 checksum of the package\n * @returns An ArrayBuffer containing the binary data\n * @private\n */\nasync function node_loadBinaryFile(\n indexURL: string,\n path: string,\n _file_sub_resource_hash?: string | undefined // Ignoring sub resource hash. See issue-2431.\n): Promise<Uint8Array> {\n if (!path.startsWith(\"/\") && !path.includes(\"://\")) {\n // If path starts with a \"/\" or starts with a protocol \"blah://\", we\n // interpret it as an absolute path, otherwise \"resolve\" it by\n // joining it with indexURL.\n path = `${indexURL}${path}`;\n }\n if (path.startsWith(\"file://\")) {\n // handle file:// with filesystem operations rather than with fetch.\n path = path.slice(\"file://\".length);\n }\n if (path.includes(\"://\")) {\n // If it has a protocol, make a fetch request\n let response = await nodeFetch(path);\n if (!response.ok) {\n throw new Error(`Failed to load '${path}': request failed.`);\n }\n return new Uint8Array(await response.arrayBuffer());\n } else {\n // Otherwise get it from the file system\n const data = await nodeFsPromisesMod.readFile(path);\n return new Uint8Array(data.buffer, data.byteOffset, data.byteLength);\n }\n}\n\n/**\n * Load a binary file, only for use in browser. Resolves relative paths against\n * indexURL.\n *\n * @param indexURL base path to resolve relative paths\n * @param path the path to load\n * @param subResourceHash the sub resource hash for fetch() integrity check\n * @returns A Uint8Array containing the binary data\n * @private\n */\nasync function browser_loadBinaryFile(\n indexURL: string,\n path: string,\n subResourceHash: string | undefined\n): Promise<Uint8Array> {\n // @ts-ignore\n const base = new URL(indexURL, location);\n const url = new URL(path, base);\n let options = subResourceHash ? { integrity: subResourceHash } : {};\n // @ts-ignore\n let response = await fetch(url, options);\n if (!response.ok) {\n throw new Error(`Failed to load '${url}': request failed.`);\n }\n return new Uint8Array(await response.arrayBuffer());\n}\n\n/** @private */\nexport let loadBinaryFile: (\n indexURL: string,\n path: string,\n file_sub_resource_hash?: string | undefined\n) => Promise<Uint8Array>;\nif (IN_NODE) {\n loadBinaryFile = node_loadBinaryFile;\n} else {\n loadBinaryFile = browser_loadBinaryFile;\n}\n\n/**\n * Currently loadScript is only used once to load `pyodide.asm.js`.\n * @param url\n * @async\n * @private\n */\nexport let loadScript: (url: string) => Promise<void>;\n\nif (globalThis.document) {\n // browser\n loadScript = async (url) => await import(url);\n} else if (globalThis.importScripts) {\n // webworker\n loadScript = async (url) => {\n // This is async only for consistency\n try {\n // use importScripts in classic web worker\n globalThis.importScripts(url);\n } catch (e) {\n // importScripts throws TypeError in a module type web worker, use import instead\n if (e instanceof TypeError) {\n await import(url);\n } else {\n throw e;\n }\n }\n };\n} else if (IN_NODE) {\n loadScript = nodeLoadScript;\n} else {\n throw new Error(\"Cannot determine runtime environment\");\n}\n\n/**\n * Load a text file and executes it as Javascript\n * @param url The path to load. May be a url or a relative file system path.\n * @private\n */\nasync function nodeLoadScript(url: string) {\n if (url.startsWith(\"file://\")) {\n // handle file:// with filesystem operations rather than with fetch.\n url = url.slice(\"file://\".length);\n }\n if (url.includes(\"://\")) {\n // If it's a url, load it with fetch then eval it.\n nodeVmMod.runInThisContext(await (await nodeFetch(url)).text());\n } else {\n // Otherwise, hopefully it is a relative path we can load from the file\n // system.\n await import(nodeUrlMod.pathToFileURL(url).href);\n }\n}\n","/** @private */\nexport interface Module {\n noImageDecoding: boolean;\n noAudioDecoding: boolean;\n noWasmDecoding: boolean;\n preRun: { (): void }[];\n print: (a: string) => void;\n printErr: (a: string) => void;\n ENV: { [key: string]: string };\n preloadedWasm: any;\n FS: any;\n}\n\n/**\n * The Emscripten Module.\n *\n * @private\n */\nexport function createModule(): any {\n let Module: any = {};\n Module.noImageDecoding = true;\n Module.noAudioDecoding = true;\n Module.noWasmDecoding = false; // we preload wasm using the built in plugin now\n Module.preloadedWasm = {};\n Module.preRun = [];\n return Module;\n}\n\n/**\n *\n * @param stdin\n * @param stdout\n * @param stderr\n * @private\n */\nexport function setStandardStreams(\n Module: Module,\n stdin?: () => string,\n stdout?: (a: string) => void,\n stderr?: (a: string) => void\n) {\n // For stdout and stderr, emscripten provides convenient wrappers that save us the trouble of converting the bytes into a string\n if (stdout) {\n Module.print = stdout;\n }\n\n if (stderr) {\n Module.printErr = stderr;\n }\n\n // For stdin, we have to deal with the low level API ourselves\n if (stdin) {\n Module.preRun.push(function () {\n Module.FS.init(createStdinWrapper(stdin), null, null);\n });\n }\n}\n\nfunction createStdinWrapper(stdin: () => string) {\n // When called, it asks the user for one whole line of input (stdin)\n // Then, it passes the individual bytes of the input to emscripten, one after another.\n // And finally, it terminates it with null.\n const encoder = new TextEncoder();\n let input = new Uint8Array(0);\n let inputIndex = -1; // -1 means that we just returned null\n function stdinWrapper() {\n try {\n if (inputIndex === -1) {\n let text = stdin();\n if (text === undefined || text === null) {\n return null;\n }\n if (typeof text !== \"string\") {\n throw new TypeError(\n `Expected stdin to return string, null, or undefined, got type ${typeof text}.`\n );\n }\n if (!text.endsWith(\"\\n\")) {\n text += \"\\n\";\n }\n input = encoder.encode(text);\n inputIndex = 0;\n }\n\n if (inputIndex < input.length) {\n let character = input[inputIndex];\n inputIndex++;\n return character;\n } else {\n inputIndex = -1;\n return null;\n }\n } catch (e) {\n // emscripten will catch this and set an IOError which is unhelpful for\n // debugging.\n console.error(\"Error thrown in stdin:\");\n console.error(e);\n throw e;\n }\n }\n return stdinWrapper;\n}\n\n/**\n * Make the home directory inside the virtual file system,\n * then change the working directory to it.\n *\n * @param path\n * @private\n */\nexport function setHomeDirectory(Module: Module, path: string) {\n Module.preRun.push(function () {\n const fallbackPath = \"/\";\n try {\n Module.FS.mkdirTree(path);\n } catch (e) {\n console.error(`Error occurred while making a home directory '${path}':`);\n console.error(e);\n console.error(`Using '${fallbackPath}' for a home directory instead`);\n path = fallbackPath;\n }\n Module.ENV.HOME = path;\n Module.FS.chdir(path);\n });\n}\n","/**\n * The main bootstrap code for loading pyodide.\n */\nimport ErrorStackParser from \"error-stack-parser\";\nimport { loadScript, loadBinaryFile, initNodeModules } from \"./compat\";\n\nimport { createModule, setStandardStreams, setHomeDirectory } from \"./module\";\n\nimport type { PyodideInterface } from \"./api.js\";\nimport type { PyProxy, PyProxyDict } from \"./pyproxy.gen\";\nexport type { PyodideInterface };\n\nexport type {\n PyProxy,\n PyProxyWithLength,\n PyProxyDict,\n PyProxyWithGet,\n PyProxyWithSet,\n PyProxyWithHas,\n PyProxyIterable,\n PyProxyIterator,\n PyProxyAwaitable,\n PyProxyBuffer,\n PyProxyCallable,\n TypedArray,\n PyBuffer,\n} from \"./pyproxy.gen\";\n\nexport type Py2JsResult = any;\n\n/**\n * A proxy around globals that falls back to checking for a builtin if has or\n * get fails to find a global with the given key. Note that this proxy is\n * transparent to js2python: it won't notice that this wrapper exists at all and\n * will translate this proxy to the globals dictionary.\n * @private\n */\nfunction wrapPythonGlobals(\n globals_dict: PyProxyDict,\n builtins_dict: PyProxyDict\n) {\n return new Proxy(globals_dict, {\n get(target, symbol) {\n if (symbol === \"get\") {\n return (key: any) => {\n let result = target.get(key);\n if (result === undefined) {\n result = builtins_dict.get(key);\n }\n return result;\n };\n }\n if (symbol === \"has\") {\n return (key: any) => target.has(key) || builtins_dict.has(key);\n }\n return Reflect.get(target, symbol);\n },\n });\n}\n\nfunction unpackPyodidePy(Module: any, pyodide_py_tar: Uint8Array) {\n const fileName = \"/pyodide_py.tar\";\n let stream = Module.FS.open(fileName, \"w\");\n Module.FS.write(\n stream,\n pyodide_py_tar,\n 0,\n pyodide_py_tar.byteLength,\n undefined,\n true\n );\n Module.FS.close(stream);\n const code_ptr = Module.stringToNewUTF8(`\nfrom sys import version_info\npyversion = f\"python{version_info.major}.{version_info.minor}\"\nimport shutil\nshutil.unpack_archive(\"/pyodide_py.tar\", f\"/lib/{pyversion}/site-packages/\")\ndel shutil\nimport importlib\nimportlib.invalidate_caches()\ndel importlib\n `);\n let errcode = Module._PyRun_SimpleString(code_ptr);\n if (errcode) {\n throw new Error(\"OOPS!\");\n }\n Module._free(code_ptr);\n Module.FS.unlink(fileName);\n}\n\n/**\n * This function is called after the emscripten module is finished initializing,\n * so eval_code is newly available.\n * It finishes the bootstrap so that once it is complete, it is possible to use\n * the core `pyodide` apis. (But package loading is not ready quite yet.)\n * @private\n */\nfunction finalizeBootstrap(API: any, config: ConfigType) {\n // First make internal dict so that we can use runPythonInternal.\n // runPythonInternal uses a separate namespace, so we don't pollute the main\n // environment with variables from our setup.\n API.runPythonInternal_dict = API._pyodide._base.eval_code(\"{}\") as PyProxy;\n API.importlib = API.runPythonInternal(\"import importlib; importlib\");\n let import_module = API.importlib.import_module;\n\n API.sys = import_module(\"sys\");\n API.sys.path.insert(0, config.homedir);\n\n // Set up globals\n let globals = API.runPythonInternal(\n \"import __main__; __main__.__dict__\"\n ) as PyProxyDict;\n let builtins = API.runPythonInternal(\n \"import builtins; builtins.__dict__\"\n ) as PyProxyDict;\n API.globals = wrapPythonGlobals(globals, builtins);\n\n // Set up key Javascript modules.\n let importhook = API._pyodide._importhook;\n importhook.register_js_finder();\n importhook.register_js_module(\"js\", config.jsglobals);\n\n importhook.register_unvendored_stdlib_finder();\n\n let pyodide = API.makePublicAPI();\n importhook.register_js_module(\"pyodide_js\", pyodide);\n\n // import pyodide_py. We want to ensure that as much stuff as possible is\n // already set up before importing pyodide_py to simplify development of\n // pyodide_py code (Otherwise it's very hard to keep track of which things\n // aren't set up yet.)\n API.pyodide_py = import_module(\"pyodide\");\n API.pyodide_code = import_module(\"pyodide.code\");\n API.pyodide_ffi = import_module(\"pyodide.ffi\");\n API.package_loader = import_module(\"pyodide._package_loader\");\n API.version = API.pyodide_py.__version__;\n\n // copy some last constants onto public API.\n pyodide.pyodide_py = API.pyodide_py;\n pyodide.version = API.version;\n pyodide.globals = API.globals;\n return pyodide;\n}\n\ndeclare function _createPyodideModule(Module: any): Promise<void>;\n\n/**\n * If indexURL isn't provided, throw an error and catch it and then parse our\n * file name out from the stack trace.\n *\n * Question: But getting the URL from error stack trace is well... really\n * hacky. Can't we use\n * [`document.currentScript`](https://developer.mozilla.org/en-US/docs/Web/API/Document/currentScript)\n * or\n * [`import.meta.url`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/import.meta)\n * instead?\n *\n * Answer: `document.currentScript` works for the browser main thread.\n * `import.meta` works for es6 modules. In a classic webworker, I think there\n * is no approach that works. Also we would need some third approach for node\n * when loading a commonjs module using `require`. On the other hand, this\n * stack trace approach works for every case without any feature detection\n * code.\n */\nfunction calculateIndexURL(): string {\n let err: Error;\n try {\n throw new Error();\n } catch (e) {\n err = e as Error;\n }\n let fileName = ErrorStackParser.parse(err)[0].fileName!;\n const indexOfLastSlash = fileName.includes(\"/\")\n ? fileName.lastIndexOf(\"/\")\n : fileName.lastIndexOf(\"\\\\\");\n if (indexOfLastSlash === -1) {\n throw new Error(\n \"Could not extract indexURL path from pyodide module location\"\n );\n }\n return fileName.slice(0, indexOfLastSlash);\n}\n\n/**\n * See documentation for loadPyodide.\n * @private\n */\nexport type ConfigType = {\n indexURL: string;\n lockFileURL: string;\n homedir: string;\n fullStdLib?: boolean;\n stdin?: () => string;\n stdout?: (msg: string) => void;\n stderr?: (msg: string) => void;\n jsglobals?: object;\n};\n\n/**\n * Load the main Pyodide wasm module and initialize it.\n *\n * Only one copy of Pyodide can be loaded in a given JavaScript global scope\n * because Pyodide uses global variables to load packages. If an attempt is made\n * to load a second copy of Pyodide, :any:`loadPyodide` will throw an error.\n * (This can be fixed once `Firefox adopts support for ES6 modules in webworkers\n * <https://bugzilla.mozilla.org/show_bug.cgi?id=1247687>`_.)\n *\n * @returns The :ref:`js-api-pyodide` module.\n * @memberof globalThis\n * @async\n */\nexport async function loadPyodide(\n options: {\n /**\n * The URL from which Pyodide will load the main Pyodide runtime and\n * packages. Defaults to the url that pyodide is loaded from with the file\n * name (pyodide.js or pyodide.mjs) removed. It is recommended that you\n * leave this undefined, providing an incorrect value can cause broken\n * behavior.\n */\n indexURL?: string;\n\n /**\n * The URL from which Pyodide will load the Pyodide \"repodata.json\" lock\n * file. Defaults to ``${indexURL}/repodata.json``. You can produce custom\n * lock files with :any:`micropip.freeze`\n */\n lockFileURL?: string;\n\n /**\n * The home directory which Pyodide will use inside virtual file system. Default: \"/home/pyodide\"\n */\n homedir?: string;\n\n /** Load the full Python standard library.\n * Setting this to false excludes following modules: distutils.\n * Default: true\n */\n fullStdLib?: boolean;\n /**\n * Override the standard input callback. Should ask the user for one line of input.\n */\n stdin?: () => string;\n /**\n * Override the standard output callback.\n * Default: undefined\n */\n stdout?: (msg: string) => void;\n /**\n * Override the standard error output callback.\n * Default: undefined\n */\n stderr?: (msg: string) => void;\n jsglobals?: object;\n } = {}\n): Promise<PyodideInterface> {\n if (!options.indexURL) {\n options.indexURL = calculateIndexURL();\n }\n if (!options.indexURL.endsWith(\"/\")) {\n options.indexURL += \"/\";\n }\n\n const default_config = {\n fullStdLib: true,\n jsglobals: globalThis,\n stdin: globalThis.prompt ? globalThis.prompt : undefined,\n homedir: \"/home/pyodide\",\n lockFileURL: options.indexURL! + \"repodata.json\",\n };\n const config = Object.assign(default_config, options) as ConfigType;\n await initNodeModules();\n const pyodide_py_tar_promise = loadBinaryFile(\n config.indexURL,\n \"pyodide_py.tar\"\n );\n\n const Module = createModule();\n const API: any = { config };\n Module.API = API;\n\n setStandardStreams(Module, config.stdin, config.stdout, config.stderr);\n setHomeDirectory(Module, config.homedir);\n\n const moduleLoaded = new Promise((r) => (Module.postRun = r));\n\n // locateFile tells Emscripten where to find the data files that initialize\n // the file system.\n Module.locateFile = (path: string) => config.indexURL + path;\n const scriptSrc = `${config.indexURL}pyodide.asm.js`;\n await loadScript(scriptSrc);\n\n // _createPyodideModule is specified in the Makefile by the linker flag:\n // `-s EXPORT_NAME=\"'_createPyodideModule'\"`\n await _createPyodideModule(Module);\n\n // There is some work to be done between the module being \"ready\" and postRun\n // being called.\n await moduleLoaded;\n\n // Disable further loading of Emscripten file_packager stuff.\n Module.locateFile = (path: string) => {\n throw new Error(\"Didn't expect to load any more file_packager files!\");\n };\n\n const pyodide_py_tar = await pyodide_py_tar_promise;\n unpackPyodidePy(Module, pyodide_py_tar);\n Module._pyodide_init();\n\n const pyodide = finalizeBootstrap(API, config);\n // API.runPython works starting here.\n if (!pyodide.version.includes(\"dev\")) {\n // Currently only used in Node to download packages the first time they are\n // loaded. But in other cases it's harmless.\n API.setCdnUrl(`https://cdn.jsdelivr.net/pyodide/v${pyodide.version}/full/`);\n }\n await API.packageIndexReady;\n if (API.repodata_info.version !== pyodide.version) {\n throw new Error(\"Lock file version doesn't match Pyodide version\");\n }\n if (config.fullStdLib) {\n await pyodide.loadPackage([\"distutils\"]);\n }\n pyodide.runPython(\"print('Python initialization complete')\");\n return pyodide;\n}\n"],"names":["StackFrame","FIREFOX_SAFARI_STACK_REGEXP","CHROME_IE_STACK_REGEXP","SAFARI_NATIVE_CODE_REGEXP","_isNumber","n","isNaN","parseFloat","isFinite","_capitalize","str","charAt","toUpperCase","substring","_getter","p","this","booleanProps","numericProps","stringProps","arrayProps","objectProps","props","concat","obj","i","length","undefined","prototype","getArgs","args","setArgs","v","Object","toString","call","TypeError","getEvalOrigin","evalOrigin","setEvalOrigin","fileName","getFileName","lineNumber","getLineNumber","columnNumber","getColumnNumber","functionName","getFunctionName","getIsEval","fromString","argsStartIndex","indexOf","argsEndIndex","lastIndexOf","split","locationString","parts","exec","Boolean","j","Number","k","String","factory","require$$0","parse","error","stacktrace","parseOpera","stack","match","parseV8OrIE","parseFFOrSafari","Error","extractLocation","urlLike","replace","filter","line","map","sanitizedLine","location","locationParts","source","functionNameRegex","matches","e","message","parseOpera9","parseOpera11","parseOpera10","lineRE","lines","result","len","push","argsRaw","tokens","pop","functionCall","shift","IN_NODE","process","release","name","browser","nodeUrlMod","nodeFetch","nodeVmMod","nodeFsPromisesMod","loadBinaryFile","loadScript","async","indexURL","path","_file_sub_resource_hash","startsWith","includes","slice","response","ok","Uint8Array","arrayBuffer","data","readFile","buffer","byteOffset","byteLength","subResourceHash","base","URL","url","options","integrity","fetch","globalThis","document","import","importScripts","runInThisContext","text","pathToFileURL","href","setStandardStreams","Module","stdin","stdout","stderr","print","printErr","preRun","FS","init","encoder","TextEncoder","input","inputIndex","stdinWrapper","endsWith","encode","character","console","createStdinWrapper","finalizeBootstrap","API","config","runPythonInternal_dict","_pyodide","_base","eval_code","importlib","runPythonInternal","import_module","sys","insert","homedir","globals","builtins","builtins_dict","Proxy","get","target","symbol","key","has","Reflect","importhook","_importhook","register_js_finder","register_js_module","jsglobals","register_unvendored_stdlib_finder","pyodide","makePublicAPI","pyodide_py","pyodide_code","pyodide_ffi","package_loader","version","__version__","loadPyodide","err","ErrorStackParser","indexOfLastSlash","calculateIndexURL","default_config","fullStdLib","prompt","lockFileURL","assign","default","require","node_modules","fs","crypto","ws","child_process","mod","initNodeModules","pyodide_py_tar_promise","mkdirTree","ENV","HOME","chdir","setHomeDirectory","moduleLoaded","Promise","r","postRun","locateFile","scriptSrc","_createPyodideModule","pyodide_py_tar","stream","open","write","close","code_ptr","stringToNewUTF8","_PyRun_SimpleString","_free","unlink","unpackPyodidePy","_pyodide_init","setCdnUrl","packageIndexReady","repodata_info","loadPackage","runPython"],"mappings":"iJAYkCA,WAG1BC,4BACAC,uBACAC,mGCLA,WAEJ,SAASC,UAAUC,GACf,OAAQC,MAAMC,WAAWF,KAAOG,SAASH,GAG7C,SAASI,YAAYC,KACjB,OAAOA,IAAIC,OAAO,GAAGC,cAAgBF,IAAIG,UAAU,GAGvD,SAASC,QAAQC,GACb,OAAO,WACH,OAAOC,KAAKD,IAIpB,IAAIE,aAAe,CAAC,gBAAiB,SAAU,WAAY,cACvDC,aAAe,CAAC,eAAgB,cAChCC,YAAc,CAAC,WAAY,eAAgB,UAC3CC,WAAa,CAAC,QACdC,YAAc,CAAC,cAEfC,MAAQL,aAAaM,OAAOL,aAAcC,YAAaC,WAAYC,aAEvE,SAASrB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