UNPKG

pyodide

Version:

The Pyodide JavaScript package

10 lines (8 loc) 1.25 MB
"use strict"; var _createPyodideModule = (() => { var _scriptName = typeof document != 'undefined' ? document.currentScript?.src : undefined; if (typeof __filename != 'undefined') _scriptName ||= __filename; return ( function(moduleArg = {}) { var moduleRtn; var Module=Object.assign({},moduleArg);var readyPromiseResolve,readyPromiseReject;var readyPromise=new Promise((resolve,reject)=>{readyPromiseResolve=resolve;readyPromiseReject=reject});var ENVIRONMENT_IS_WEB=typeof window=="object";var ENVIRONMENT_IS_WORKER=typeof importScripts=="function";var ENVIRONMENT_IS_NODE=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string";var ENVIRONMENT_IS_SHELL=!ENVIRONMENT_IS_WEB&&!ENVIRONMENT_IS_NODE&&!ENVIRONMENT_IS_WORKER;if(ENVIRONMENT_IS_NODE){}var moduleOverrides=Object.assign({},Module);var arguments_=[];var thisProgram="./this.program";var quit_=(status,toThrow)=>{throw toThrow};var scriptDirectory="";function locateFile(path){if(Module["locateFile"]){return Module["locateFile"](path,scriptDirectory)}return scriptDirectory+path}var read_,readAsync,readBinary;if(ENVIRONMENT_IS_NODE){var fs=require("fs");var nodePath=require("path");if(ENVIRONMENT_IS_WORKER){scriptDirectory=nodePath.dirname(scriptDirectory)+"/"}else{scriptDirectory=__dirname+"/"}read_=(filename,binary)=>{filename=isFileURI(filename)?new URL(filename):nodePath.normalize(filename);return fs.readFileSync(filename,binary?undefined:"utf8")};readBinary=filename=>{var ret=read_(filename,true);if(!ret.buffer){ret=new Uint8Array(ret)}return ret};readAsync=(filename,onload,onerror,binary=true)=>{filename=isFileURI(filename)?new URL(filename):nodePath.normalize(filename);fs.readFile(filename,binary?undefined:"utf8",(err,data)=>{if(err)onerror(err);else onload(binary?data.buffer:data)})};if(!Module["thisProgram"]&&process.argv.length>1){thisProgram=process.argv[1].replace(/\\/g,"/")}arguments_=process.argv.slice(2);quit_=(status,toThrow)=>{process.exitCode=status;throw toThrow}}else if(ENVIRONMENT_IS_WEB||ENVIRONMENT_IS_WORKER){if(ENVIRONMENT_IS_WORKER){scriptDirectory=self.location.href}else if(typeof document!="undefined"&&document.currentScript){scriptDirectory=document.currentScript.src}if(_scriptName){scriptDirectory=_scriptName}if(scriptDirectory.startsWith("blob:")){scriptDirectory=""}else{scriptDirectory=scriptDirectory.substr(0,scriptDirectory.replace(/[?#].*/,"").lastIndexOf("/")+1)}{read_=url=>{var xhr=new XMLHttpRequest;xhr.open("GET",url,false);xhr.send(null);return xhr.responseText};if(ENVIRONMENT_IS_WORKER){readBinary=url=>{var xhr=new XMLHttpRequest;xhr.open("GET",url,false);xhr.responseType="arraybuffer";xhr.send(null);return new Uint8Array(xhr.response)}}readAsync=(url,onload,onerror)=>{var xhr=new XMLHttpRequest;xhr.open("GET",url,true);xhr.responseType="arraybuffer";xhr.onload=()=>{if(xhr.status==200||xhr.status==0&&xhr.response){onload(xhr.response);return}onerror()};xhr.onerror=onerror;xhr.send(null)}}}else{}var out=Module["print"]||console.log.bind(console);var err=Module["printErr"]||console.error.bind(console);Object.assign(Module,moduleOverrides);moduleOverrides=null;if(Module["arguments"])arguments_=Module["arguments"];if(Module["thisProgram"])thisProgram=Module["thisProgram"];if(Module["quit"])quit_=Module["quit"];if(!Module.wrapException){Module.wrapException=e=>e}var dynamicLibraries=Module["dynamicLibraries"]||[];var wasmBinary;if(Module["wasmBinary"])wasmBinary=Module["wasmBinary"];function intArrayFromBase64(s){if(typeof ENVIRONMENT_IS_NODE!="undefined"&&ENVIRONMENT_IS_NODE){var buf=Buffer.from(s,"base64");return new Uint8Array(buf.buffer,buf.byteOffset,buf.length)}var decoded=atob(s);var bytes=new Uint8Array(decoded.length);for(var i=0;i<decoded.length;++i){bytes[i]=decoded.charCodeAt(i)}return bytes}function tryParseAsDataURI(filename){if(!isDataURI(filename)){return}return intArrayFromBase64(filename.slice(dataURIPrefix.length))}var wasmMemory;var ABORT=false;var EXITSTATUS;function assert(condition,text){if(!condition){abort(text)}}var HEAP,HEAP8,HEAPU8,HEAP16,HEAPU16,HEAP32,HEAPU32,HEAPF32,HEAP64,HEAPU64,HEAPF64;function updateMemoryViews(){var b=wasmMemory.buffer;Module["HEAP8"]=HEAP8=new Int8Array(b);Module["HEAP16"]=HEAP16=new Int16Array(b);Module["HEAPU8"]=HEAPU8=new Uint8Array(b);Module["HEAPU16"]=HEAPU16=new Uint16Array(b);Module["HEAP32"]=HEAP32=new Int32Array(b);Module["HEAPU32"]=HEAPU32=new Uint32Array(b);Module["HEAPF32"]=HEAPF32=new Float32Array(b);Module["HEAPF64"]=HEAPF64=new Float64Array(b);Module["HEAP64"]=HEAP64=new BigInt64Array(b);Module["HEAPU64"]=HEAPU64=new BigUint64Array(b)}if(Module["wasmMemory"]){wasmMemory=Module["wasmMemory"]}else{var INITIAL_MEMORY=Module["INITIAL_MEMORY"]||20971520;wasmMemory=new WebAssembly.Memory({"initial":INITIAL_MEMORY/65536,"maximum":4294967296/65536})}updateMemoryViews();var __ATPRERUN__=[];var __ATINIT__=[];var __ATMAIN__=[];var __ATEXIT__=[];var __ATPOSTRUN__=[];var __RELOC_FUNCS__=[];var runtimeInitialized=false;function preRun(){if(Module["preRun"]){if(typeof Module["preRun"]=="function")Module["preRun"]=[Module["preRun"]];while(Module["preRun"].length){addOnPreRun(Module["preRun"].shift())}}callRuntimeCallbacks(__ATPRERUN__)}function initRuntime(){runtimeInitialized=true;callRuntimeCallbacks(__RELOC_FUNCS__);if(!Module["noFSInit"]&&!FS.init.initialized)FS.init();FS.ignorePermissions=false;TTY.init();SOCKFS.root=FS.mount(SOCKFS,{},null);PIPEFS.root=FS.mount(PIPEFS,{},null);callRuntimeCallbacks(__ATINIT__)}function preMain(){callRuntimeCallbacks(__ATMAIN__)}function postRun(){if(Module["postRun"]){if(typeof Module["postRun"]=="function")Module["postRun"]=[Module["postRun"]];while(Module["postRun"].length){addOnPostRun(Module["postRun"].shift())}}callRuntimeCallbacks(__ATPOSTRUN__)}function addOnPreRun(cb){__ATPRERUN__.unshift(cb)}function addOnInit(cb){__ATINIT__.unshift(cb)}function addOnPreMain(cb){__ATMAIN__.unshift(cb)}function addOnExit(cb){}function addOnPostRun(cb){__ATPOSTRUN__.unshift(cb)}var runDependencies=0;var runDependencyWatcher=null;var dependenciesFulfilled=null;function getUniqueRunDependency(id){return id}function addRunDependency(id){runDependencies++;Module["monitorRunDependencies"]?.(runDependencies)}function removeRunDependency(id){runDependencies--;Module["monitorRunDependencies"]?.(runDependencies);if(runDependencies==0){if(runDependencyWatcher!==null){clearInterval(runDependencyWatcher);runDependencyWatcher=null}if(dependenciesFulfilled){var callback=dependenciesFulfilled;dependenciesFulfilled=null;callback()}}}function abort(what){Module["onAbort"]?.(what);what="Aborted("+what+")";err(what);ABORT=true;EXITSTATUS=1;what+=". Build with -sASSERTIONS for more info.";var e=new WebAssembly.RuntimeError(what);readyPromiseReject(e);throw e}var dataURIPrefix="data:application/octet-stream;base64,";var isDataURI=filename=>filename.startsWith(dataURIPrefix);var isFileURI=filename=>filename.startsWith("file://");var wasmBinaryFile;wasmBinaryFile="pyodide.asm.wasm";if(!isDataURI(wasmBinaryFile)){wasmBinaryFile=locateFile(wasmBinaryFile)}function getBinarySync(file){if(file==wasmBinaryFile&&wasmBinary){return new Uint8Array(wasmBinary)}if(readBinary){return readBinary(file)}throw"both async and sync fetching of the wasm failed"}function getBinaryPromise(binaryFile){if(!wasmBinary&&(ENVIRONMENT_IS_WEB||ENVIRONMENT_IS_WORKER)){if(typeof fetch=="function"&&!isFileURI(binaryFile)){return fetch(binaryFile,{credentials:"same-origin"}).then(response=>{if(!response["ok"]){throw`failed to load wasm binary file at '${binaryFile}'`}return response["arrayBuffer"]()}).catch(()=>getBinarySync(binaryFile))}else if(readAsync){return new Promise((resolve,reject)=>{readAsync(binaryFile,response=>resolve(new Uint8Array(response)),reject)})}}return Promise.resolve().then(()=>getBinarySync(binaryFile))}function instantiateArrayBuffer(binaryFile,imports,receiver){return getBinaryPromise(binaryFile).then(binary=>WebAssembly.instantiate(binary,imports)).then(receiver,reason=>{err(`failed to asynchronously prepare wasm: ${reason}`);abort(reason)})}function instantiateAsync(binary,binaryFile,imports,callback){if(!binary&&typeof WebAssembly.instantiateStreaming=="function"&&!isDataURI(binaryFile)&&!isFileURI(binaryFile)&&!ENVIRONMENT_IS_NODE&&typeof fetch=="function"){return fetch(binaryFile,{credentials:"same-origin"}).then(response=>{var result=WebAssembly.instantiateStreaming(response,imports);return result.then(callback,function(reason){err(`wasm streaming compile failed: ${reason}`);err("falling back to ArrayBuffer instantiation");return instantiateArrayBuffer(binaryFile,imports,callback)})})}return instantiateArrayBuffer(binaryFile,imports,callback)}function getWasmImports(){return{"env":wasmImports,"wasi_snapshot_preview1":wasmImports,"GOT.mem":new Proxy(wasmImports,GOTHandler),"GOT.func":new Proxy(wasmImports,GOTHandler)}}function createWasm(){var info=getWasmImports();if(Module.adjustWasmImports){Module.adjustWasmImports(info)}function receiveInstance(instance,module){wasmExports=instance.exports;wasmExports=relocateExports(wasmExports,1024);var metadata=getDylinkMetadata(module);if(metadata.neededDynlibs){dynamicLibraries=metadata.neededDynlibs.concat(dynamicLibraries)}mergeLibSymbols(wasmExports,"main");LDSO.init();loadDylibs();wasmExports=applySignatureConversions(wasmExports);addOnInit(wasmExports["__wasm_call_ctors"]);__RELOC_FUNCS__.push(wasmExports["__wasm_apply_data_relocs"]);removeRunDependency("wasm-instantiate");return wasmExports}addRunDependency("wasm-instantiate");function receiveInstantiationResult(result){receiveInstance(result["instance"],result["module"])}if(Module["instantiateWasm"]){try{return Module["instantiateWasm"](info,receiveInstance)}catch(e){err(`Module.instantiateWasm callback failed with error: ${e}`);readyPromiseReject(e)}}instantiateAsync(wasmBinary,wasmBinaryFile,info,receiveInstantiationResult).catch(readyPromiseReject);return{}}var ASM_CONSTS={4580244:()=>{throw new Error("intentionally triggered fatal error!")},4580301:()=>{wasmImports["open64"]=wasmImports["open"]},4580350:()=>jspiSupported};function console_error(msg){let jsmsg=UTF8ToString(msg);console.error(jsmsg)}function console_error_obj(obj){console.error(obj)}function new_error(type,msg,err){return new API.PythonError(UTF8ToString(type),msg,err)}new_error.sig="eiei";function fail_test(){API.fail_test=true}fail_test.sig="v";function capture_stderr(){API.capture_stderr()}capture_stderr.sig="v";function restore_stderr(){return API.restore_stderr()}restore_stderr.sig="e";function raw_call_js(func){func()}raw_call_js.sig="ve";function hiwire_invalid_ref(type,ref){API.fail_test=!!1;if(type===1&&!ref){if(_PyErr_Occurred()){const e=_wrap_exception();console.error("Pyodide internal error: Argument to hiwire_get is falsy. This was "+"probably because the Python error indicator was set when get_value was "+"called. The Python error that caused this was:",e);throw e}else{const msg="Pyodide internal error: Argument to hiwire_get is falsy (but error "+"indicator is not set).";console.error(msg);throw new Error(msg)}}const typestr={[1]:"get",[2]:"incref",[3]:"decref"}[type];const msg=`hiwire_${typestr} on invalid reference ${ref}. This is most likely due `+"to use after free. It may also be due to memory corruption.";console.error(msg);throw new Error(msg)}hiwire_invalid_ref.sig="vii";function set_pyodide_module(mod){API._pyodide=mod}set_pyodide_module.sig="ve";function js2python_immutable_js(value){try{let result=Module.js2python_convertImmutable(value);if(result!==undefined){return result}return 0}catch(e){Module.handle_js_error(e);return 0}errNoRet()}js2python_immutable_js.sig="ie";function js2python_js(value){try{let result=Module.js2python_convertImmutable(value);if(result!==undefined){return result}return _JsProxy_create(value)}catch(e){Module.handle_js_error(e);return 0}errNoRet()}js2python_js.sig="ie";function js2python_convert(v,depth,defaultConverter){try{return Module.js2python_convert(v,{depth:depth,defaultConverter:defaultConverter})}catch(e){Module.handle_js_error(e);return 0}errNoRet()}js2python_convert.sig="ieie";function isReservedWord(word){if(!Module.pythonReservedWords){Module.pythonReservedWords=new Set(["False","await","else","import","pass","None","break","except","in","raise","True","class","finally","is","return","and","continue","for","lambda","try","as","def","from","nonlocal","while","assert","del","global","not","with","async","elif","if","or","yield"])}return Module.pythonReservedWords.has(word)}function normalizeReservedWords(word){const noTrailing_=word.replace(/_*$/,"");if(!isReservedWord(noTrailing_)){return word}if(noTrailing_!==word){return word.slice(0,-1)}return word}function JsProxy_GetAttr_js(jsobj,ptrkey){try{const jskey=normalizeReservedWords(UTF8ToString(ptrkey));const result=jsobj[jskey];if(result===undefined&&!(jskey in jsobj)){return null}return nullToUndefined(result)}catch(e){Module.handle_js_error(e);return null}errNoRet()}JsProxy_GetAttr_js.sig="eei";function JsProxy_SetAttr_js(jsobj,ptrkey,jsval){try{let jskey=normalizeReservedWords(UTF8ToString(ptrkey));jsobj[jskey]=jsval}catch(e){Module.handle_js_error(e);return-1}return 0}JsProxy_SetAttr_js.sig="ieie";function JsProxy_DelAttr_js(jsobj,ptrkey){try{let jskey=normalizeReservedWords(UTF8ToString(ptrkey));delete jsobj[jskey]}catch(e){Module.handle_js_error(e);return-1}return 0}JsProxy_DelAttr_js.sig="iei";function JsProxy_GetIter_js(obj){try{return obj[Symbol.iterator]()}catch(e){Module.handle_js_error(e);return null}errNoRet()}JsProxy_GetIter_js.sig="ee";function handle_next_result_js(res,done,msg){try{let errmsg;if(typeof res!=="object"){errmsg=`Result should have type "object" not "${typeof res}"`}else if(typeof res.done==="undefined"){if(typeof res.then==="function"){errmsg=`Result was a promise, use anext() / asend() / athrow() instead.`}else{errmsg=`Result has no "done" field.`}}if(errmsg){HEAPU32[(msg>>2)+0>>>0]=stringToNewUTF8(errmsg);HEAPU32[(done>>2)+0>>>0]=-1}HEAPU32[(done>>2)+0>>>0]=res.done;return res.value}catch(e){Module.handle_js_error(e);return-1}return 0}handle_next_result_js.sig="eeii";function JsException_new_helper(name_ptr,message_ptr,stack_ptr){try{let name=UTF8ToString(name_ptr);let message=UTF8ToString(message_ptr);let stack=UTF8ToString(stack_ptr);return API.deserializeError(name,message,stack)}catch(e){Module.handle_js_error(e);return null}errNoRet()}JsException_new_helper.sig="eiii";function JsProxy_GetAsyncIter_js(obj){try{return obj[Symbol.asyncIterator]()}catch(e){Module.handle_js_error(e);return null}errNoRet()}JsProxy_GetAsyncIter_js.sig="ee";function _agen_handle_result_js(p,msg,set_result,set_exception,closing){try{let errmsg;if(typeof p!=="object"){errmsg=`Result of anext() should be object not ${typeof p}`}else if(typeof p.then!=="function"){if(typeof p.done==="boolean"){errmsg=`Result of anext() was not a promise, use next() instead.`}else{errmsg=`Result of anext() was not a promise.`}}if(errmsg){HEAPU32[(msg>>2)+0>>>0]=stringToNewUTF8(errmsg);return-1}_Py_IncRef(set_result);_Py_IncRef(set_exception);p.then(({done:done,value:value})=>{__agen_handle_result_js_c(set_result,set_exception,done,value,closing)},err=>{__agen_handle_result_js_c(set_result,set_exception,-1,err,closing)}).finally(()=>{_Py_DecRef(set_result);_Py_DecRef(set_exception)});return 0}catch(e){Module.handle_js_error(e);return-1}return 0}_agen_handle_result_js.sig="ieiiii";function get_length_helper(val){try{let result;if(typeof val.size==="number"){result=val.size}else if(typeof val.length==="number"){result=val.length}else{return-2}if(result<0){return-3}if(result>2147483647){return-4}return result}catch(e){Module.handle_js_error(e);return-1}return 0}get_length_helper.sig="ie";function get_length_string(val){try{let result;if(typeof val.size==="number"){result=val.size}else if(typeof val.length==="number"){result=val.length}return stringToNewUTF8(" "+result.toString())}catch(e){Module.handle_js_error(e);return 0}errNoRet()}get_length_string.sig="ie";function destroy_jsarray_entries(array){for(let v of array){try{if(typeof v.destroy==="function"){v.destroy()}}catch(e){console.warn("Weird error:",e)}}}destroy_jsarray_entries.sig="ve";function JsArray_repeat_js(o,count){try{return Array.from({length:count},()=>o).flat()}catch(e){Module.handle_js_error(e);return null}errNoRet()}JsArray_repeat_js.sig="eei";function JsArray_inplace_repeat_js(o,count){try{o.splice(0,o.length,...Array.from({length:count},()=>o).flat())}catch(e){Module.handle_js_error(e);return-1}return 0}JsArray_inplace_repeat_js.sig="iei";function JsArray_reversed_iterator(array){return new ReversedIterator(array)}class ReversedIterator{constructor(array){this._array=array;this._i=array.length-1}__length_hint__(){return this._array.length}[Symbol.toStringTag](){return"ReverseIterator"}next(){const i=this._i;const a=this._array;const done=i<0;const value=done?undefined:a[i];this._i--;return{done:done,value:value}}}JsArray_reversed_iterator.sig="ee";function JsArray_index_js(o,v,start,stop){try{for(let i=start;i<stop;i++){if(o[i]===v){return i}}return-1}catch(e){Module.handle_js_error(e);return-1}return 0}JsArray_index_js.sig="ieeii";function JsArray_count_js(o,v){try{let result=0;for(let i=0;i<o.length;i++){if(o[i]===v){result++}}return result}catch(e){Module.handle_js_error(e);return-1}return 0}JsArray_count_js.sig="iee";function JsArray_reverse_js(array){try{array.reverse()}catch(e){Module.handle_js_error(e);return-1}return 0}JsArray_reverse_js.sig="ie";function JsProxy_subscript_js(obj,key){try{let result=obj.get(key);if(result===undefined){if(obj.has&&typeof obj.has==="function"&&!obj.has(key)){return null}}return nullToUndefined(result)}catch(e){Module.handle_js_error(e);return null}errNoRet()}JsProxy_subscript_js.sig="eee";function JsMap_GetIter_js(obj){try{let result;if(typeof obj.keys==="function"){result=obj.keys()}else{result=obj[Symbol.iterator]()}return result}catch(e){Module.handle_js_error(e);return null}errNoRet()}JsMap_GetIter_js.sig="ee";function JsMap_clear_js(map){try{if(map&&typeof map.clear==="function"){map.clear();return 1}return 0}catch(e){Module.handle_js_error(e);return-1}return 0}JsMap_clear_js.sig="ie";function JsProxy_Dir_js(jsobj){try{let result=[];do{const names=Object.getOwnPropertyNames(jsobj);result.push(...names.filter(s=>{let c=s.charCodeAt(0);return c<48||c>57}).map(word=>isReservedWord(word.replace(/_*$/,""))?word+"_":word))}while(jsobj=Object.getPrototypeOf(jsobj));return result}catch(e){Module.handle_js_error(e);return null}errNoRet()}JsProxy_Dir_js.sig="ee";function JsProxy_Bool_js(val){try{if(!val){return!!0}if(val.size===0){if(/HTML[A-Za-z]*Element/.test(getTypeTag(val))){return!!1}return!!0}if(val.length===0&&JsvArray_Check(val)){return!!0}if(val.byteLength===0){return!!0}return!!1}catch(e){return!!0}}JsProxy_Bool_js.sig="ie";function JsObjMap_GetIter_js(obj){try{return Module.iterObject(obj)}catch(e){Module.handle_js_error(e);return null}errNoRet()}JsObjMap_GetIter_js.sig="ee";function JsObjMap_length_js(obj){try{let length=0;for(let _ of Module.iterObject(obj)){length++}return length}catch(e){Module.handle_js_error(e);return-1}return 0}JsObjMap_length_js.sig="ie";function JsObjMap_subscript_js(obj,key){try{if(!Object.prototype.hasOwnProperty.call(obj,key)){return null}return obj[key]}catch(e){Module.handle_js_error(e);return null}errNoRet()}JsObjMap_subscript_js.sig="eee";function JsObjMap_ass_subscript_js(obj,key,value){try{if(value===null){if(!Object.prototype.hasOwnProperty.call(obj,key)){return-1}delete obj[key]}else{obj[key]=value}return 0}catch(e){Module.handle_js_error(e);return-1}return 0}JsObjMap_ass_subscript_js.sig="ieee";function JsObjMap_contains_js(obj,key){try{return Object.prototype.hasOwnProperty.call(obj,key)}catch(e){Module.handle_js_error(e);return-1}return 0}JsObjMap_contains_js.sig="iee";function JsModule_GetAll_js(o){try{return Object.getOwnPropertyNames(o)}catch(e){Module.handle_js_error(e);return null}errNoRet()}JsModule_GetAll_js.sig="ee";function JsBuffer_DecodeString_js(buffer,encoding){try{let encoding_js;if(encoding){encoding_js=UTF8ToString(encoding)}const decoder=new TextDecoder(encoding_js,{fatal:!!1,ignoreBOM:!!1});let res;try{res=decoder.decode(buffer)}catch(e){if(e instanceof TypeError){return null}throw e}return res}catch(e){Module.handle_js_error(e);return null}errNoRet()}JsBuffer_DecodeString_js.sig="eei";function JsBuffer_get_info(jsobj,byteLength_ptr,format_ptr,size_ptr,checked_ptr){const[format_utf8,size,checked]=Module.get_buffer_datatype(jsobj);HEAPU32[(byteLength_ptr>>2)+0>>>0]=jsobj.byteLength;HEAPU32[(format_ptr>>2)+0>>>0]=format_utf8;HEAPU32[(size_ptr>>2)+0>>>0]=size;HEAPU8[checked_ptr+0>>>0]=checked}JsBuffer_get_info.sig="veiiii";function JsDoubleProxy_unwrap_helper(id){try{return Module.PyProxy_getPtr(id)}catch(e){Module.handle_js_error(e);return 0}errNoRet()}JsDoubleProxy_unwrap_helper.sig="ie";function JsProxy_compute_typeflags(obj,is_py_json){try{let type_flags=0;if(API.isPyProxy(obj)&&!pyproxyIsAlive(obj)){return 0}const typeTag=getTypeTag(obj);function safeBool(cb){try{return cb()}catch(e){return!!0}}const isBufferView=safeBool(()=>ArrayBuffer.isView(obj));const isArray=safeBool(()=>Array.isArray(obj));const constructorName=safeBool(()=>obj.constructor.name)||"";if(typeof obj==="function"){type_flags|=1<<9}if(hasMethod(obj,"then")){type_flags|=1<<7}if(hasMethod(obj,Symbol.iterator)){type_flags|=1<<0}if(hasMethod(obj,Symbol.asyncIterator)){type_flags|=1<<15}if(hasMethod(obj,"next")&&(hasMethod(obj,Symbol.iterator)||!hasMethod(obj,Symbol.asyncIterator))){type_flags|=1<<1}if(hasMethod(obj,"next")&&(!hasMethod(obj,Symbol.iterator)||hasMethod(obj,Symbol.asyncIterator))){type_flags|=1<<18}if(hasProperty(obj,"size")||hasProperty(obj,"length")&&typeof obj!=="function"){type_flags|=1<<2}if(hasMethod(obj,"get")){type_flags|=1<<3}if(hasMethod(obj,"set")){type_flags|=1<<4}if(hasMethod(obj,"has")){type_flags|=1<<5}if(hasMethod(obj,"includes")){type_flags|=1<<6}if((isBufferView||typeTag==="[object ArrayBuffer]")&&!(type_flags&1<<9)){type_flags|=1<<8}if(API.isPyProxy(obj)){type_flags|=1<<13}if(isArray){type_flags|=1<<10}if(typeTag==="[object HTMLCollection]"||typeTag==="[object NodeList]"){type_flags|=1<<11}if(isBufferView&&typeTag!=="[object DataView]"){type_flags|=1<<12}if(typeTag==="[object Generator]"){type_flags|=1<<16}if(typeTag==="[object AsyncGenerator]"){type_flags|=1<<17}if(hasProperty(obj,"name")&&hasProperty(obj,"message")&&(hasProperty(obj,"stack")||constructorName==="DOMException")&&!(type_flags&(1<<9|1<<8))){type_flags|=1<<19}if(is_py_json&&type_flags&(1<<10|1<<11|1<<1)){type_flags|=1<<21}if(is_py_json&&!(type_flags&(1<<10|1<<12|1<<11|1<<8|1<<13|1<<1|1<<9|1<<19))){type_flags|=1<<20}return type_flags}catch(e){Module.handle_js_error(e);return-1}return 0}JsProxy_compute_typeflags.sig="iei";function is_comlink_proxy(obj){try{return!!(API.Comlink&&value[API.Comlink.createEndpoint])}catch(e){return!!0}}is_comlink_proxy.sig="ie";function can_run_sync_js(){return!!validSuspender.value}can_run_sync_js.sig="i";function my_dict_converter(){return Object.fromEntries}my_dict_converter.sig="e";function get_async_js_call_done_callback(proxies){try{return function(result){let msg="This borrowed proxy was automatically destroyed "+"at the end of an asynchronous function call. Try "+"using create_proxy or create_once_callable.";for(let px of proxies){Module.pyproxy_destroy(px,msg,!!0)}if(API.isPyProxy(result)){Module.pyproxy_destroy(result,msg,!!0)}}}catch(e){Module.handle_js_error(e);return null}errNoRet()}get_async_js_call_done_callback.sig="ee";function wrap_generator(gen,proxies){try{proxies=new Set(proxies);const msg="This borrowed proxy was automatically destroyed "+"when a generator completed execution. Try "+"using create_proxy or create_once_callable.";function cleanup(){proxies.forEach(px=>Module.pyproxy_destroy(px,msg))}function wrap(funcname){return function(val){if(API.isPyProxy(val)){val=val.copy();proxies.add(val)}let res;try{res=gen[funcname](val)}catch(e){cleanup();throw e}if(res.done){proxies.delete(res.value);cleanup()}return res}}return{get[Symbol.toStringTag](){return"Generator"},[Symbol.iterator](){return this},next:wrap("next"),throw:wrap("throw"),return:wrap("return")}}catch(e){Module.handle_js_error(e);return null}errNoRet()}wrap_generator.sig="eee";function wrap_async_generator(gen,proxies){try{proxies=new Set(proxies);const msg="This borrowed proxy was automatically destroyed "+"when an asynchronous generator completed execution. Try "+"using create_proxy or create_once_callable.";function cleanup(){proxies.forEach(px=>Module.pyproxy_destroy(px,msg))}function wrap(funcname){return async function(val){if(API.isPyProxy(val)){val=val.copy();proxies.add(val)}let res;try{res=await gen[funcname](val)}catch(e){cleanup();throw e}if(res.done){proxies.delete(res.value);cleanup()}return res}}return{get[Symbol.toStringTag](){return"AsyncGenerator"},[Symbol.asyncIterator](){return this},next:wrap("next"),throw:wrap("throw"),return:wrap("return")}}catch(e){Module.handle_js_error(e);return null}errNoRet()}wrap_async_generator.sig="eee";function throw_no_gil(){throw new API.NoGilError("Attempted to use PyProxy when Python GIL not held")}throw_no_gil.sig="v";function pyproxy_Check(val){return API.isPyProxy(val)}pyproxy_Check.sig="ie";function pyproxy_AsPyObject(val){if(!API.isPyProxy(val)||!pyproxyIsAlive(val)){return 0}return Module.PyProxy_getPtr(val)}pyproxy_AsPyObject.sig="ie";function destroy_proxies(proxies,msg_ptr){let msg=undefined;if(msg_ptr){msg=_JsvString_FromId(msg_ptr)}for(let px of proxies){Module.pyproxy_destroy(px,msg,false)}}destroy_proxies.sig="vei";function gc_register_proxies(proxies){for(let px of proxies){Module.gc_register_proxy(Module.PyProxy_getAttrs(px).shared)}}gc_register_proxies.sig="ve";function destroy_proxy(px,msg_ptr){const{shared:shared,props:props}=Module.PyProxy_getAttrsQuiet(px);if(!shared.ptr){return}if(props.roundtrip){return}let msg=undefined;if(msg_ptr){msg=_JsvString_FromId(msg_ptr)}Module.pyproxy_destroy(px,msg,false)}destroy_proxy.sig="vei";function proxy_cache_get(proxyCache,descr){const proxy=proxyCache.get(descr);if(!proxy){return null}if(pyproxyIsAlive(proxy)){return proxy}else{proxyCache.delete(descr);return null}}proxy_cache_get.sig="eei";function proxy_cache_set(proxyCache,descr,proxy){proxyCache.set(descr,proxy)}proxy_cache_set.sig="veie";function _pyproxyGen_make_result(done,value){return{done:!!done,value:value}}_pyproxyGen_make_result.sig="eie";function array_to_js(array,len){return Array.from(HEAP32.subarray(array/4>>>0,array/4+len>>>0))}array_to_js.sig="eii";function _pyproxy_get_buffer_result(start_ptr,smallest_ptr,largest_ptr,readonly,format,itemsize,shape,strides,view,c_contiguous,f_contiguous,sentinel){format=UTF8ToString(format);return{start_ptr:start_ptr,smallest_ptr:smallest_ptr,largest_ptr:largest_ptr,readonly:readonly,format:format,itemsize:itemsize,shape:shape,strides:strides,view:view,c_contiguous:c_contiguous,f_contiguous:f_contiguous}}_pyproxy_get_buffer_result.sig="eiiiiiieeiiii";function pyproxy_new_ex(ptrobj,capture_this,roundtrip,gcRegister,jsonAdaptor){try{return Module.pyproxy_new(ptrobj,{props:{captureThis:!!capture_this,roundtrip:!!roundtrip},gcRegister:gcRegister,jsonAdaptor:jsonAdaptor})}catch(e){Module.handle_js_error(e);return null}errNoRet()}pyproxy_new_ex.sig="eiiiii";function pyproxy_new(ptrobj){try{return Module.pyproxy_new(ptrobj)}catch(e){Module.handle_js_error(e);return null}errNoRet()}pyproxy_new.sig="ei";function create_once_callable(obj,may_syncify){try{_Py_IncRef(obj);let alreadyCalled=!!0;function wrapper(...args){if(alreadyCalled){throw new Error("OnceProxy can only be called once")}try{if(may_syncify){return Module.callPyObjectMaybePromising(obj,args)}else{return Module.callPyObject(obj,args)}}finally{wrapper.destroy()}}wrapper.destroy=function(){if(alreadyCalled){throw new Error("OnceProxy has already been destroyed")}alreadyCalled=!!1;Module.finalizationRegistry.unregister(wrapper);_Py_DecRef(obj)};Module.finalizationRegistry.register(wrapper,[obj,undefined],wrapper);return wrapper}catch(e){Module.handle_js_error(e);return null}errNoRet()}create_once_callable.sig="eii";function create_promise_handles(handle_result,handle_exception,done_callback,js2py_converter){try{if(handle_result){_Py_IncRef(handle_result)}if(handle_exception){_Py_IncRef(handle_exception)}if(js2py_converter){_Py_IncRef(js2py_converter)}if(!done_callback){done_callback=x=>{}}let used=!!0;function checkUsed(){if(used){throw new Error("One of the promise handles has already been called.")}}function destroy(){checkUsed();used=!!1;if(handle_result){_Py_DecRef(handle_result)}if(handle_exception){_Py_DecRef(handle_exception)}if(js2py_converter){_Py_DecRef(js2py_converter)}}function onFulfilled(res){checkUsed();try{if(handle_result){return _create_promise_handles_result_helper(handle_result,js2py_converter,res)}}finally{done_callback(res);destroy()}}function onRejected(err){checkUsed();try{if(handle_exception){return Module.callPyObjectMaybePromising(handle_exception,[err])}}finally{done_callback(undefined);destroy()}}onFulfilled.destroy=destroy;onRejected.destroy=destroy;return[onFulfilled,onRejected]}catch(e){Module.handle_js_error(e);return null}errNoRet()}create_promise_handles.sig="eiiei";function _python2js_buffer_inner(buf,itemsize,ndim,format,shape,strides,suboffsets){try{let converter=Module.get_converter(format,itemsize);return Module._python2js_buffer_recursive(buf,0,{ndim:ndim,format:format,itemsize:itemsize,shape:shape,strides:strides,suboffsets:suboffsets,converter:converter})}catch(e){Module.handle_js_error(e);return null}errNoRet()}_python2js_buffer_inner.sig="eiiiiiii";function jslib_init_js(){try{HEAP32[_Jsr_undefined/4>>>0]=_hiwire_intern(undefined);HEAP32[_Jsr_true/4>>>0]=_hiwire_intern(true);HEAP32[_Jsr_false/4>>>0]=_hiwire_intern(false);HEAP32[_Jsr_novalue/4>>>0]=_hiwire_intern({noValueMarker:1});Module.novalue=_hiwire_get(HEAP32[_Jsr_novalue/4>>>0]);Hiwire.num_keys=_hiwire_num_refs;return 0}catch(e){Module.handle_js_error(e);return-1}return 0}jslib_init_js.sig="i";function JsvNoValue_Check(v){return v===Module.novalue}JsvNoValue_Check.sig="ie";function JsvNum_fromInt(x){return x}JsvNum_fromInt.sig="ei";function JsvNum_fromDouble(val){return val}JsvNum_fromDouble.sig="ed";function JsvNum_fromDigits(digits,ndigits){let result=BigInt(0);for(let i=0;i<ndigits;i++){result+=BigInt(HEAPU32[(digits>>2)+i>>>0])<<BigInt(32*i)}result+=BigInt(HEAPU32[(digits>>2)+ndigits-1>>>0]&2147483648)<<BigInt(1+32*(ndigits-1));if(-Number.MAX_SAFE_INTEGER<result&&result<Number.MAX_SAFE_INTEGER){result=Number(result)}return result}JsvNum_fromDigits.sig="eii";function Jsv_to_bool(x){return!!x}Jsv_to_bool.sig="ie";function Jsv_typeof(x){return typeof x}Jsv_typeof.sig="ee";function Jsv_constructorName(obj){try{return stringToNewUTF8(obj.constructor.name)}catch(e){Module.handle_js_error(e);return 0}errNoRet()}Jsv_constructorName.sig="ie";function JsvUTF8ToString(ptr){return UTF8ToString(ptr)}JsvUTF8ToString.sig="ei";function JsvArray_New(){return[]}JsvArray_New.sig="e";function JsvArray_Check(obj){try{if(Array.isArray(obj)){return true}let typeTag=getTypeTag(obj);if(typeTag==="[object HTMLCollection]"||typeTag==="[object NodeList]"){return true}if(ArrayBuffer.isView(obj)&&obj.constructor.name!=="DataView"){return true}return false}catch(e){return false}}JsvArray_Check.sig="ie";function JsvArray_Get(arr,idx){try{const result=arr[idx];if(result===undefined&&!(idx in arr)){return null}return nullToUndefined(result)}catch(e){Module.handle_js_error(e);return null}errNoRet()}JsvArray_Get.sig="eei";function JsvArray_Set(arr,idx,val){try{arr[idx]=val}catch(e){Module.handle_js_error(e);return-1}return 0}JsvArray_Set.sig="ieie";function JsvArray_Delete(arr,idx){try{if(idx<0||idx>=arr.length){return null}return arr.splice(idx,1)[0]}catch(e){Module.handle_js_error(e);return null}errNoRet()}JsvArray_Delete.sig="eei";function JsvArray_Push(arr,obj){return arr.push(obj)}JsvArray_Push.sig="iee";function JsvArray_Extend(arr,vals){arr.push(...vals)}JsvArray_Extend.sig="vee";function JsvArray_Insert(arr,idx,value){try{arr.splice(idx,0,value)}catch(e){Module.handle_js_error(e);return-1}return 0}JsvArray_Insert.sig="ieie";function JsvArray_ShallowCopy(arr){try{return"slice"in arr?arr.slice():Array.from(arr)}catch(e){Module.handle_js_error(e);return-1}return 0}JsvArray_ShallowCopy.sig="ee";function JsvArray_slice(obj,length,start,stop,step){try{let result;if(step===1){result=obj.slice(start,stop)}else{result=Array.from({length:length},(_,i)=>obj[start+i*step])}return result}catch(e){Module.handle_js_error(e);return null}errNoRet()}JsvArray_slice.sig="eeiiii";function JsvArray_slice_assign(obj,slicelength,start,stop,step,values_length,values){try{let jsvalues=[];for(let i=0;i<values_length;i++){const ref=_python2js(HEAPU32[(values>>2)+i>>>0]);if(ref===null){return-1}jsvalues.push(ref)}if(step===1){obj.splice(start,slicelength,...jsvalues)}else{if(values!==0){for(let i=0;i<slicelength;i++){obj.splice(start+i*step,1,jsvalues[i])}}else{for(let i=slicelength-1;i>=0;i--){obj.splice(start+i*step,1)}}}}catch(e){Module.handle_js_error(e);return-1}return 0}JsvArray_slice_assign.sig="ieiiiiii";function JsvObject_New(){return{}}JsvObject_New.sig="e";function JsvObject_SetAttr(obj,attr,value){try{obj[attr]=value}catch(e){Module.handle_js_error(e);return-1}return 0}JsvObject_SetAttr.sig="ieee";function JsvObject_Entries(obj){try{return Object.entries(obj)}catch(e){Module.handle_js_error(e);return null}errNoRet()}JsvObject_Entries.sig="ee";function JsvObject_Keys(obj){try{return Object.keys(obj)}catch(e){Module.handle_js_error(e);return null}errNoRet()}JsvObject_Keys.sig="ee";function JsvObject_Values(obj){try{return Object.values(obj)}catch(e){Module.handle_js_error(e);return null}errNoRet()}JsvObject_Values.sig="ee";function JsvObject_toString(obj){try{if(hasMethod(obj,"toString")){return obj.toString()}return Object.prototype.toString.call(obj)}catch(e){Module.handle_js_error(e);return null}errNoRet()}JsvObject_toString.sig="ee";function JsvObject_CallMethod(obj,meth,args){try{return nullToUndefined(obj[meth](...args))}catch(e){Module.handle_js_error(e);return null}errNoRet()}JsvObject_CallMethod.sig="eeee";function JsvObject_CallMethod_NoArgs(obj,meth){try{return nullToUndefined(obj[meth]())}catch(e){Module.handle_js_error(e);return null}errNoRet()}JsvObject_CallMethod_NoArgs.sig="eee";function JsvObject_CallMethod_OneArg(obj,meth,arg){try{return nullToUndefined(obj[meth](arg))}catch(e){Module.handle_js_error(e);return null}errNoRet()}JsvObject_CallMethod_OneArg.sig="eeee";function JsvObject_CallMethod_TwoArgs(obj,meth,arg1,arg2){try{return nullToUndefined(obj[meth](arg1,arg2))}catch(e){Module.handle_js_error(e);return null}errNoRet()}JsvObject_CallMethod_TwoArgs.sig="eeeee";function JsvFunction_Check(obj){try{return typeof obj==="function"}catch(e){return false}}JsvFunction_Check.sig="ie";function JsvFunction_CallBound(func,this_,args){try{return nullToUndefined(Function.prototype.apply.apply(func,[this_,args]))}catch(e){Module.handle_js_error(e);return null}errNoRet()}JsvFunction_CallBound.sig="eeee";function JsvFunction_Call_OneArg(func,arg){try{return nullToUndefined(func(arg))}catch(e){Module.handle_js_error(e);return null}errNoRet()}JsvFunction_Call_OneArg.sig="eee";function JsvFunction_Construct(func,args){try{return nullToUndefined(Reflect.construct(func,args))}catch(e){Module.handle_js_error(e);return null}errNoRet()}JsvFunction_Construct.sig="eee";function JsvPromise_Check(obj){try{return isPromise(obj)}catch(e){return false}}JsvPromise_Check.sig="ie";function JsvPromise_Resolve(obj){try{return Promise.resolve(obj)}catch(e){Module.handle_js_error(e);return null}errNoRet()}JsvPromise_Resolve.sig="ee";function jslib_init_buffers_js(){try{const dtypes_str=Array.from("bBhHiIqQfd").join(String.fromCharCode(0));const dtypes_ptr=stringToNewUTF8(dtypes_str);const dtypes_map=Object.fromEntries(Object.entries(dtypes_str).map(([idx,val])=>[val,dtypes_ptr+ +idx]));const buffer_datatype_map=new Map([["Int8Array",[dtypes_map["b"],1,true]],["Uint8Array",[dtypes_map["B"],1,true]],["Uint8ClampedArray",[dtypes_map["B"],1,true]],["Int16Array",[dtypes_map["h"],2,true]],["Uint16Array",[dtypes_map["H"],2,true]],["Int32Array",[dtypes_map["i"],4,true]],["Uint32Array",[dtypes_map["I"],4,true]],["Float32Array",[dtypes_map["f"],4,true]],["Float64Array",[dtypes_map["d"],8,true]],["BigInt64Array",[dtypes_map["q"],8,true]],["BigUint64Array",[dtypes_map["Q"],8,true]],["DataView",[dtypes_map["B"],1,false]],["ArrayBuffer",[dtypes_map["B"],1,false]]]);Module.get_buffer_datatype=function(jsobj){return buffer_datatype_map.get(jsobj.constructor.name)||[0,0,false]}}catch(e){Module.handle_js_error(e);return-1}return 0}jslib_init_buffers_js.sig="i";function JsvBuffer_assignToPtr(buf,ptr){try{Module.HEAPU8.set(bufferAsUint8Array(buf),ptr)}catch(e){Module.handle_js_error(e);return-1}return 0}JsvBuffer_assignToPtr.sig="iei";function JsvBuffer_assignFromPtr(buf,ptr){try{bufferAsUint8Array(buf).set(Module.HEAPU8.subarray(ptr,ptr+buf.byteLength))}catch(e){Module.handle_js_error(e);return-1}return 0}JsvBuffer_assignFromPtr.sig="iei";function JsvBuffer_readFromFile(buf,fd){try{let uint8_buf=bufferAsUint8Array(buf);let stream=Module.FS.streams[fd];Module.FS.read(stream,uint8_buf,0,uint8_buf.byteLength)}catch(e){Module.handle_js_error(e);return-1}return 0}JsvBuffer_readFromFile.sig="iei";function JsvBuffer_writeToFile(buf,fd){try{let uint8_buf=bufferAsUint8Array(buf);let stream=Module.FS.streams[fd];Module.FS.write(stream,uint8_buf,0,uint8_buf.byteLength)}catch(e){Module.handle_js_error(e);return-1}return 0}JsvBuffer_writeToFile.sig="iei";function JsvBuffer_intoFile(buf,fd){try{let uint8_buf=bufferAsUint8Array(buf);let stream=Module.FS.streams[fd];Module.FS.write(stream,uint8_buf,0,uint8_buf.byteLength,undefined,true)}catch(e){Module.handle_js_error(e);return-1}return 0}JsvBuffer_intoFile.sig="iei";function JsvGenerator_Check(obj){try{return getTypeTag(obj)==="[object Generator]"}catch(e){return false}}JsvGenerator_Check.sig="ie";function JsvAsyncGenerator_Check(obj){try{return getTypeTag(obj)==="[object AsyncGenerator]"}catch(e){return false}}JsvAsyncGenerator_Check.sig="ie";function JsvError_Throw(e){throw e}JsvError_Throw.sig="ve";function Jsv_less_than(a,b){try{return!!(a<b)}catch(e){return false}}Jsv_less_than.sig="iee";function Jsv_less_than_equal(a,b){try{return!!(a<=b)}catch(e){return false}}Jsv_less_than_equal.sig="iee";function Jsv_equal(a,b){try{return!!(a===b)}catch(e){return false}}Jsv_equal.sig="iee";function Jsv_not_equal(a,b){try{return!!(a!==b)}catch(e){return false}}Jsv_not_equal.sig="iee";function Jsv_greater_than(a,b){try{return!!(a>b)}catch(e){return false}}Jsv_greater_than.sig="iee";function Jsv_greater_than_equal(a,b){try{return!!(a>=b)}catch(e){return false}}Jsv_greater_than_equal.sig="iee";function JsvMap_New(){try{return new Map}catch(e){Module.handle_js_error(e);return null}errNoRet()}JsvMap_New.sig="e";function JsvLiteralMap_New(){try{return new API.LiteralMap}catch(e){Module.handle_js_error(e);return null}errNoRet()}JsvLiteralMap_New.sig="e";function JsvMap_Set(map,key,val){try{map.set(key,val)}catch(e){Module.handle_js_error(e);return-1}return 0}JsvMap_Set.sig="ieee";function JsvSet_New(){try{return new Set}catch(e){Module.handle_js_error(e);return null}errNoRet()}JsvSet_New.sig="e";function JsvSet_Add(set,val){try{set.add(val)}catch(e){Module.handle_js_error(e);return-1}return 0}JsvSet_Add.sig="iee";function _python2js_addto_postprocess_list(list,parent,key,value){list.push([parent,key,value])}_python2js_addto_postprocess_list.sig="veeei";function _python2js_handle_postprocess_list(list,cache){for(const[parent,key,ptr]of list){let val=cache.get(ptr);if(parent.constructor.name==="LiteralMap"){parent.set(key,val)}else{parent[key]=val}}}_python2js_handle_postprocess_list.sig="vee";function _python2js_ucs1(ptr,len){try{let jsstr="";for(let i=0;i<len;++i){jsstr+=String.fromCharCode(HEAPU8[ptr+i>>>0])}return jsstr}catch(e){Module.handle_js_error(e);return null}errNoRet()}_python2js_ucs1.sig="eii";function _python2js_ucs2(ptr,len){try{let jsstr="";for(let i=0;i<len;++i){jsstr+=String.fromCharCode(HEAPU16[(ptr>>1)+i>>>0])}return jsstr}catch(e){Module.handle_js_error(e);return null}errNoRet()}_python2js_ucs2.sig="eii";function _python2js_ucs4(ptr,len){try{let jsstr="";for(let i=0;i<len;++i){jsstr+=String.fromCodePoint(HEAPU32[(ptr>>2)+i>>>0])}return jsstr}catch(e){Module.handle_js_error(e);return null}errNoRet()}_python2js_ucs4.sig="eii";function _python2js_add_to_cache(cache,pyparent,jsparent){try{cache.set(pyparent,jsparent)}catch(e){Module.handle_js_error(e);return-1}return 0}_python2js_add_to_cache.sig="ieie";function _python2js_cache_lookup(cache,pyparent){return cache.get(pyparent)||null}_python2js_cache_lookup.sig="eei";function _JsArray_PushEntry_helper(array,key,value){try{array.push([key,value])}catch(e){Module.handle_js_error(e);return-1}return 0}_JsArray_PushEntry_helper.sig="ieee";function _JsArray_PostProcess_helper(jscontext,array){try{return jscontext.dict_converter(array)}catch(e){Module.handle_js_error(e);return null}errNoRet()}_JsArray_PostProcess_helper.sig="eee";function python2js__default_converter_js(jscontext,object){try{let proxy=Module.pyproxy_new(object);let result=jscontext.default_converter(proxy,jscontext.converter,jscontext.cacheConversion);proxy.destroy();return result}catch(e){Module.handle_js_error(e);return null}errNoRet()}python2js__default_converter_js.sig="eei";function python2js_custom__create_jscontext(context,cache,dict_converter,default_converter){try{let jscontext={};if(dict_converter){jscontext.dict_converter=dict_converter}if(default_converter){jscontext.default_converter=default_converter;jscontext.cacheConversion=function(input,output){if(!API.isPyProxy(input)){throw new TypeError("The first argument to cacheConversion must be a PyProxy.")}let input_ptr=Module.PyProxy_getPtr(input);cache.set(input_ptr,output)};jscontext.converter=function(x){if(!API.isPyProxy(x)){return x}let ptr=Module.PyProxy_getPtr(x);return __python2js(context,ptr)}}return jscontext}catch(e){Module.handle_js_error(e);return null}errNoRet()}python2js_custom__create_jscontext.sig="eieee";function destroy_proxies_js(proxies_id){try{for(const proxy of proxies_id){proxy.destroy()}}catch(e){Module.handle_js_error(e);return-1}return 0}destroy_proxies_js.sig="ie";function pyodide_js_init(){"use strict";(()=>{var Vr=Object.create;var mt=Object.defineProperty;var qr=Object.getOwnPropertyDescriptor;var Yr=Object.getOwnPropertyNames;var Qr=Object.getPrototypeOf,Xr=Object.prototype.hasOwnProperty;var i=(t,e)=>mt(t,"name",{value:e,configurable:!0}),x=(t=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:(e,r)=>(typeof require<"u"?require:e)[r]}):t)(function(t){if(typeof require<"u")return require.apply(this,arguments);throw new Error('Dynamic require of "'+t+'" is not supported')});var Zr=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of Yr(e))!Xr.call(t,o)&&o!==r&&mt(t,o,{get:()=>e[o],enumerable:!(n=qr(e,o))||n.enumerable});return t};var N=(t,e,r)=>(r=t!=null?Vr(Qr(t)):{},Zr(e||!t||!t.__esModule?mt(r,"default",{value:t,enumerable:!0}):r,t));var Bt=(t,e,r)=>{if(!e.has(t))throw TypeError("Cannot "+r)};var y=(t,e,r)=>(Bt(t,e,"read from private field"),r?r.call(t):e.get(t)),O=(t,e,r)=>{if(e.has(t))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(t):e.set(t,r)},D=(t,e,r,n)=>(Bt(t,e,"write to private field"),n?n.call(t,r):e.set(t,r),r);function en(t){return!isNaN(parseFloat(t))&&isFinite(t)}i(en,"_isNumber");function j(t){return t.charAt(0).toUpperCase()+t.substring(1)}i(j,"_capitalize");function _t(t){return function(){return this[t]}}i(_t,"_getter");var z=["isConstructor","isEval","isNative","isToplevel"],W=["columnNumber","lineNumber"],G=["fileName","functionName","source"],tn=["args"],rn=["evalOrigin"],Re=z.concat(W,G,tn,rn);function S(t){if(t)for(var e=0;e<Re.length;e++)t[Re[e]]!==void 0&&this["set"+j(Re[e])](t[Re[e]])}i(S,"StackFrame");S.prototype={getArgs:function(){return this.args},setArgs:function(t){if(Object.prototype.toString.call(t)!=="[object Array]")throw new TypeError("Args must be an Array");this.args=t},getEvalOrigin:function(){return this.evalOrigin},setEvalOrigin:function(t){if(t instanceof S)this.evalOrigin=t;else if(t instanceof Object)this.evalOrigin=new S(t);else throw new TypeError("Eval Origin must be an Object or StackFrame")},toString:function(){var t=this.getFileName()||"",e=this.getLineNumber()||"",r=this.getColumnNumber()||"",n=this.getFunctionName()||"";return this.getIsEval()?t?"[eval] ("+t+":"+e+":"+r+")":"[eval]:"+e+":"+r:n?n+" ("+t+":"+e+":"+r+")":t+":"+e+":"+r}};S.fromString=i(function(e){var r=e.indexOf("("),n=e.lastIndexOf(")"),o=e.substring(0,r),a=e.substring(r+1,n).split(","),s=e.substring(n+1);if(s.indexOf("@")===0)var l=/@(.+?)(?::(\d+))?(?::(\d+))?$/.exec(s,""),c=l[1],u=l[2],d=l[3];return new S({functionName:o,args:a||void 0,fileName:c,lineNumber:u||void 0,columnNumber:d||void 0})},"StackFrame$$fromString");for($=0;$<z.length;$++)S.prototype["get"+j(z[$])]=_t(z[$]),S.prototype["set"+j(z[$])]=function(t){return function(e){this[t]=!!e}}(z[$]);var $;for(C=0;C<W.length;C++)S.prototype["get"+j(W[C])]=_t(W[C]),S.prototype["set"+j(W[C])]=function(t){return function(e){if(!en(e))throw new TypeError(t+" must be a Number");this[t]=Number(e)}}(W[C]);var C;for(U=0;U<G.length;U++)S.prototype["get"+j(G[U])]=_t(G[U]),S.prototype["set"+j(G[U])]=function(t){return function(e){this[t]=String(e)}}(G[U]);var U,Le=S;function nn(){var t=/^\s*at .*(\S+:\d+|\(native\))/m,e=/^(eval@)?(\[native code])?$/;return{parse:i(function(n){if(n.stack&&n.stack.match(t))return this.parseV8OrIE(n);if(n.stack)return this.parseFFOrSafari(n);throw new Error("Cannot parse given Error object")},"ErrorStackParser$$parse"),extractLocation:i(function(n){if(n.indexOf(":")===-1)return[n];var o=/(.+?)(?::(\d+))?(?::(\d+))?$/,a=o.exec(n.replace(/[()]/g,""));return[a[1],a[2]||void 0,a[3]||void 0]},"ErrorStackParser$$extractLocation"),parseV8OrIE:i(function(n){var o=n.stack.split(`\n`).filter(function(a){return!!a.match(t)},this);return o.map(function(a){a.indexOf("(eval ")>-1&&(a=a.replace(/eval code/g,"eval").replace(/(\(eval at [^()]*)|(,.*$)/g,""));var s=a.replace(/^\s+/,"").replace(/\(eval code/g,"(").replace(/^.*?\s+/,""),l=s.match(/ (\(.+\)$)/);s=l?s.replace(l[0],""):s;var c=this.extractLocation(l?l[1]:s),u=l&&s||void 0,d=["eval","<anonymous>"].indexOf(c[0])>-1?void 0:c[0];return new Le({functionName:u,fileName:d,lineNumber:c[1],columnNumber:c[2],source:a})},this)},"ErrorStackParser$$parseV8OrIE"),parseFFOrSafari:i(function(n){var o=n.stack.split(`\n`).filter(function(a){return!a.match(e)},this);return o.map(function(a){if(a.indexOf(" > eval")>-1&&(a=a.replace(/ line (\d+)(?: > eval line \d+)* > eval:\d+:\d+/g,":$1")),a.indexOf("@")===-1&&a.indexOf(":")===-1)return new Le({functionName:a});var s=/((.*".+"[^@]*)?[^@]*)(?:@)/,l=a.match(s),c=l&&l[1]?l[1]:void 0,u=this.extractLocation(a.replace(s,""));return new Le({functionName:c,fileName:u[0],lineNumber:u[1],columnNumber:u[2],source:a})},this)},"ErrorStackParser$$parseFFOrSafari")}}i(nn,"ErrorStackParser");var on=new nn;var ht=on;function Wt(t){if(typeof t=="string")t=new Error(t);else if(t&&typeof t=="object"&&t.name==="ExitStatus"){let e=t.status;t=new K(t.message),t.status=e}else if(typeof t!="object"||t===null||typeof t.stack!="string"||typeof t.message!="string"){let e=API.getTypeTag(t),r=`A value of type ${typeof t} with tag ${e} was thrown as an error!`;try{r+=`\nString interpolation of the thrown value gives """${t}""".`}catch{r+=`\nString interpolation of the thrown value fails.`}try{r+=`\nThe thrown value's toString method returns """${t.toString()}""".`}catch{r+=`\nThe thrown value's toString method fails.`}t=new Error(r)}return t}i(Wt,"ensureCaughtObjectIsError");var te=class extends Error{constructor(r,n,o){n||(n=`The exception is an object of type ${r} at address ${o} which does not inherit from std::exception`);super(n);this.ty=r}};i(te,"CppException");Object.defineProperty(te.prototype,"name",{get(){return`${this.constructor.name} ${this.ty}`}});var an=WebAssembly.Exception||function(){},Gt=i(t=>t instanceof an,"isWasmException");function Kt(t){if(Gt(t))if(t.is(Module.jsWrapperTag))t=t.getArg(Module.jsWrapperTag,0);else return t;let[e,r]=Module.getExceptionMessage(t);return new te(e,r,t)}i(Kt,"convertCppException");Tests.convertCppException=Kt;var Ht=!1;API.fatal_error=function(t){if(t&&t.pyodide_fatal_error)return;if(Ht){console.error("Recursive call to fatal_error. Inner error was:"),console.error(t);return}if(t instanceof J)throw t;typeof t=="number"||Gt(t)?t=Kt(t):t=Wt(t),t.pyodide_fatal_error=!0,Ht=!0;let e=t instanceof K;e||(console.error("Pyodide has suffered a fatal error. Please report this to the Pyodide maintainers."),console.error("The cause of the fatal error was:"),API.inTestHoist?(console.error(t.toString()),console.error(t.stack)):console.error(t));try{e||_dump_traceback();let n=`Pyodide already ${e?"exited":"fatally failed"} and can no longer be used.`;for(let o of Reflect.ownKeys(API.public_api))typeof o=="string"&&o.startsWith("_")||o==="version"||Object.defineProperty(API.public_api,o,{enumerable:!0,configurable:!0,get:()=>{throw new Error(n)}});API.on_fatal&&API.on_fatal(t)}catch(r){console.error("Another error occurred while handling the fatal error:"),console.error(r)}throw t};API.maybe_fatal_error=function(t){API._skip_unwind_fatal_error&&t==="unwind"||API.fatal_error(t)};var bt=[];API.capture_stderr=function(){bt=[],FS.createDevice("/dev","capture_stderr",null,t=>bt.push(t)),FS.closeStream(2),FS.open("/dev/capture_stderr",1)};API.restore_stderr=function(){return FS.closeStream(2),FS.unlink("/dev/capture_stderr"),FS.open("/dev/stderr",1),(new