e57-js 1.0.4 → 1.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -1,21 +1,21 @@
1
- async function Qn(te={}){var p;(function(){function e(d){d=d.split("-")[0];for(var c=d.split(".").slice(0,3);c.length<3;)c.push("00");return c=c.map((v,m,h)=>v.padStart(2,"0")),c.join("")}var r=d=>[d/1e4|0,(d/100|0)%100,d%100].join("."),t=2147483647,n=typeof process<"u"&&process.versions?.node?e(process.versions.node):t;if(n<180300)throw new Error(`This emscripten-generated code requires node v${r(180300)} (detected v${r(n)})`);var i=typeof navigator<"u"&&navigator.userAgent;if(i){var o=i.includes("Safari/")&&!i.includes("Chrome/")&&i.match(/Version\/(\d+\.?\d*\.?\d*)/)?e(i.match(/Version\/(\d+\.?\d*\.?\d*)/)[1]):t;if(o<15e4)throw new Error(`This emscripten-generated code requires Safari v${r(15e4)} (detected v${o})`);var s=i.match(/Firefox\/(\d+(?:\.\d+)?)/)?parseFloat(i.match(/Firefox\/(\d+(?:\.\d+)?)/)[1]):t;if(s<114)throw new Error(`This emscripten-generated code requires Firefox v114 (detected v${s})`);var l=i.match(/Chrome\/(\d+(?:\.\d+)?)/)?parseFloat(i.match(/Chrome\/(\d+(?:\.\d+)?)/)[1]):t;if(l<85)throw new Error(`This emscripten-generated code requires Chrome v85 (detected v${l})`)}})();var f=te,M=!!globalThis.window,L=!!globalThis.WorkerGlobalScope,C=globalThis.process?.versions?.node&&globalThis.process?.type!="renderer",fe=!M&&!C&&!L,w=L&&globalThis.name?.startsWith("em-pthread");if(w&&(_(!globalThis.moduleLoaded,"module should only be loaded once on each pthread worker"),globalThis.moduleLoaded=!0),C){let{createRequire:e}=await import("node:module");var oe=e(import.meta.url),Ye=oe("node:worker_threads");globalThis.Worker=Ye.Worker,L=!Ye.isMainThread,w=L&&Ye.workerData=="em-pthread"}var ct=[],kr="./this.program",Tr=(e,r)=>{throw r},Fr=import.meta.url,Je="";function si(e){return f.locateFile?f.locateFile(e,Je):Je+e}var Ze,We;if(C){if(!(globalThis.process?.versions?.node&&globalThis.process?.type!="renderer"))throw new Error("not compiled for this environment (did you build to HTML and try to run it not on the web, or set ENVIRONMENT to something - like node - and run it someplace else - like on the web?)");var I=oe("node:fs");Fr.startsWith("file:")&&(Je=oe("node:path").dirname(oe("node:url").fileURLToPath(Fr))+"/"),We=r=>{r=Qe(r)?new URL(r):r;var t=I.readFileSync(r);return _(Buffer.isBuffer(t)),t},Ze=async(r,t=!0)=>{r=Qe(r)?new URL(r):r;var n=I.readFileSync(r,t?void 0:"utf8");return _(t?Buffer.isBuffer(n):typeof n=="string"),n},process.argv.length>1&&(kr=process.argv[1].replace(/\\/g,"/")),ct=process.argv.slice(2),Tr=(r,t)=>{throw process.exitCode=r,t}}else if(!fe)if(M||L){try{Je=new URL(".",Fr).href}catch{}if(!(globalThis.window||globalThis.WorkerGlobalScope))throw new Error("not compiled for this environment (did you build to HTML and try to run it not on the web, or set ENVIRONMENT to something - like node - and run it someplace else - like on the web?)");C||(L&&(We=e=>{var r=new XMLHttpRequest;return r.open("GET",e,!1),r.responseType="arraybuffer",r.send(null),new Uint8Array(r.response)}),Ze=async e=>{_(!Qe(e),"readAsync does not work with file:// URLs");var r=await fetch(e,{credentials:"same-origin"});if(r.ok)return r.arrayBuffer();throw new Error(r.status+" : "+r.url)})}else throw new Error("environment detection error");var ft=console.log.bind(console),_t=console.error.bind(console);if(C){var li=oe("node:util"),vt=e=>typeof e=="object"?li.inspect(e):e;ft=(...e)=>I.writeSync(1,e.map(vt).join(" ")+`
2
- `),_t=(...e)=>I.writeSync(2,e.map(vt).join(" ")+`
3
- `)}var _e=ft,A=_t,Vo="IDBFS is no longer included by default; build with -lidbfs.js",qo="PROXYFS is no longer included by default; build with -lproxyfs.js",Ko="WORKERFS is no longer included by default; build with -lworkerfs.js",Xo="FETCHFS is no longer included by default; build with -lfetchfs.js",Yo="ICASEFS is no longer included by default; build with -licasefs.js",Jo="JSFILEFS is no longer included by default; build with -ljsfilefs.js",Zo="OPFS is no longer included by default; build with -lopfs.js";_(M||L||C,"pthreads do not work in this environment yet (need Web Workers, or an alternative to them)"),_(!M,"web environment detected but not enabled at build time (add `web` to `-sENVIRONMENT` to enable)"),_(!fe,"shell environment detected but not enabled at build time (add `shell` to `-sENVIRONMENT` to enable)");var Le;globalThis.WebAssembly||A("no native wasm support detected");var pe,Ce=!1,Ae;function _(e,r){e||H("Assertion failed"+(r?": "+r:""))}var Qe=e=>e.startsWith("file://");function mt(){var e=tt();_((e&3)==0),e==0&&(e+=4),(u(),y)[e>>2]=34821223,(u(),y)[e+4>>2]=2310721022,(u(),y)[0]=1668509029}function xe(){if(!Ce){var e=tt();e==0&&(e+=4);var r=(u(),y)[e>>2],t=(u(),y)[e+4>>2];(r!=34821223||t!=2310721022)&&H(`Stack overflow! Stack cookie has been overwritten at ${me(e)}, expected hex dwords 0x89BACDFE and 0x2135467, but received ${me(t)} ${me(r)}`),(u(),y)[0]!=1668509029&&H("Runtime error: The application has corrupted its heap memory area (address zero)!")}}class di{}class Qo extends di{}var ht=!0;function Pr(...e){if(!(!ht&&typeof ht<"u"))if(C){let n=function(i){switch(typeof i){case"object":return t.inspect(i);case"undefined":return"undefined"}return i};var r=oe("node:fs"),t=oe("node:util");r.writeSync(2,e.map(n).join(" ")+`
4
- `)}else console.warn(...e)}(()=>{var e=new Int16Array(1),r=new Int8Array(e.buffer);e[0]=25459,(r[0]!==115||r[1]!==99)&&H("Runtime error: expected the system to be little-endian! (Run with -sSUPPORT_BIG_ENDIAN to bypass)")})();function er(e){Object.getOwnPropertyDescriptor(f,e)||Object.defineProperty(f,e,{configurable:!0,set(){H(`Attempt to set \`Module.${e}\` after it has already been processed. This can happen, for example, when code is injected via '--post-js' rather than '--pre-js'`)}})}function N(e){return()=>_(!1,`call to '${e}' via reference taken before Wasm module initialization`)}function ge(e){Object.getOwnPropertyDescriptor(f,e)&&H(`\`Module.${e}\` was supplied but \`${e}\` not included in INCOMING_MODULE_JS_API`)}function ui(e){return e==="FS_createPath"||e==="FS_createDataFile"||e==="FS_createPreloadedFile"||e==="FS_preloadFile"||e==="FS_unlink"||e==="addRunDependency"||e==="FS_createLazyFile"||e==="FS_createDevice"||e==="removeRunDependency"}function ci(e){pt(e)}function pt(e){w||Object.getOwnPropertyDescriptor(f,e)||Object.defineProperty(f,e,{configurable:!0,get(){var r=`'${e}' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the Emscripten FAQ)`;ui(e)&&(r+=". Alternatively, forcing filesystem support (-sFORCE_FILESYSTEM) can export this for you"),H(r)}})}function fi(){function e(){var t=0;return Oe&&typeof Fe<"u"&&(t=Fe()),`w:${yt},t:${me(t)}:`}var r=Pr;Pr=(...t)=>r(e(),...t)}fi();function u(){se.buffer!=W.buffer&&rr()}var Cr,Ar;if(C&&w){globalThis.self=globalThis;var gt=Ye.parentPort;globalThis.postMessage||(gt.on("message",e=>globalThis.onmessage?.({data:e})),globalThis.postMessage=e=>gt.postMessage(e)),process.on("uncaughtException",e=>{postMessage({cmd:"uncaughtException",error:e}),process.exit(1)})}var yt=0,wt;if(w){let e=function(r){try{var t=r.data,n=t.cmd;if(n==="load"){yt=t.workerID;let i=[];self.onmessage=o=>i.push(o),wt=()=>{postMessage({cmd:"loaded"});for(let o of i)e(o);self.onmessage=e};for(let o of t.handlers)(!f[o]||f[o].proxy)&&(f[o]=(...s)=>{postMessage({cmd:"callHandler",handler:o,args:s})},o=="print"&&(_e=f[o]),o=="printErr"&&(A=f[o]));se=t.wasmMemory,rr(),pe=t.wasmModule,St(),Sr()}else if(n==="run"){_(t.pthread_ptr),Ti(t.pthread_ptr),et(t.pthread_ptr,0,0,1,0,0),P.threadInitTLS(),Jr(t.pthread_ptr),Or||(Un(),Or=!0);try{Fi(t.start_routine,t.arg)}catch(i){if(i!="unwind")throw i}}else t.target==="setimmediate"||(n==="checkMailbox"?Or&&wr():n&&(A(`worker: received unknown command ${n}`),A(t)))}catch(i){throw A(`worker: onmessage() captured an uncaught exception: ${i}`),i?.stack&&A(i.stack),Bn(),i}};var Or=!1;self.onunhandledrejection=r=>{throw r.reason||r},self.onmessage=e}var Oe=!1;function rr(){var e=se.buffer;W=new Int8Array(e),J=new Int16Array(e),f.HEAPU8=K=new Uint8Array(e),ye=new Uint16Array(e),S=new Int32Array(e),y=new Uint32Array(e),tr=new Float32Array(e),Re=new Float64Array(e),V=new BigInt64Array(e),Tt=new BigUint64Array(e)}function _i(){if(!w){if(f.wasmMemory)se=f.wasmMemory;else{var e=f.INITIAL_MEMORY||16777216;_(e>=65536,`INITIAL_MEMORY should be larger than STACK_SIZE, was ${e}! (STACK_SIZE=65536)`),se=new WebAssembly.Memory({initial:e/65536,maximum:32768,shared:!0})}rr()}}_(globalThis.Int32Array&&globalThis.Float64Array&&Int32Array.prototype.subarray&&Int32Array.prototype.set,"JS engine does not provide full typed array support");function vi(){if(_(!w),f.preRun)for(typeof f.preRun=="function"&&(f.preRun=[f.preRun]);f.preRun.length;)Ot(f.preRun.shift());er("preRun"),Ct(At)}function Et(){if(_(!Oe),Oe=!0,w)return wt();xe(),T.root=a.mount(T,{},null),!f.noFSInit&&!a.initialized&&a.init(),ce.init(),Pe.__wasm_call_ctors(),a.ignorePermissions=!1}function mi(){if(xe(),!w){if(f.postRun)for(typeof f.postRun=="function"&&(f.postRun=[f.postRun]);f.postRun.length;)ki(f.postRun.shift());er("postRun"),Ct(Mt)}}function H(e){f.onAbort?.(e),e=`Aborted(${e})`,A(e),Ce=!0;var r=new WebAssembly.RuntimeError(e);throw Ar?.(r),r}function q(e,r){return(...t)=>{_(Oe,`native function \`${e}\` called before runtime initialization`);var n=Pe[e];return _(n,`exported native function \`${e}\` not found`),_(t.length<=r,`native function \`${e}\` called with ${t.length} args but expects ${r}`),n(...t)}}var Rr;function hi(){return f.locateFile?si("libe57-js.wasm"):new URL("libe57-js.wasm",import.meta.url).href}function pi(e){if(e==Rr&&Le)return new Uint8Array(Le);if(We)return We(e);throw"both async and sync fetching of the wasm failed"}async function gi(e){if(!Le)try{var r=await Ze(e);return new Uint8Array(r)}catch{}return pi(e)}async function yi(e,r){try{var t=await gi(e),n=await WebAssembly.instantiate(t,r);return n}catch(i){A(`failed to asynchronously prepare wasm: ${i}`),Qe(e)&&A(`warning: Loading from a file URI (${e}) is not supported in most browsers. See https://emscripten.org/docs/getting_started/FAQ.html#how-do-i-run-a-local-webserver-for-testing-why-does-my-program-stall-in-downloading-or-preparing`),H(i)}}async function wi(e,r,t){if(!e&&!C)try{var n=fetch(r,{credentials:"same-origin"}),i=await WebAssembly.instantiateStreaming(n,t);return i}catch(o){A(`wasm streaming compile failed: ${o}`),A("falling back to ArrayBuffer instantiation")}return yi(r,t)}function bt(){jo();var e={env:st,wasi_snapshot_preview1:st};return e}async function St(){function e(l,d){return Pe=l.exports,Pi(Pe._emscripten_tls_init),Uo(Pe),pe=d,Pe}var r=f;function t(l){return _(f===r,"the Module object should not be replaced during async compilation - perhaps the order of HTML elements is wrong?"),r=null,e(l.instance,l.module)}var n=bt();if(f.instantiateWasm)return new Promise((l,d)=>{try{f.instantiateWasm(n,(c,v)=>{l(e(c,v))})}catch(c){A(`Module.instantiateWasm callback failed with error: ${c}`),d(c)}});if(w){_(pe,"wasmModule should have been received via postMessage");var i=new WebAssembly.Instance(pe,bt());return e(i,pe)}Rr??=hi();var o=await wi(Le,Rr,n),s=t(o);return s}class kt{name="ExitStatus";constructor(r){this.message=`Program terminated with exit(${r})`,this.status=r}}var J,S,V,W,tr,Re,ye,y,Tt,K,Ft=e=>{e.terminate(),e.onmessage=r=>{var t=r.data.cmd;A(`received "${t}" command from terminated worker: ${e.workerID}`)}},Pt=e=>{_(!w,"cleanupThread() should only be called from the main thread"),_(e,"null pthread_ptr passed to cleanupThread");var r=P.pthreads[e];_(r),P.returnWorkerToPool(r)},Ct=e=>{for(;e.length>0;)e.shift()(f)},At=[],Ot=e=>At.push(e),we=0,Ue=null,De={},ve=null,Dr=e=>{if(we--,f.monitorRunDependencies?.(we),_(e,"removeRunDependency requires an ID"),_(De[e]),delete De[e],we==0&&(ve!==null&&(clearInterval(ve),ve=null),Ue)){var r=Ue;Ue=null,r()}},$r=e=>{we++,f.monitorRunDependencies?.(we),_(e,"addRunDependency requires an ID"),_(!De[e]),De[e]=1,ve===null&&globalThis.setInterval&&(ve=setInterval(()=>{if(Ce){clearInterval(ve),ve=null;return}var r=!1;for(var t in De)r||(r=!0,A("still waiting on run dependencies:")),A(`dependency: ${t}`);r&&A("(end of list)")},1e4),ve.unref?.())},Rt=e=>{_(!w,"spawnThread() should only be called from the main thread"),_(e.pthread_ptr,"spawnThread called with null pthread ptr");var r=P.getNewWorker();if(!r)return 6;_(!r.pthread_ptr),P.runningWorkers.push(r),P.pthreads[e.pthread_ptr]=r,r.pthread_ptr=e.pthread_ptr;var t={cmd:"run",start_routine:e.startRoutine,arg:e.arg,pthread_ptr:e.pthread_ptr};return C&&r.unref(),r.postMessage(t,e.transferList),0},nr=0,ir=()=>Nr||nr>0,Ei=()=>at(),Dt=e=>Yn(e),bi=e=>Jn(e),B=(e,r,t,...n)=>{var i=8*n.length*2,o=Ei(),s=bi(i),l=s>>3;for(var d of n)typeof d=="bigint"?((u(),V)[l++]=1n,(u(),V)[l++]=d):((u(),V)[l++]=0n,(u(),Re)[l++]=d);var c=Gn(e,r,i,s,t);return Dt(o),c};function $t(e){if(w)return B(0,0,1,e);Ae=e,ir()||(P.terminateAllThreads(),f.onExit?.(e),Ce=!0),Tr(e,new kt(e))}function It(e){if(w)return B(1,0,0,e);Ir(e)}var Si=(e,r)=>{if(Ae=e,Bo(),w)throw _(!r),It(e),"unwind";if(ir()&&!r){var t=`program exited (with status: ${e}), but keepRuntimeAlive() is set (counter=${nr}) due to an async operation, so halting execution but not exiting the runtime or preventing further async execution (you can use emscripten_force_exit, if you want to force a true shutdown)`;Ar?.(t),A(t)}$t(e)},Ir=Si,Nt=!Atomics.waitAsync||globalThis.navigator?.userAgent&&Number((navigator.userAgent.match(/Chrom(e|ium)\/([0-9]+)\./)||[])[2])<91;function me(e){return _(typeof e=="number",`ptrToString expects a number, got ${typeof e}`),e>>>=0,"0x"+e.toString(16).padStart(8,"0")}var P={unusedWorkers:[],runningWorkers:[],tlsInitFunctions:[],pthreads:{},nextWorkerID:1,init(){w||P.initMainThread()},initMainThread(){for(var e=8;e--;)P.allocateUnusedWorker();Ot(async()=>{var r=P.loadWasmModuleToAllWorkers();$r("loading-workers"),await r,Dr("loading-workers")})},terminateAllThreads:()=>{_(!w,"terminateAllThreads() should only be called from the main thread");for(var e of P.runningWorkers)Ft(e);for(var e of P.unusedWorkers)Ft(e);P.unusedWorkers=[],P.runningWorkers=[],P.pthreads={}},terminateRuntime:()=>{_(!w,"terminateRuntime() should only be called from the main thread"),P.terminateAllThreads();var e=Fe();Hn(0,0,0,1),Nt||Atomics.notify((u(),S),e>>2)},returnWorkerToPool:e=>{var r=e.pthread_ptr;delete P.pthreads[r],P.unusedWorkers.push(e),P.runningWorkers.splice(P.runningWorkers.indexOf(e),1),e.pthread_ptr=0,Vn(r)},threadInitTLS(){P.tlsInitFunctions.forEach(e=>e())},loadWasmModuleToWorker:e=>new Promise(r=>{e.onmessage=o=>{var s=o.data,l=s.cmd;if(s.targetThread&&s.targetThread!=Fe()){var d=P.pthreads[s.targetThread];d?d.postMessage(s,s.transferList):A(`worker sent message (${l}) to pthread (${s.targetThread}) that no longer exists`);return}l==="checkMailbox"?wr():l==="spawnThread"?Rt(s):l==="cleanupThread"?Pn(()=>Pt(s.thread)):l==="loaded"?(e.loaded=!0,C&&!e.pthread_ptr&&e.unref(),r(e)):s.target==="setimmediate"?e.postMessage(s):l==="uncaughtException"?e.onerror(s.error):l==="callHandler"?f[s.handler](...s.args):l&&A(`worker sent an unknown command ${l}`)},e.onerror=o=>{var s="worker sent an error!";throw e.pthread_ptr&&(s=`Pthread ${me(e.pthread_ptr)} sent an error!`),A(`${s} ${o.filename}:${o.lineno}: ${o.message}`),o},C&&(e.on("message",o=>e.onmessage({data:o})),e.on("error",o=>e.onerror(o))),_(se instanceof WebAssembly.Memory,"wasmMemory should have been loaded by now"),_(pe instanceof WebAssembly.Module,"wasmModule should have been loaded by now");var t=[],n=["onExit","onAbort","print","printErr"];for(var i of n)f.propertyIsEnumerable(i)&&t.push(i);e.postMessage({cmd:"load",handlers:t,wasmMemory:se,wasmModule:pe,workerID:e.workerID})}),async loadWasmModuleToAllWorkers(){return w?void 0:Promise.all(P.unusedWorkers.map(P.loadWasmModuleToWorker))},allocateUnusedWorker(){var e;if(f.mainScriptUrlOrBlob){var r=f.mainScriptUrlOrBlob;typeof r!="string"&&(r=URL.createObjectURL(r)),e=new Worker(r,{type:"module",workerData:"em-pthread",name:"em-pthread-"+P.nextWorkerID})}else e=new Worker(new URL("libe57-js.js",import.meta.url),{type:"module",workerData:"em-pthread",name:"em-pthread-"+P.nextWorkerID});e.workerID=P.nextWorkerID++,P.unusedWorkers.push(e)},getNewWorker(){return P.unusedWorkers.length==0&&(C||A("Tried to spawn a new thread, but the thread pool is exhausted.\nThis might result in a deadlock unless some threads eventually exit or the code explicitly breaks out to the event loop.\nIf you want to increase the pool size, use setting `-sPTHREAD_POOL_SIZE=...`.\nIf you want to throw an explicit error instead of the risk of deadlocking in those cases, use setting `-sPTHREAD_POOL_SIZE_STRICT=2`."),P.allocateUnusedWorker(),P.loadWasmModuleToWorker(P.unusedWorkers[0])),P.unusedWorkers.pop()}},Mt=[],ki=e=>Mt.push(e);function Ti(e){var r=(u(),y)[e+48>>2],t=(u(),y)[e+52>>2],n=r-t;_(r!=0),_(n!=0),_(r>n,"stackHigh must be higher then stackLow"),Xn(r,n),Dt(r),mt()}function es(e,r="i8"){switch(r.endsWith("*")&&(r="*"),r){case"i1":return(u(),W)[e];case"i8":return(u(),W)[e];case"i16":return(u(),J)[e>>1];case"i32":return(u(),S)[e>>2];case"i64":return(u(),V)[e>>3];case"float":return(u(),tr)[e>>2];case"double":return(u(),Re)[e>>3];case"*":return(u(),y)[e>>2];default:H(`invalid type for getValue: ${r}`)}}var Wt=[],Lt=e=>{var r=Wt[e];return r||(Wt[e]=r=ot.get(e)),_(ot.get(e)==r,"table mirror is out of date"),r},Fi=(e,r)=>{nr=0,Nr=0;var t=Lt(e)(r);xe();function n(i){if(ir()){Ae=i;return}it(i)}n(t)},Nr=!0,Pi=e=>P.tlsInitFunctions.push(e);function rs(e,r,t="i8"){switch(t.endsWith("*")&&(t="*"),t){case"i1":(u(),W)[e]=r;break;case"i8":(u(),W)[e]=r;break;case"i16":(u(),J)[e>>1]=r;break;case"i32":(u(),S)[e>>2]=r;break;case"i64":(u(),V)[e>>3]=BigInt(r);break;case"float":(u(),tr)[e>>2]=r;break;case"double":(u(),Re)[e>>3]=r;break;case"*":(u(),y)[e>>2]=r;break;default:H(`invalid type for setValue: ${t}`)}}var Ee=e=>{Ee.shown||={},Ee.shown[e]||(Ee.shown[e]=1,C&&(e="warning: "+e),A(e))},se,xt=globalThis.TextDecoder&&new TextDecoder,Ut=(e,r,t,n)=>{var i=r+t;if(n)return i;for(;e[r]&&!(r>=i);)++r;return r},$e=(e,r=0,t,n)=>{var i=Ut(e,r,t,n);if(i-r>16&&e.buffer&&xt)return xt.decode(e.buffer instanceof ArrayBuffer?e.subarray(r,i):e.slice(r,i));for(var o="";r<i;){var s=e[r++];if(!(s&128)){o+=String.fromCharCode(s);continue}var l=e[r++]&63;if((s&224)==192){o+=String.fromCharCode((s&31)<<6|l);continue}var d=e[r++]&63;if((s&240)==224?s=(s&15)<<12|l<<6|d:((s&248)!=240&&Ee(`Invalid UTF-8 leading byte ${me(s)} encountered when deserializing a UTF-8 string in wasm memory to a JS string!`),s=(s&7)<<18|l<<12|d<<6|e[r++]&63),s<65536)o+=String.fromCharCode(s);else{var c=s-65536;o+=String.fromCharCode(55296|c>>10,56320|c&1023)}}return o},le=(e,r,t)=>(_(typeof e=="number",`UTF8ToString expects a number (got ${typeof e})`),e?$e((u(),K),e,r,t):""),Ci=(e,r,t,n)=>H(`Assertion failed: ${le(e)}, at: `+[r?le(r):"unknown filename",t,n?le(n):"unknown function"]);class Ai{constructor(r){this.excPtr=r,this.ptr=r-24}set_type(r){(u(),y)[this.ptr+4>>2]=r}get_type(){return(u(),y)[this.ptr+4>>2]}set_destructor(r){(u(),y)[this.ptr+8>>2]=r}get_destructor(){return(u(),y)[this.ptr+8>>2]}set_caught(r){r=r?1:0,(u(),W)[this.ptr+12]=r}get_caught(){return(u(),W)[this.ptr+12]!=0}set_rethrown(r){r=r?1:0,(u(),W)[this.ptr+13]=r}get_rethrown(){return(u(),W)[this.ptr+13]!=0}init(r,t){this.set_adjusted_ptr(0),this.set_type(r),this.set_destructor(t)}set_adjusted_ptr(r){(u(),y)[this.ptr+16>>2]=r}get_adjusted_ptr(){return(u(),y)[this.ptr+16>>2]}}var Oi=0,Ri=(e,r,t)=>{var n=new Ai(e);n.init(r,t),Oi++,_(!1,"Exception thrown, but exception catching is not enabled. Compile with -sNO_DISABLE_EXCEPTION_CATCHING or -sEXCEPTION_CATCHING_ALLOWED=[..] to catch.")};function jt(e,r,t,n){return w?B(2,0,1,e,r,t,n):Ht(e,r,t,n)}var Di=()=>!!globalThis.SharedArrayBuffer,Ht=(e,r,t,n)=>{if(!Di())return Pr("pthread_create: environment does not support SharedArrayBuffer, pthreads are not available"),6;var i=[],o=0;if(w&&(i.length===0||o))return jt(e,r,t,n);if(o)return o;var s={startRoutine:t,pthread_ptr:e,arg:n,transferList:i};return w?(s.cmd="spawnThread",postMessage(s,i),0):Rt(s)},$i=()=>{if(C){var e=oe("node:crypto");return r=>e.randomFillSync(r)}return r=>(r.set(crypto.getRandomValues(new Uint8Array(r.byteLength))),0)},Mr=e=>(Mr=$i())(e),$={isAbs:e=>e.charAt(0)==="/",splitPath:e=>{var r=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/;return r.exec(e).slice(1)},normalizeArray:(e,r)=>{for(var t=0,n=e.length-1;n>=0;n--){var i=e[n];i==="."?e.splice(n,1):i===".."?(e.splice(n,1),t++):t&&(e.splice(n,1),t--)}if(r)for(;t;t--)e.unshift("..");return e},normalize:e=>{var r=$.isAbs(e),t=e.slice(-1)==="/";return e=$.normalizeArray(e.split("/").filter(n=>!!n),!r).join("/"),!e&&!r&&(e="."),e&&t&&(e+="/"),(r?"/":"")+e},dirname:e=>{var r=$.splitPath(e),t=r[0],n=r[1];return!t&&!n?".":(n&&(n=n.slice(0,-1)),t+n)},basename:e=>e&&e.match(/([^\/]+|\/)\/*$/)[1],join:(...e)=>$.normalize(e.join("/")),join2:(e,r)=>$.normalize(e+"/"+r)},Ie={resolve:(...e)=>{for(var r="",t=!1,n=e.length-1;n>=-1&&!t;n--){var i=n>=0?e[n]:a.cwd();if(typeof i!="string")throw new TypeError("Arguments to path.resolve must be strings");if(!i)return"";r=i+"/"+r,t=$.isAbs(i)}return r=$.normalizeArray(r.split("/").filter(o=>!!o),!t).join("/"),(t?"/":"")+r||"."},relative:(e,r)=>{e=Ie.resolve(e).slice(1),r=Ie.resolve(r).slice(1);function t(c){for(var v=0;v<c.length&&c[v]==="";v++);for(var m=c.length-1;m>=0&&c[m]==="";m--);return v>m?[]:c.slice(v,m-v+1)}for(var n=t(e.split("/")),i=t(r.split("/")),o=Math.min(n.length,i.length),s=o,l=0;l<o;l++)if(n[l]!==i[l]){s=l;break}for(var d=[],l=s;l<n.length;l++)d.push("..");return d=d.concat(i.slice(s)),d.join("/")}},Wr=[],be=e=>{for(var r=0,t=0;t<e.length;++t){var n=e.charCodeAt(t);n<=127?r++:n<=2047?r+=2:n>=55296&&n<=57343?(r+=4,++t):r+=3}return r},Bt=(e,r,t,n)=>{if(_(typeof e=="string",`stringToUTF8Array expects a string (got ${typeof e})`),!(n>0))return 0;for(var i=t,o=t+n-1,s=0;s<e.length;++s){var l=e.codePointAt(s);if(l<=127){if(t>=o)break;r[t++]=l}else if(l<=2047){if(t+1>=o)break;r[t++]=192|l>>6,r[t++]=128|l&63}else if(l<=65535){if(t+2>=o)break;r[t++]=224|l>>12,r[t++]=128|l>>6&63,r[t++]=128|l&63}else{if(t+3>=o)break;l>1114111&&Ee(`Invalid Unicode code point ${me(l)} encountered when serializing a JS string to a UTF-8 string in wasm memory! (Valid unicode code points should be in range 0-0x10FFFF).`),r[t++]=240|l>>18,r[t++]=128|l>>12&63,r[t++]=128|l>>6&63,r[t++]=128|l&63,s++}}return r[t]=0,t-i},Lr=(e,r,t)=>{var n=t>0?t:be(e)+1,i=new Array(n),o=Bt(e,i,0,i.length);return r&&(i.length=o),i},Ii=()=>{if(!Wr.length){var e=null;if(C){var r=256,t=Buffer.alloc(r),n=0,i=process.stdin.fd;try{n=I.readSync(i,t,0,r)}catch(o){if(o.toString().includes("EOF"))n=0;else throw o}n>0&&(e=t.slice(0,n).toString("utf-8"))}if(!e)return null;Wr=Lr(e,!0)}return Wr.shift()},ce={ttys:[],init(){},shutdown(){},register(e,r){ce.ttys[e]={input:[],output:[],ops:r},a.registerDevice(e,ce.stream_ops)},stream_ops:{open(e){var r=ce.ttys[e.node.rdev];if(!r)throw new a.ErrnoError(43);e.tty=r,e.seekable=!1},close(e){e.tty.ops.fsync(e.tty)},fsync(e){e.tty.ops.fsync(e.tty)},read(e,r,t,n,i){if(!e.tty||!e.tty.ops.get_char)throw new a.ErrnoError(60);for(var o=0,s=0;s<n;s++){var l;try{l=e.tty.ops.get_char(e.tty)}catch{throw new a.ErrnoError(29)}if(l===void 0&&o===0)throw new a.ErrnoError(6);if(l==null)break;o++,r[t+s]=l}return o&&(e.node.atime=Date.now()),o},write(e,r,t,n,i){if(!e.tty||!e.tty.ops.put_char)throw new a.ErrnoError(60);try{for(var o=0;o<n;o++)e.tty.ops.put_char(e.tty,r[t+o])}catch{throw new a.ErrnoError(29)}return n&&(e.node.mtime=e.node.ctime=Date.now()),o}},default_tty_ops:{get_char(e){return Ii()},put_char(e,r){r===null||r===10?(_e($e(e.output)),e.output=[]):r!=0&&e.output.push(r)},fsync(e){e.output?.length>0&&(_e($e(e.output)),e.output=[])},ioctl_tcgets(e){return{c_iflag:25856,c_oflag:5,c_cflag:191,c_lflag:35387,c_cc:[3,28,127,21,4,0,1,0,17,19,26,0,18,15,23,22,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]}},ioctl_tcsets(e,r,t){return 0},ioctl_tiocgwinsz(e){return[24,80]}},default_tty1_ops:{put_char(e,r){r===null||r===10?(A($e(e.output)),e.output=[]):r!=0&&e.output.push(r)},fsync(e){e.output?.length>0&&(A($e(e.output)),e.output=[])}}},xr=e=>{H("internal error: mmapAlloc called but `emscripten_builtin_memalign` native symbol not exported")},F={ops_table:null,mount(e){return F.createNode(null,"/",16895,0)},createNode(e,r,t,n){if(a.isBlkdev(t)||a.isFIFO(t))throw new a.ErrnoError(63);F.ops_table||={dir:{node:{getattr:F.node_ops.getattr,setattr:F.node_ops.setattr,lookup:F.node_ops.lookup,mknod:F.node_ops.mknod,rename:F.node_ops.rename,unlink:F.node_ops.unlink,rmdir:F.node_ops.rmdir,readdir:F.node_ops.readdir,symlink:F.node_ops.symlink},stream:{llseek:F.stream_ops.llseek}},file:{node:{getattr:F.node_ops.getattr,setattr:F.node_ops.setattr},stream:{llseek:F.stream_ops.llseek,read:F.stream_ops.read,write:F.stream_ops.write,mmap:F.stream_ops.mmap,msync:F.stream_ops.msync}},link:{node:{getattr:F.node_ops.getattr,setattr:F.node_ops.setattr,readlink:F.node_ops.readlink},stream:{}},chrdev:{node:{getattr:F.node_ops.getattr,setattr:F.node_ops.setattr},stream:a.chrdev_stream_ops}};var i=a.createNode(e,r,t,n);return a.isDir(i.mode)?(i.node_ops=F.ops_table.dir.node,i.stream_ops=F.ops_table.dir.stream,i.contents={}):a.isFile(i.mode)?(i.node_ops=F.ops_table.file.node,i.stream_ops=F.ops_table.file.stream,i.usedBytes=0,i.contents=F.emptyFileContents??=new Uint8Array(0)):a.isLink(i.mode)?(i.node_ops=F.ops_table.link.node,i.stream_ops=F.ops_table.link.stream):a.isChrdev(i.mode)&&(i.node_ops=F.ops_table.chrdev.node,i.stream_ops=F.ops_table.chrdev.stream),i.atime=i.mtime=i.ctime=Date.now(),e&&(e.contents[r]=i,e.atime=e.mtime=e.ctime=i.atime),i},getFileDataAsTypedArray(e){return _(a.isFile(e.mode),"getFileDataAsTypedArray called on non-file"),e.contents.subarray(0,e.usedBytes)},expandFileStorage(e,r){var t=e.contents.length;if(!(t>=r)){var n=1024*1024;r=Math.max(r,t*(t<n?2:1.125)>>>0),t&&(r=Math.max(r,256));var i=F.getFileDataAsTypedArray(e);e.contents=new Uint8Array(r),e.contents.set(i)}},resizeFileStorage(e,r){if(e.usedBytes!=r){var t=e.contents;e.contents=new Uint8Array(r),e.contents.set(t.subarray(0,Math.min(r,e.usedBytes))),e.usedBytes=r}},node_ops:{getattr(e){var r={};return r.dev=a.isChrdev(e.mode)?e.id:1,r.ino=e.id,r.mode=e.mode,r.nlink=1,r.uid=0,r.gid=0,r.rdev=e.rdev,a.isDir(e.mode)?r.size=4096:a.isFile(e.mode)?r.size=e.usedBytes:a.isLink(e.mode)?r.size=e.link.length:r.size=0,r.atime=new Date(e.atime),r.mtime=new Date(e.mtime),r.ctime=new Date(e.ctime),r.blksize=4096,r.blocks=Math.ceil(r.size/r.blksize),r},setattr(e,r){for(let t of["mode","atime","mtime","ctime"])r[t]!=null&&(e[t]=r[t]);r.size!==void 0&&F.resizeFileStorage(e,r.size)},lookup(e,r){throw new a.ErrnoError(44)},mknod(e,r,t,n){return F.createNode(e,r,t,n)},rename(e,r,t){var n;try{n=a.lookupNode(r,t)}catch{}if(n){if(a.isDir(e.mode))for(var i in n.contents)throw new a.ErrnoError(55);a.hashRemoveNode(n)}delete e.parent.contents[e.name],r.contents[t]=e,e.name=t,r.ctime=r.mtime=e.parent.ctime=e.parent.mtime=Date.now()},unlink(e,r){delete e.contents[r],e.ctime=e.mtime=Date.now()},rmdir(e,r){var t=a.lookupNode(e,r);for(var n in t.contents)throw new a.ErrnoError(55);delete e.contents[r],e.ctime=e.mtime=Date.now()},readdir(e){return[".","..",...Object.keys(e.contents)]},symlink(e,r,t){var n=F.createNode(e,r,41471,0);return n.link=t,n},readlink(e){if(!a.isLink(e.mode))throw new a.ErrnoError(28);return e.link}},stream_ops:{read(e,r,t,n,i){var o=e.node.contents;if(i>=e.node.usedBytes)return 0;var s=Math.min(e.node.usedBytes-i,n);return _(s>=0),r.set(o.subarray(i,i+s),t),s},write(e,r,t,n,i,o){if(_(r.subarray,"FS.write expects a TypedArray"),r.buffer===(u(),W).buffer&&(o=!1),!n)return 0;var s=e.node;return s.mtime=s.ctime=Date.now(),o?(_(i===0,"canOwn must imply no weird position inside the file"),s.contents=r.subarray(t,t+n),s.usedBytes=n):s.usedBytes===0&&i===0?(s.contents=r.slice(t,t+n),s.usedBytes=n):(F.expandFileStorage(s,i+n),s.contents.set(r.subarray(t,t+n),i),s.usedBytes=Math.max(s.usedBytes,i+n)),n},llseek(e,r,t){var n=r;if(t===1?n+=e.position:t===2&&a.isFile(e.node.mode)&&(n+=e.node.usedBytes),n<0)throw new a.ErrnoError(28);return n},mmap(e,r,t,n,i){if(!a.isFile(e.node.mode))throw new a.ErrnoError(43);var o,s,l=e.node.contents;if(!(i&2)&&l.buffer===(u(),W).buffer)s=!1,o=l.byteOffset;else{if(s=!0,o=xr(r),!o)throw new a.ErrnoError(48);l&&((t>0||t+r<l.length)&&(l.subarray?l=l.subarray(t,t+r):l=Array.prototype.slice.call(l,t,t+r)),(u(),W).set(l,o))}return{ptr:o,allocated:s}},msync(e,r,t,n,i){return F.stream_ops.write(e,r,0,n,t,!1),0}}},Ni=e=>{if(typeof e!="string")return e;var r={r:0,"r+":2,w:577,"w+":578,a:1089,"a+":1090},t=r[e];if(typeof t>"u")throw new Error(`Unknown file open mode: ${e}`);return t},zt=e=>(typeof e=="string"&&(e=Lr(e,!0)),e.subarray||(e=new Uint8Array(e)),e),Ur=(e,r)=>{var t=0;return e&&(t|=365),r&&(t|=146),t},ar={EPERM:63,ENOENT:44,ESRCH:71,EINTR:27,EIO:29,ENXIO:60,E2BIG:1,ENOEXEC:45,EBADF:8,ECHILD:12,EAGAIN:6,EWOULDBLOCK:6,ENOMEM:48,EACCES:2,EFAULT:21,ENOTBLK:105,EBUSY:10,EEXIST:20,EXDEV:75,ENODEV:43,ENOTDIR:54,EISDIR:31,EINVAL:28,ENFILE:41,EMFILE:33,ENOTTY:59,ETXTBSY:74,EFBIG:22,ENOSPC:51,ESPIPE:70,EROFS:69,EMLINK:34,EPIPE:64,EDOM:18,ERANGE:68,ENOMSG:49,EIDRM:24,ECHRNG:106,EL2NSYNC:156,EL3HLT:107,EL3RST:108,ELNRNG:109,EUNATCH:110,ENOCSI:111,EL2HLT:112,EDEADLK:16,ENOLCK:46,EBADE:113,EBADR:114,EXFULL:115,ENOANO:104,EBADRQC:103,EBADSLT:102,EDEADLOCK:16,EBFONT:101,ENOSTR:100,ENODATA:116,ETIME:117,ENOSR:118,ENONET:119,ENOPKG:120,EREMOTE:121,ENOLINK:47,EADV:122,ESRMNT:123,ECOMM:124,EPROTO:65,EMULTIHOP:36,EDOTDOT:125,EBADMSG:9,ENOTUNIQ:126,EBADFD:127,EREMCHG:128,ELIBACC:129,ELIBBAD:130,ELIBSCN:131,ELIBMAX:132,ELIBEXEC:133,ENOSYS:52,ENOTEMPTY:55,ENAMETOOLONG:37,ELOOP:32,EOPNOTSUPP:138,EPFNOSUPPORT:139,ECONNRESET:15,ENOBUFS:42,EAFNOSUPPORT:5,EPROTOTYPE:67,ENOTSOCK:57,ENOPROTOOPT:50,ESHUTDOWN:140,ECONNREFUSED:14,EADDRINUSE:3,ECONNABORTED:13,ENETUNREACH:40,ENETDOWN:38,ETIMEDOUT:73,EHOSTDOWN:142,EHOSTUNREACH:23,EINPROGRESS:26,EALREADY:7,EDESTADDRREQ:17,EMSGSIZE:35,EPROTONOSUPPORT:66,ESOCKTNOSUPPORT:137,EADDRNOTAVAIL:4,ENETRESET:39,EISCONN:30,ENOTCONN:53,ETOOMANYREFS:141,EUSERS:136,EDQUOT:19,ESTALE:72,ENOTSUP:138,ENOMEDIUM:148,EILSEQ:25,EOVERFLOW:61,ECANCELED:11,ENOTRECOVERABLE:56,EOWNERDEAD:62,ESTRPIPE:135},b={isWindows:!1,staticInit(){b.isWindows=!!process.platform.match(/^win/);var e=process.binding("constants").fs;b.flagsForNodeMap={1024:e.O_APPEND,64:e.O_CREAT,128:e.O_EXCL,256:e.O_NOCTTY,0:e.O_RDONLY,2:e.O_RDWR,4096:e.O_SYNC,512:e.O_TRUNC,1:e.O_WRONLY,131072:e.O_NOFOLLOW},_(b.flagsForNodeMap[0]===0)},convertNodeCode(e){var r=e.code;return _(r in ar,`unexpected node error code: ${r} (${e})`),ar[r]},tryFSOperation(e){try{return e()}catch(r){throw r.code?r.code==="UNKNOWN"?new a.ErrnoError(28):new a.ErrnoError(b.convertNodeCode(r)):r}},mount(e){return _(C),b.createNode(null,"/",b.getMode(e.opts.root),0)},createNode(e,r,t,n){if(!a.isDir(t)&&!a.isFile(t)&&!a.isLink(t))throw new a.ErrnoError(28);var i=a.createNode(e,r,t);return i.node_ops=b.node_ops,i.stream_ops=b.stream_ops,i},getMode(e){return b.tryFSOperation(()=>{var r=I.lstatSync(e).mode;return b.isWindows&&(r|=(r&292)>>2),r})},realPath(e){for(var r=[];e.parent!==e;)r.push(e.name),e=e.parent;return r.push(e.mount.opts.root),r.reverse(),$.join(...r)},flagsForNode(e){e&=-2097153,e&=-2049,e&=-32769,e&=-524289,e&=-65537;var r=0;for(var t in b.flagsForNodeMap)e&t&&(r|=b.flagsForNodeMap[t],e^=t);if(e)throw new a.ErrnoError(28);return r},getattr(e,r){var t=b.tryFSOperation(e);return b.isWindows&&(t.blksize||(t.blksize=4096),t.blocks||(t.blocks=(t.size+t.blksize-1)/t.blksize|0),t.mode|=(t.mode&292)>>2),{dev:t.dev,ino:r.id,mode:t.mode,nlink:t.nlink,uid:t.uid,gid:t.gid,rdev:t.rdev,size:t.size,atime:t.atime,mtime:t.mtime,ctime:t.ctime,blksize:t.blksize,blocks:t.blocks}},setattr(e,r,t,n,i,o,s){b.tryFSOperation(()=>{if(t.mode!==void 0){var l=t.mode;b.isWindows&&(l&=384),n(e,l),r.mode=t.mode}if(typeof(t.atime??t.mtime)=="number"){var d=new Date(t.atime??s(e).atime),c=new Date(t.mtime??s(e).mtime);i(e,d,c)}t.size!==void 0&&o(e,t.size)})},node_ops:{getattr(e){var r=b.realPath(e);return b.getattr(()=>I.lstatSync(r),e)},setattr(e,r){var t=b.realPath(e);if(r.mode!=null&&r.dontFollow)throw new a.ErrnoError(52);b.setattr(t,e,r,I.chmodSync,I.utimesSync,I.truncateSync,I.lstatSync)},lookup(e,r){var t=$.join2(b.realPath(e),r),n=b.getMode(t);return b.createNode(e,r,n)},mknod(e,r,t,n){var i=b.createNode(e,r,t,n),o=b.realPath(i);return b.tryFSOperation(()=>{a.isDir(i.mode)?I.mkdirSync(o,i.mode):I.writeFileSync(o,"",{mode:i.mode})}),i},rename(e,r,t){var n=b.realPath(e),i=$.join2(b.realPath(r),t);try{a.unlink(i)}catch{}b.tryFSOperation(()=>I.renameSync(n,i)),e.name=t},unlink(e,r){var t=$.join2(b.realPath(e),r);b.tryFSOperation(()=>I.unlinkSync(t))},rmdir(e,r){var t=$.join2(b.realPath(e),r);b.tryFSOperation(()=>I.rmdirSync(t))},readdir(e){var r=b.realPath(e);return b.tryFSOperation(()=>I.readdirSync(r))},symlink(e,r,t){var n=$.join2(b.realPath(e),r);b.tryFSOperation(()=>I.symlinkSync(t,n))},readlink(e){var r=b.realPath(e);return b.tryFSOperation(()=>I.readlinkSync(r))},statfs(e){var r=b.tryFSOperation(()=>I.statfsSync(e));return r.frsize=r.bsize,r}},stream_ops:{getattr(e){return b.getattr(()=>I.fstatSync(e.nfd),e.node)},setattr(e,r){b.setattr(e.nfd,e.node,r,I.fchmodSync,I.futimesSync,I.ftruncateSync,I.fstatSync)},open(e){var r=b.realPath(e.node);b.tryFSOperation(()=>{e.shared.refcount=1,e.nfd=I.openSync(r,b.flagsForNode(e.flags))})},close(e){b.tryFSOperation(()=>{e.nfd&&--e.shared.refcount===0&&I.closeSync(e.nfd)})},dup(e){e.shared.refcount++},read(e,r,t,n,i){return b.tryFSOperation(()=>I.readSync(e.nfd,r,t,n,i))},write(e,r,t,n,i){return b.tryFSOperation(()=>I.writeSync(e.nfd,r,t,n,i))},llseek(e,r,t){var n=r;if(t===1?n+=e.position:t===2&&a.isFile(e.node.mode)&&b.tryFSOperation(()=>{var i=I.fstatSync(e.nfd);n+=i.size}),n<0)throw new a.ErrnoError(28);return n},mmap(e,r,t,n,i){if(!a.isFile(e.node.mode))throw new a.ErrnoError(43);var o=xr(r);return b.stream_ops.read(e,(u(),W),o,r,t),{ptr:o,allocated:!0}},msync(e,r,t,n,i){return b.stream_ops.write(e,r,0,n,t,!1),0}}},Mi=e=>le(jn(e)),Wi=async e=>{var r=await Ze(e);return _(r,`Loading data file "${e}" failed (no arrayBuffer).`),new Uint8Array(r)},Gt=(...e)=>a.createDataFile(...e),Li=e=>{for(var r=e;;){if(!De[e])return e;e=r+Math.random()}},Vt=[],xi=async(e,r)=>{typeof Browser<"u"&&Browser.init();for(var t of Vt)if(t.canHandle(r))return _(t.handle.constructor.name==="AsyncFunction","Filesystem plugin handlers must be async functions (See #24914)"),t.handle(e,r);return e},jr=async(e,r,t,n,i,o,s,l)=>{var d=r?Ie.resolve($.join2(e,r)):e,c=Li(`cp ${d}`);$r(c);try{var v=t;typeof t=="string"&&(v=await Wi(t)),v=await xi(v,d),l?.(),o||Gt(e,r,v,n,i,s)}finally{Dr(c)}},Ui=(e,r,t,n,i,o,s,l,d,c)=>{jr(e,r,t,n,i,l,d,c).then(o).catch(s)},a={root:null,mounts:[],devices:{},streams:[],nextInode:1,nameTable:null,currentPath:"/",initialized:!1,ignorePermissions:!0,filesystems:null,syncFSRequests:0,ErrnoError:class extends Error{name="ErrnoError";constructor(e){super(Oe?Mi(e):""),this.errno=e;for(var r in ar)if(ar[r]===e){this.code=r;break}}},FSStream:class{shared={};get object(){return this.node}set object(e){this.node=e}get isRead(){return(this.flags&2097155)!==1}get isWrite(){return(this.flags&2097155)!==0}get isAppend(){return this.flags&1024}get flags(){return this.shared.flags}set flags(e){this.shared.flags=e}get position(){return this.shared.position}set position(e){this.shared.position=e}},FSNode:class{node_ops={};stream_ops={};readMode=365;writeMode=146;mounted=null;constructor(e,r,t,n){e||(e=this),this.parent=e,this.mount=e.mount,this.id=a.nextInode++,this.name=r,this.mode=t,this.rdev=n,this.atime=this.mtime=this.ctime=Date.now()}get read(){return(this.mode&this.readMode)===this.readMode}set read(e){e?this.mode|=this.readMode:this.mode&=~this.readMode}get write(){return(this.mode&this.writeMode)===this.writeMode}set write(e){e?this.mode|=this.writeMode:this.mode&=~this.writeMode}get isFolder(){return a.isDir(this.mode)}get isDevice(){return a.isChrdev(this.mode)}},lookupPath(e,r={}){if(!e)throw new a.ErrnoError(44);r.follow_mount??=!0,$.isAbs(e)||(e=a.cwd()+"/"+e);e:for(var t=0;t<40;t++){for(var n=e.split("/").filter(c=>!!c),i=a.root,o="/",s=0;s<n.length;s++){var l=s===n.length-1;if(l&&r.parent)break;if(n[s]!=="."){if(n[s]===".."){if(o=$.dirname(o),a.isRoot(i)){e=o+"/"+n.slice(s+1).join("/"),t--;continue e}else i=i.parent;continue}o=$.join2(o,n[s]);try{i=a.lookupNode(i,n[s])}catch(c){if(c?.errno===44&&l&&r.noent_okay)return{path:o};throw c}if(a.isMountpoint(i)&&(!l||r.follow_mount)&&(i=i.mounted.root),a.isLink(i.mode)&&(!l||r.follow)){if(!i.node_ops.readlink)throw new a.ErrnoError(52);var d=i.node_ops.readlink(i);$.isAbs(d)||(d=$.dirname(o)+"/"+d),e=d+"/"+n.slice(s+1).join("/");continue e}}}return{path:o,node:i}}throw new a.ErrnoError(32)},getPath(e){for(var r;;){if(a.isRoot(e)){var t=e.mount.mountpoint;return r?t[t.length-1]!=="/"?`${t}/${r}`:t+r:t}r=r?`${e.name}/${r}`:e.name,e=e.parent}},hashName(e,r){for(var t=0,n=0;n<r.length;n++)t=(t<<5)-t+r.charCodeAt(n)|0;return(e+t>>>0)%a.nameTable.length},hashAddNode(e){var r=a.hashName(e.parent.id,e.name);e.name_next=a.nameTable[r],a.nameTable[r]=e},hashRemoveNode(e){var r=a.hashName(e.parent.id,e.name);if(a.nameTable[r]===e)a.nameTable[r]=e.name_next;else for(var t=a.nameTable[r];t;){if(t.name_next===e){t.name_next=e.name_next;break}t=t.name_next}},lookupNode(e,r){var t=a.mayLookup(e);if(t)throw new a.ErrnoError(t);for(var n=a.hashName(e.id,r),i=a.nameTable[n];i;i=i.name_next){var o=i.name;if(i.parent.id===e.id&&o===r)return i}return a.lookup(e,r)},createNode(e,r,t,n){_(typeof e=="object");var i=new a.FSNode(e,r,t,n);return a.hashAddNode(i),i},destroyNode(e){a.hashRemoveNode(e)},isRoot(e){return e===e.parent},isMountpoint(e){return!!e.mounted},isFile(e){return(e&61440)===32768},isDir(e){return(e&61440)===16384},isLink(e){return(e&61440)===40960},isChrdev(e){return(e&61440)===8192},isBlkdev(e){return(e&61440)===24576},isFIFO(e){return(e&61440)===4096},isSocket(e){return(e&49152)===49152},flagsToPermissionString(e){var r=["r","w","rw"][e&3];return e&512&&(r+="w"),r},nodePermissions(e,r){return a.ignorePermissions?0:r.includes("r")&&!(e.mode&292)||r.includes("w")&&!(e.mode&146)||r.includes("x")&&!(e.mode&73)?2:0},mayLookup(e){if(!a.isDir(e.mode))return 54;var r=a.nodePermissions(e,"x");return r||(e.node_ops.lookup?0:2)},mayCreate(e,r){if(!a.isDir(e.mode))return 54;try{var t=a.lookupNode(e,r);return 20}catch{}return a.nodePermissions(e,"wx")},mayDelete(e,r,t){var n;try{n=a.lookupNode(e,r)}catch(o){return o.errno}var i=a.nodePermissions(e,"wx");if(i)return i;if(t){if(!a.isDir(n.mode))return 54;if(a.isRoot(n)||a.getPath(n)===a.cwd())return 10}else if(a.isDir(n.mode))return 31;return 0},mayOpen(e,r){if(!e)return 44;if(a.isLink(e.mode))return 32;var t=a.flagsToPermissionString(r);return a.isDir(e.mode)&&(t!=="r"||r&576)?31:a.nodePermissions(e,t)},checkOpExists(e,r){if(!e)throw new a.ErrnoError(r);return e},MAX_OPEN_FDS:4096,nextfd(){for(var e=0;e<=a.MAX_OPEN_FDS;e++)if(!a.streams[e])return e;throw new a.ErrnoError(33)},getStreamChecked(e){var r=a.getStream(e);if(!r)throw new a.ErrnoError(8);return r},getStream:e=>a.streams[e],createStream(e,r=-1){return _(r>=-1),e=Object.assign(new a.FSStream,e),r==-1&&(r=a.nextfd()),e.fd=r,a.streams[r]=e,e},closeStream(e){a.streams[e]=null},dupStream(e,r=-1){var t=a.createStream(e,r);return t.stream_ops?.dup?.(t),t},doSetAttr(e,r,t){var n=e?.stream_ops.setattr,i=n?e:r;n??=r.node_ops.setattr,a.checkOpExists(n,63);try{n(i,t)}catch(o){throw o instanceof RangeError?new a.ErrnoError(22):o}},chrdev_stream_ops:{open(e){var r=a.getDevice(e.node.rdev);e.stream_ops=r.stream_ops,e.stream_ops.open?.(e)},llseek(){throw new a.ErrnoError(70)}},major:e=>e>>8,minor:e=>e&255,makedev:(e,r)=>e<<8|r,registerDevice(e,r){a.devices[e]={stream_ops:r}},getDevice:e=>a.devices[e],getMounts(e){for(var r=[],t=[e];t.length;){var n=t.pop();r.push(n),t.push(...n.mounts)}return r},syncfs(e,r){typeof e=="function"&&(r=e,e=!1),a.syncFSRequests++,a.syncFSRequests>1&&A(`warning: ${a.syncFSRequests} FS.syncfs operations in flight at once, probably just doing extra work`);var t=a.getMounts(a.root.mount),n=0;function i(l){return _(a.syncFSRequests>0),a.syncFSRequests--,r(l)}function o(l){if(l)return o.errored?void 0:(o.errored=!0,i(l));++n>=t.length&&i(null)}for(var s of t)s.type.syncfs?s.type.syncfs(s,e,o):o(null)},mount(e,r,t){if(typeof e=="string")throw e;var n=t==="/",i=!t,o;if(n&&a.root)throw new a.ErrnoError(10);if(!n&&!i){var s=a.lookupPath(t,{follow_mount:!1});if(t=s.path,o=s.node,a.isMountpoint(o))throw new a.ErrnoError(10);if(!a.isDir(o.mode))throw new a.ErrnoError(54)}var l={type:e,opts:r,mountpoint:t,mounts:[]},d=e.mount(l);return d.mount=l,l.root=d,n?a.root=d:o&&(o.mounted=l,o.mount&&o.mount.mounts.push(l)),d},unmount(e){var r=a.lookupPath(e,{follow_mount:!1});if(!a.isMountpoint(r.node))throw new a.ErrnoError(28);var t=r.node,n=t.mounted,i=a.getMounts(n);for(var[o,s]of Object.entries(a.nameTable))for(;s;){var l=s.name_next;i.includes(s.mount)&&a.destroyNode(s),s=l}t.mounted=null;var d=t.mount.mounts.indexOf(n);_(d!==-1),t.mount.mounts.splice(d,1)},lookup(e,r){return e.node_ops.lookup(e,r)},mknod(e,r,t){var n=a.lookupPath(e,{parent:!0}),i=n.node,o=$.basename(e);if(!o)throw new a.ErrnoError(28);if(o==="."||o==="..")throw new a.ErrnoError(20);var s=a.mayCreate(i,o);if(s)throw new a.ErrnoError(s);if(!i.node_ops.mknod)throw new a.ErrnoError(63);return i.node_ops.mknod(i,o,r,t)},statfs(e){return a.statfsNode(a.lookupPath(e,{follow:!0}).node)},statfsStream(e){return a.statfsNode(e.node)},statfsNode(e){var r={bsize:4096,frsize:4096,blocks:1e6,bfree:5e5,bavail:5e5,files:a.nextInode,ffree:a.nextInode-1,fsid:42,flags:2,namelen:255};return e.node_ops.statfs&&Object.assign(r,e.node_ops.statfs(e.mount.opts.root)),r},create(e,r=438){return r&=4095,r|=32768,a.mknod(e,r,0)},mkdir(e,r=511){return r&=1023,r|=16384,a.mknod(e,r,0)},mkdirTree(e,r){var t=e.split("/"),n="";for(var i of t)if(i){(n||$.isAbs(e))&&(n+="/"),n+=i;try{a.mkdir(n,r)}catch(o){if(o.errno!=20)throw o}}},mkdev(e,r,t){return typeof t>"u"&&(t=r,r=438),r|=8192,a.mknod(e,r,t)},symlink(e,r){if(!Ie.resolve(e))throw new a.ErrnoError(44);var t=a.lookupPath(r,{parent:!0}),n=t.node;if(!n)throw new a.ErrnoError(44);var i=$.basename(r),o=a.mayCreate(n,i);if(o)throw new a.ErrnoError(o);if(!n.node_ops.symlink)throw new a.ErrnoError(63);return n.node_ops.symlink(n,i,e)},rename(e,r){var t=$.dirname(e),n=$.dirname(r),i=$.basename(e),o=$.basename(r),s,l,d;if(s=a.lookupPath(e,{parent:!0}),l=s.node,s=a.lookupPath(r,{parent:!0}),d=s.node,!l||!d)throw new a.ErrnoError(44);if(l.mount!==d.mount)throw new a.ErrnoError(75);var c=a.lookupNode(l,i),v=Ie.relative(e,n);if(v.charAt(0)!==".")throw new a.ErrnoError(28);if(v=Ie.relative(r,t),v.charAt(0)!==".")throw new a.ErrnoError(55);var m;try{m=a.lookupNode(d,o)}catch{}if(c!==m){var h=a.isDir(c.mode),g=a.mayDelete(l,i,h);if(g)throw new a.ErrnoError(g);if(g=m?a.mayDelete(d,o,h):a.mayCreate(d,o),g)throw new a.ErrnoError(g);if(!l.node_ops.rename)throw new a.ErrnoError(63);if(a.isMountpoint(c)||m&&a.isMountpoint(m))throw new a.ErrnoError(10);if(d!==l&&(g=a.nodePermissions(l,"w"),g))throw new a.ErrnoError(g);a.hashRemoveNode(c);try{l.node_ops.rename(c,d,o),c.parent=d}catch(E){throw E}finally{a.hashAddNode(c)}}},rmdir(e){var r=a.lookupPath(e,{parent:!0}),t=r.node,n=$.basename(e),i=a.lookupNode(t,n),o=a.mayDelete(t,n,!0);if(o)throw new a.ErrnoError(o);if(!t.node_ops.rmdir)throw new a.ErrnoError(63);if(a.isMountpoint(i))throw new a.ErrnoError(10);t.node_ops.rmdir(t,n),a.destroyNode(i)},readdir(e){var r=a.lookupPath(e,{follow:!0}),t=r.node,n=a.checkOpExists(t.node_ops.readdir,54);return n(t)},unlink(e){var r=a.lookupPath(e,{parent:!0}),t=r.node;if(!t)throw new a.ErrnoError(44);var n=$.basename(e),i=a.lookupNode(t,n),o=a.mayDelete(t,n,!1);if(o)throw new a.ErrnoError(o);if(!t.node_ops.unlink)throw new a.ErrnoError(63);if(a.isMountpoint(i))throw new a.ErrnoError(10);t.node_ops.unlink(t,n),a.destroyNode(i)},readlink(e){var r=a.lookupPath(e),t=r.node;if(!t)throw new a.ErrnoError(44);if(!t.node_ops.readlink)throw new a.ErrnoError(28);return t.node_ops.readlink(t)},stat(e,r){var t=a.lookupPath(e,{follow:!r}),n=t.node,i=a.checkOpExists(n.node_ops.getattr,63);return i(n)},fstat(e){var r=a.getStreamChecked(e),t=r.node,n=r.stream_ops.getattr,i=n?r:t;return n??=t.node_ops.getattr,a.checkOpExists(n,63),n(i)},lstat(e){return a.stat(e,!0)},doChmod(e,r,t,n){a.doSetAttr(e,r,{mode:t&4095|r.mode&-4096,ctime:Date.now(),dontFollow:n})},chmod(e,r,t){var n;if(typeof e=="string"){var i=a.lookupPath(e,{follow:!t});n=i.node}else n=e;a.doChmod(null,n,r,t)},lchmod(e,r){a.chmod(e,r,!0)},fchmod(e,r){var t=a.getStreamChecked(e);a.doChmod(t,t.node,r,!1)},doChown(e,r,t){a.doSetAttr(e,r,{timestamp:Date.now(),dontFollow:t})},chown(e,r,t,n){var i;if(typeof e=="string"){var o=a.lookupPath(e,{follow:!n});i=o.node}else i=e;a.doChown(null,i,n)},lchown(e,r,t){a.chown(e,r,t,!0)},fchown(e,r,t){var n=a.getStreamChecked(e);a.doChown(n,n.node,!1)},doTruncate(e,r,t){if(a.isDir(r.mode))throw new a.ErrnoError(31);if(!a.isFile(r.mode))throw new a.ErrnoError(28);var n=a.nodePermissions(r,"w");if(n)throw new a.ErrnoError(n);a.doSetAttr(e,r,{size:t,timestamp:Date.now()})},truncate(e,r){if(r<0)throw new a.ErrnoError(28);var t;if(typeof e=="string"){var n=a.lookupPath(e,{follow:!0});t=n.node}else t=e;a.doTruncate(null,t,r)},ftruncate(e,r){var t=a.getStreamChecked(e);if(r<0||(t.flags&2097155)===0)throw new a.ErrnoError(28);a.doTruncate(t,t.node,r)},utime(e,r,t){var n=a.lookupPath(e,{follow:!0}),i=n.node,o=a.checkOpExists(i.node_ops.setattr,63);o(i,{atime:r,mtime:t})},open(e,r,t=438){if(e==="")throw new a.ErrnoError(44);r=Ni(r),r&64?t=t&4095|32768:t=0;var n,i;if(typeof e=="object")n=e;else{i=e.endsWith("/");var o=a.lookupPath(e,{follow:!(r&131072),noent_okay:!0});n=o.node,e=o.path}var s=!1;if(r&64)if(n){if(r&128)throw new a.ErrnoError(20)}else{if(i)throw new a.ErrnoError(31);n=a.mknod(e,t|511,0),s=!0}if(!n)throw new a.ErrnoError(44);if(a.isChrdev(n.mode)&&(r&=-513),r&65536&&!a.isDir(n.mode))throw new a.ErrnoError(54);if(!s){var l=a.mayOpen(n,r);if(l)throw new a.ErrnoError(l)}r&512&&!s&&a.truncate(n,0),r&=-131713;var d=a.createStream({node:n,path:a.getPath(n),flags:r,seekable:!0,position:0,stream_ops:n.stream_ops,ungotten:[],error:!1});return d.stream_ops.open&&d.stream_ops.open(d),s&&a.chmod(n,t&511),d},close(e){if(a.isClosed(e))throw new a.ErrnoError(8);e.getdents&&(e.getdents=null);try{e.stream_ops.close&&e.stream_ops.close(e)}catch(r){throw r}finally{a.closeStream(e.fd)}e.fd=null},isClosed(e){return e.fd===null},llseek(e,r,t){if(a.isClosed(e))throw new a.ErrnoError(8);if(!e.seekable||!e.stream_ops.llseek)throw new a.ErrnoError(70);if(t!=0&&t!=1&&t!=2)throw new a.ErrnoError(28);return e.position=e.stream_ops.llseek(e,r,t),e.ungotten=[],e.position},read(e,r,t,n,i){if(_(t>=0),n<0||i<0)throw new a.ErrnoError(28);if(a.isClosed(e))throw new a.ErrnoError(8);if((e.flags&2097155)===1)throw new a.ErrnoError(8);if(a.isDir(e.node.mode))throw new a.ErrnoError(31);if(!e.stream_ops.read)throw new a.ErrnoError(28);var o=typeof i<"u";if(!o)i=e.position;else if(!e.seekable)throw new a.ErrnoError(70);var s=e.stream_ops.read(e,r,t,n,i);return o||(e.position+=s),s},write(e,r,t,n,i,o){if(_(t>=0),_(r.subarray,"FS.write expects a TypedArray"),n<0||i<0)throw new a.ErrnoError(28);if(a.isClosed(e))throw new a.ErrnoError(8);if((e.flags&2097155)===0)throw new a.ErrnoError(8);if(a.isDir(e.node.mode))throw new a.ErrnoError(31);if(!e.stream_ops.write)throw new a.ErrnoError(28);e.seekable&&e.flags&1024&&a.llseek(e,0,2);var s=typeof i<"u";if(!s)i=e.position;else if(!e.seekable)throw new a.ErrnoError(70);var l=e.stream_ops.write(e,r,t,n,i,o);return s||(e.position+=l),l},mmap(e,r,t,n,i){if((n&2)!==0&&(i&2)===0&&(e.flags&2097155)!==2)throw new a.ErrnoError(2);if((e.flags&2097155)===1)throw new a.ErrnoError(2);if(!e.stream_ops.mmap)throw new a.ErrnoError(43);if(!r)throw new a.ErrnoError(28);return e.stream_ops.mmap(e,r,t,n,i)},msync(e,r,t,n,i){return _(t>=0),e.stream_ops.msync?e.stream_ops.msync(e,r,t,n,i):0},ioctl(e,r,t){if(!e.stream_ops.ioctl)throw new a.ErrnoError(59);return e.stream_ops.ioctl(e,r,t)},readFile(e,r={}){r.flags=r.flags||0,r.encoding=r.encoding||"binary",r.encoding!=="utf8"&&r.encoding!=="binary"&&H(`Invalid encoding type "${r.encoding}"`);var t=a.open(e,r.flags),n=a.stat(e),i=n.size,o=new Uint8Array(i);return a.read(t,o,0,i,0),r.encoding==="utf8"&&(o=$e(o)),a.close(t),o},writeFile(e,r,t={}){t.flags=t.flags||577;var n=a.open(e,t.flags,t.mode);r=zt(r),a.write(n,r,0,r.byteLength,void 0,t.canOwn),a.close(n)},cwd:()=>a.currentPath,chdir(e){var r=a.lookupPath(e,{follow:!0});if(r.node===null)throw new a.ErrnoError(44);if(!a.isDir(r.node.mode))throw new a.ErrnoError(54);var t=a.nodePermissions(r.node,"x");if(t)throw new a.ErrnoError(t);a.currentPath=r.path},createDefaultDirectories(){a.mkdir("/tmp"),a.mkdir("/home"),a.mkdir("/home/web_user")},createDefaultDevices(){a.mkdir("/dev"),a.registerDevice(a.makedev(1,3),{read:()=>0,write:(n,i,o,s,l)=>s,llseek:()=>0}),a.mkdev("/dev/null",a.makedev(1,3)),ce.register(a.makedev(5,0),ce.default_tty_ops),ce.register(a.makedev(6,0),ce.default_tty1_ops),a.mkdev("/dev/tty",a.makedev(5,0)),a.mkdev("/dev/tty1",a.makedev(6,0));var e=new Uint8Array(1024),r=0,t=()=>(r===0&&(Mr(e),r=e.byteLength),e[--r]);a.createDevice("/dev","random",t),a.createDevice("/dev","urandom",t),a.mkdir("/dev/shm"),a.mkdir("/dev/shm/tmp")},createSpecialDirectories(){a.mkdir("/proc");var e=a.mkdir("/proc/self");a.mkdir("/proc/self/fd"),a.mount({mount(){var r=a.createNode(e,"fd",16895,73);return r.stream_ops={llseek:F.stream_ops.llseek},r.node_ops={lookup(t,n){var i=+n,o=a.getStreamChecked(i),s={parent:null,mount:{mountpoint:"fake"},node_ops:{readlink:()=>o.path},id:i+1};return s.parent=s,s},readdir(){return Array.from(a.streams.entries()).filter(([t,n])=>n).map(([t,n])=>t.toString())}},r}},{},"/proc/self/fd")},createStandardStreams(e,r,t){e?a.createDevice("/dev","stdin",e):a.symlink("/dev/tty","/dev/stdin"),r?a.createDevice("/dev","stdout",null,r):a.symlink("/dev/tty","/dev/stdout"),t?a.createDevice("/dev","stderr",null,t):a.symlink("/dev/tty1","/dev/stderr");var n=a.open("/dev/stdin",0),i=a.open("/dev/stdout",1),o=a.open("/dev/stderr",1);_(n.fd===0,`invalid handle for stdin (${n.fd})`),_(i.fd===1,`invalid handle for stdout (${i.fd})`),_(o.fd===2,`invalid handle for stderr (${o.fd})`)},staticInit(){a.nameTable=new Array(4096),a.mount(F,{},"/"),a.createDefaultDirectories(),a.createDefaultDevices(),a.createSpecialDirectories(),a.filesystems={MEMFS:F,NODEFS:b}},init(e,r,t){_(!a.initialized,"FS.init was previously called. If you want to initialize later with custom parameters, remove any earlier calls (note that one is automatically added to the generated code)"),a.initialized=!0,e??=f.stdin,r??=f.stdout,t??=f.stderr,a.createStandardStreams(e,r,t)},quit(){a.initialized=!1,rt(0);for(var e of a.streams)e&&a.close(e)},findObject(e,r){var t=a.analyzePath(e,r);return t.exists?t.object:null},analyzePath(e,r){try{var t=a.lookupPath(e,{follow:!r});e=t.path}catch{}var n={isRoot:!1,exists:!1,error:0,name:null,path:null,object:null,parentExists:!1,parentPath:null,parentObject:null};try{var t=a.lookupPath(e,{parent:!0});n.parentExists=!0,n.parentPath=t.path,n.parentObject=t.node,n.name=$.basename(e),t=a.lookupPath(e,{follow:!r}),n.exists=!0,n.path=t.path,n.object=t.node,n.name=t.node.name,n.isRoot=t.path==="/"}catch(i){n.error=i.errno}return n},createPath(e,r,t,n){e=typeof e=="string"?e:a.getPath(e);for(var i=r.split("/").reverse();i.length;){var o=i.pop();if(o){var s=$.join2(e,o);try{a.mkdir(s)}catch(l){if(l.errno!=20)throw l}e=s}}return s},createFile(e,r,t,n,i){var o=$.join2(typeof e=="string"?e:a.getPath(e),r),s=Ur(n,i);return a.create(o,s)},createDataFile(e,r,t,n,i,o){var s=r;e&&(e=typeof e=="string"?e:a.getPath(e),s=r?$.join2(e,r):e);var l=Ur(n,i),d=a.create(s,l);if(t){t=zt(t),a.chmod(d,l|146);var c=a.open(d,577);a.write(c,t,0,t.length,0,o),a.close(c),a.chmod(d,l)}},createDevice(e,r,t,n){var i=$.join2(typeof e=="string"?e:a.getPath(e),r),o=Ur(!!t,!!n);a.createDevice.major??=64;var s=a.makedev(a.createDevice.major++,0);return a.registerDevice(s,{open(l){l.seekable=!1},close(l){n?.buffer?.length&&n(10)},read(l,d,c,v,m){for(var h=0,g=0;g<v;g++){var E;try{E=t()}catch{throw new a.ErrnoError(29)}if(E===void 0&&h===0)throw new a.ErrnoError(6);if(E==null)break;h++,d[c+g]=E}return h&&(l.node.atime=Date.now()),h},write(l,d,c,v,m){for(var h=0;h<v;h++)try{n(d[c+h])}catch{throw new a.ErrnoError(29)}return v&&(l.node.mtime=l.node.ctime=Date.now()),h}}),a.mkdev(i,o,s)},forceLoadFile(e){if(e.isDevice||e.isFolder||e.link||e.contents)return!0;if(globalThis.XMLHttpRequest)H("Lazy loading should have been performed (contents set) in createLazyFile, but it was not. Lazy loading only works in web workers. Use --embed-file or --preload-file in emcc on the main thread.");else try{e.contents=We(e.url)}catch{throw new a.ErrnoError(29)}},createLazyFile(e,r,t,n,i){class o{lengthKnown=!1;chunks=[];get(h){if(!(h>this.length-1||h<0)){var g=h%this.chunkSize,E=h/this.chunkSize|0;return this.getter(E)[g]}}setDataGetter(h){this.getter=h}cacheLength(){var h=new XMLHttpRequest;h.open("HEAD",t,!1),h.send(null),h.status>=200&&h.status<300||h.status===304||H("Couldn't load "+t+". Status: "+h.status);var g=Number(h.getResponseHeader("Content-length")),E,k=(E=h.getResponseHeader("Accept-Ranges"))&&E==="bytes",R=(E=h.getResponseHeader("Content-Encoding"))&&E==="gzip",D=1024*1024;k||(D=g);var x=(ee,ne)=>{ee>ne&&H("invalid range ("+ee+", "+ne+") or no bytes requested!"),ne>g-1&&H("only "+g+" bytes available! programmer error!");var j=new XMLHttpRequest;return j.open("GET",t,!1),g!==D&&j.setRequestHeader("Range","bytes="+ee+"-"+ne),j.responseType="arraybuffer",j.overrideMimeType&&j.overrideMimeType("text/plain; charset=x-user-defined"),j.send(null),j.status>=200&&j.status<300||j.status===304||H("Couldn't load "+t+". Status: "+j.status),j.response!==void 0?new Uint8Array(j.response||[]):Lr(j.responseText||"",!0)},U=this;U.setDataGetter(ee=>{var ne=ee*D,j=(ee+1)*D-1;return j=Math.min(j,g-1),typeof U.chunks[ee]>"u"&&(U.chunks[ee]=x(ne,j)),typeof U.chunks[ee]>"u"&&H("doXHR failed!"),U.chunks[ee]}),(R||!g)&&(D=g=1,g=this.getter(0).length,D=g,_e("LazyFiles on gzip forces download of the whole file when length is accessed")),this._length=g,this._chunkSize=D,this.lengthKnown=!0}get length(){return this.lengthKnown||this.cacheLength(),this._length}get chunkSize(){return this.lengthKnown||this.cacheLength(),this._chunkSize}}if(globalThis.XMLHttpRequest){L||H("Cannot do synchronous binary XHRs outside webworkers in modern browsers. Use --embed-file or --preload-file in emcc");var s=new o,l={isDevice:!1,contents:s}}else var l={isDevice:!1,url:t};var d=a.createFile(e,r,l,n,i);l.contents?d.contents=l.contents:l.url&&(d.contents=null,d.url=l.url),Object.defineProperties(d,{usedBytes:{get:function(){return this.contents.length}}});var c={};for(let[m,h]of Object.entries(d.stream_ops))c[m]=(...g)=>(a.forceLoadFile(d),h(...g));function v(m,h,g,E,k){var R=m.node.contents;if(k>=R.length)return 0;var D=Math.min(R.length-k,E);if(_(D>=0),R.slice)for(var x=0;x<D;x++)h[g+x]=R[k+x];else for(var x=0;x<D;x++)h[g+x]=R.get(k+x);return D}return c.read=(m,h,g,E,k)=>(a.forceLoadFile(d),v(m,h,g,E,k)),c.mmap=(m,h,g,E,k)=>{a.forceLoadFile(d);var R=xr(h);if(!R)throw new a.ErrnoError(48);return v(m,(u(),W),R,h,g),{ptr:R,allocated:!0}},d.stream_ops=c,d}},T={websocketArgs:{},callbacks:{},on(e,r){T.callbacks[e]=r},emit(e,r){T.callbacks[e]?.(r)},mount(e){return T.websocketArgs=f.websocket||{},(f.websocket??={}).on=T.on,a.createNode(null,"/",16895,0)},createSocket(e,r,t){if(e!=2)throw new a.ErrnoError(5);if(r&=-526337,r!=1&&r!=2)throw new a.ErrnoError(28);var n=r==1;if(n&&t&&t!=6)throw new a.ErrnoError(66);var i={family:e,type:r,protocol:t,server:null,error:null,peers:{},pending:[],recv_queue:[],sock_ops:T.websocket_sock_ops},o=T.nextname(),s=a.createNode(T.root,o,49152,0);s.sock=i;var l=a.createStream({path:o,node:s,flags:2,seekable:!1,stream_ops:T.stream_ops});return i.stream=l,i},getSocket(e){var r=a.getStream(e);return!r||!a.isSocket(r.node.mode)?null:r.node.sock},stream_ops:{poll(e){var r=e.node.sock;return r.sock_ops.poll(r)},ioctl(e,r,t){var n=e.node.sock;return n.sock_ops.ioctl(n,r,t)},read(e,r,t,n,i){var o=e.node.sock,s=o.sock_ops.recvmsg(o,n);return s?(r.set(s.buffer,t),s.buffer.length):0},write(e,r,t,n,i){var o=e.node.sock;return o.sock_ops.sendmsg(o,r,t,n)},close(e){var r=e.node.sock;r.sock_ops.close(r)}},nextname(){return T.nextname.current||(T.nextname.current=0),`socket[${T.nextname.current++}]`},websocket_sock_ops:{createPeer(e,r,t){var n;if(typeof r=="object"&&(n=r,r=null,t=null),n)if(n._socket)r=n._socket.remoteAddress,t=n._socket.remotePort;else{var i=/ws[s]?:\/\/([^:]+):(\d+)/.exec(n.url);if(!i)throw new Error("WebSocket URL must be in the format ws(s)://address:port");r=i[1],t=parseInt(i[2],10)}else try{var o="ws://".replace("#","//"),s="binary",l=void 0;if(T.websocketArgs.url&&(o=T.websocketArgs.url),T.websocketArgs.subprotocol?s=T.websocketArgs.subprotocol:T.websocketArgs.subprotocol===null&&(s="null"),o==="ws://"||o==="wss://"){var d=r.split("/");o=o+d[0]+":"+t+"/"+d.slice(1).join("/")}s!=="null"&&(s=s.replace(/^ +| +$/g,"").split(/ *, */),l=s);var c;C?c=oe("ws"):c=WebSocket,n=new c(o,l),n.binaryType="arraybuffer"}catch{throw new a.ErrnoError(23)}var v={addr:r,port:t,socket:n,msg_send_queue:[]};return T.websocket_sock_ops.addPeer(e,v),T.websocket_sock_ops.handlePeerEvents(e,v),e.type===2&&typeof e.sport<"u"&&v.msg_send_queue.push(new Uint8Array([255,255,255,255,112,111,114,116,(e.sport&65280)>>8,e.sport&255])),v},getPeer(e,r,t){return e.peers[r+":"+t]},addPeer(e,r){e.peers[r.addr+":"+r.port]=r},removePeer(e,r){delete e.peers[r.addr+":"+r.port]},handlePeerEvents(e,r){var t=!0;function n(){e.connecting=!1,T.emit("open",e.stream.fd);try{for(var o=r.msg_send_queue.shift();o;)r.socket.send(o),o=r.msg_send_queue.shift()}catch{r.socket.close()}}function i(o){if(typeof o=="string"){var s=new TextEncoder;o=s.encode(o)}else{if(_(o.byteLength!==void 0),o.byteLength==0)return;o=new Uint8Array(o)}var l=t;if(t=!1,l&&o.length===10&&o[0]===255&&o[1]===255&&o[2]===255&&o[3]===255&&o[4]===112&&o[5]===111&&o[6]===114&&o[7]===116){var d=o[8]<<8|o[9];T.websocket_sock_ops.removePeer(e,r),r.port=d,T.websocket_sock_ops.addPeer(e,r);return}e.recv_queue.push({addr:r.addr,port:r.port,data:o}),T.emit("message",e.stream.fd)}if(C){r.socket.on("open",n),r.socket.on("message",(o,s)=>{s&&i(new Uint8Array(o).buffer)}),r.socket.on("close",()=>T.emit("close",e.stream.fd)),r.socket.on("error",o=>{e.error=14,T.emit("error",[e.stream.fd,e.error,"ECONNREFUSED: Connection refused"])});return}r.socket.onopen=n,r.socket.onclose=()=>T.emit("close",e.stream.fd),r.socket.onmessage=o=>i(o.data),r.socket.onerror=o=>{e.error=14,T.emit("error",[e.stream.fd,e.error,"ECONNREFUSED: Connection refused"])}},poll(e){if(e.type===1&&e.server)return e.pending.length?65:0;var r=0,t=e.type===1?T.websocket_sock_ops.getPeer(e,e.daddr,e.dport):null;return(e.recv_queue.length||!t||t&&t.socket.readyState===t.socket.CLOSING||t&&t.socket.readyState===t.socket.CLOSED)&&(r|=65),(!t||t&&t.socket.readyState===t.socket.OPEN)&&(r|=4),(t&&t.socket.readyState===t.socket.CLOSING||t&&t.socket.readyState===t.socket.CLOSED)&&(e.connecting?r|=4:r|=16),r},ioctl(e,r,t){switch(r){case 21531:var n=0;return e.recv_queue.length&&(n=e.recv_queue[0].data.length),(u(),S)[t>>2]=n,0;case 21537:var i=(u(),S)[t>>2];return i?e.stream.flags|=2048:e.stream.flags&=-2049,0;default:return 28}},close(e){if(e.server){try{e.server.close()}catch{}e.server=null}for(var r of Object.values(e.peers)){try{r.socket.close()}catch{}T.websocket_sock_ops.removePeer(e,r)}return 0},bind(e,r,t){if(typeof e.saddr<"u"||typeof e.sport<"u")throw new a.ErrnoError(28);if(e.saddr=r,e.sport=t,e.type===2){e.server&&(e.server.close(),e.server=null);try{e.sock_ops.listen(e,0)}catch(n){if(n.name!=="ErrnoError"||n.errno!==138)throw n}}},connect(e,r,t){if(e.server)throw new a.ErrnoError(138);if(typeof e.daddr<"u"&&typeof e.dport<"u"){var n=T.websocket_sock_ops.getPeer(e,e.daddr,e.dport);if(n)throw n.socket.readyState===n.socket.CONNECTING?new a.ErrnoError(7):new a.ErrnoError(30)}var i=T.websocket_sock_ops.createPeer(e,r,t);e.daddr=i.addr,e.dport=i.port,e.connecting=!0},listen(e,r){if(!C)throw new a.ErrnoError(138);if(e.server)throw new a.ErrnoError(28);var t=oe("ws").Server,n=e.saddr;e.server=new t({host:n,port:e.sport}),T.emit("listen",e.stream.fd),e.server.on("connection",i=>{if(e.type===1){var o=T.createSocket(e.family,e.type,e.protocol),s=T.websocket_sock_ops.createPeer(o,i);o.daddr=s.addr,o.dport=s.port,e.pending.push(o),T.emit("connection",o.stream.fd)}else T.websocket_sock_ops.createPeer(e,i),T.emit("connection",e.stream.fd)}),e.server.on("close",()=>{T.emit("close",e.stream.fd),e.server=null}),e.server.on("error",i=>{e.error=23,T.emit("error",[e.stream.fd,e.error,"EHOSTUNREACH: Host is unreachable"])})},accept(e){if(!e.server||!e.pending.length)throw new a.ErrnoError(28);var r=e.pending.shift();return r.stream.flags=e.stream.flags,r},getname(e,r){var t,n;if(r){if(e.daddr===void 0||e.dport===void 0)throw new a.ErrnoError(53);t=e.daddr,n=e.dport}else t=e.saddr||0,n=e.sport||0;return{addr:t,port:n}},sendmsg(e,r,t,n,i,o){if(e.type===2){if((i===void 0||o===void 0)&&(i=e.daddr,o=e.dport),i===void 0||o===void 0)throw new a.ErrnoError(17)}else i=e.daddr,o=e.dport;var s=T.websocket_sock_ops.getPeer(e,i,o);if(e.type===1&&(!s||s.socket.readyState===s.socket.CLOSING||s.socket.readyState===s.socket.CLOSED))throw new a.ErrnoError(53);ArrayBuffer.isView(r)&&(t+=r.byteOffset,r=r.buffer);var l=r.slice(t,t+n);if(l instanceof SharedArrayBuffer&&(l=new Uint8Array(new Uint8Array(l)).buffer),!s||s.socket.readyState!==s.socket.OPEN)return e.type===2&&(!s||s.socket.readyState===s.socket.CLOSING||s.socket.readyState===s.socket.CLOSED)&&(s=T.websocket_sock_ops.createPeer(e,i,o)),s.msg_send_queue.push(l),n;try{return s.socket.send(l),n}catch{throw new a.ErrnoError(28)}},recvmsg(e,r){if(e.type===1&&e.server)throw new a.ErrnoError(53);var t=e.recv_queue.shift();if(!t){if(e.type===1){var n=T.websocket_sock_ops.getPeer(e,e.daddr,e.dport);if(!n)throw new a.ErrnoError(53);if(n.socket.readyState===n.socket.CLOSING||n.socket.readyState===n.socket.CLOSED)return null;throw new a.ErrnoError(6)}throw new a.ErrnoError(6)}var i=t.data.byteLength||t.data.length,o=t.data.byteOffset||0,s=t.data.buffer||t.data,l=Math.min(r,i),d={buffer:new Uint8Array(s,o,l),addr:t.addr,port:t.port};if(e.type===1&&l<i){var c=i-l;t.data=new Uint8Array(s,o+l,c),e.recv_queue.unshift(t)}return d}}},Hr=e=>{var r=T.getSocket(e);if(!r)throw new a.ErrnoError(8);return r},Br=e=>(e&255)+"."+(e>>8&255)+"."+(e>>16&255)+"."+(e>>24&255),qt=e=>{var r="",t=0,n=0,i=0,o=0,s=0,l=0,d=[e[0]&65535,e[0]>>16,e[1]&65535,e[1]>>16,e[2]&65535,e[2]>>16,e[3]&65535,e[3]>>16],c=!0,v="";for(l=0;l<5;l++)if(d[l]!==0){c=!1;break}if(c){if(v=Br(d[6]|d[7]<<16),d[5]===-1)return r="::ffff:",r+=v,r;if(d[5]===0)return r="::",v==="0.0.0.0"&&(v=""),v==="0.0.0.1"&&(v="1"),r+=v,r}for(t=0;t<8;t++)d[t]===0&&(t-i>1&&(s=0),i=t,s++),s>n&&(n=s,o=t-n+1);for(t=0;t<8;t++){if(n>1&&d[t]===0&&t>=o&&t<o+n){t===o&&(r+=":",o===0&&(r+=":"));continue}r+=Number(nt(d[t]&65535)).toString(16),r+=t<7?":":""}return r},ji=(e,r)=>{var t=(u(),J)[e>>1],n=nt((u(),ye)[e+2>>1]),i;switch(t){case 2:if(r!==16)return{errno:28};i=(u(),S)[e+4>>2],i=Br(i);break;case 10:if(r!==28)return{errno:28};i=[(u(),S)[e+8>>2],(u(),S)[e+12>>2],(u(),S)[e+16>>2],(u(),S)[e+20>>2]],i=qt(i);break;default:return{errno:5}}return{family:t,addr:i,port:n}},or=e=>{for(var r=e.split("."),t=0;t<4;t++){var n=Number(r[t]);if(isNaN(n))return null;r[t]=n}return(r[0]|r[1]<<8|r[2]<<16|r[3]<<24)>>>0},zr=e=>{var r,t,n,i,o,s=/^((?=.*::)(?!.*::.+::)(::)?([\dA-F]{1,4}:(:|\b)|){5}|([\dA-F]{1,4}:){6})((([\dA-F]{1,4}((?!\3)::|:\b|$))|(?!\2\3)){2}|(((2[0-4]|1\d|[1-9])?\d|25[0-5])\.?\b){4})$/i,l=[];if(!s.test(e))return null;if(e==="::")return[0,0,0,0,0,0,0,0];for(e.startsWith("::")?e=e.replace("::","Z:"):e=e.replace("::",":Z:"),e.indexOf(".")>0?(e=e.replace(new RegExp("[.]","g"),":"),r=e.split(":"),r[r.length-4]=Number(r[r.length-4])+Number(r[r.length-3])*256,r[r.length-3]=Number(r[r.length-2])+Number(r[r.length-1])*256,r=r.slice(0,r.length-2)):r=e.split(":"),n=0,i=0,t=0;t<r.length;t++)if(typeof r[t]=="string")if(r[t]==="Z"){for(i=0;i<8-r.length+1;i++)l[t+i]=0;n=i-1}else l[t+n]=br(parseInt(r[t],16));else l[t+n]=r[t];return[l[1]<<16|l[0],l[3]<<16|l[2],l[5]<<16|l[4],l[7]<<16|l[6]]},de={address_map:{id:1,addrs:{},names:{}},lookup_name(e){var r=or(e);if(r!==null||(r=zr(e),r!==null))return e;var t;if(de.address_map.addrs[e])t=de.address_map.addrs[e];else{var n=de.address_map.id++;_(n<65535,"exceeded max address mappings of 65535"),t="172.29."+(n&255)+"."+(n&65280),de.address_map.names[t]=e,de.address_map.addrs[e]=t}return t},lookup_addr(e){return de.address_map.names[e]?de.address_map.names[e]:null}},Kt=(e,r)=>{var t=ji(e,r);if(t.errno)throw new a.ErrnoError(t.errno);return t.addr=de.lookup_addr(t.addr)||t.addr,t};function Xt(e,r,t,n,i,o){if(w)return B(3,0,1,e,r,t,n,i,o);try{var s=Hr(e),l=Kt(r,t);return s.sock_ops.connect(s,l.addr,l.port),0}catch(d){if(typeof a>"u"||d.name!=="ErrnoError")throw d;return-d.errno}}var z={currentUmask:18,calculateAt(e,r,t){if($.isAbs(r))return r;var n;if(e===-100)n=a.cwd();else{var i=z.getStreamFromFD(e);n=i.path}if(r.length==0){if(!t)throw new a.ErrnoError(44);return n}return n+"/"+r},writeStat(e,r){(u(),y)[e>>2]=r.dev,(u(),y)[e+4>>2]=r.mode,(u(),y)[e+8>>2]=r.nlink,(u(),y)[e+12>>2]=r.uid,(u(),y)[e+16>>2]=r.gid,(u(),y)[e+20>>2]=r.rdev,(u(),V)[e+24>>3]=BigInt(r.size),(u(),S)[e+32>>2]=4096,(u(),S)[e+36>>2]=r.blocks;var t=r.atime.getTime(),n=r.mtime.getTime(),i=r.ctime.getTime();return(u(),V)[e+40>>3]=BigInt(Math.floor(t/1e3)),(u(),y)[e+48>>2]=t%1e3*1e3*1e3,(u(),V)[e+56>>3]=BigInt(Math.floor(n/1e3)),(u(),y)[e+64>>2]=n%1e3*1e3*1e3,(u(),V)[e+72>>3]=BigInt(Math.floor(i/1e3)),(u(),y)[e+80>>2]=i%1e3*1e3*1e3,(u(),V)[e+88>>3]=BigInt(r.ino),0},writeStatFs(e,r){(u(),y)[e+4>>2]=r.bsize,(u(),y)[e+60>>2]=r.bsize,(u(),V)[e+8>>3]=BigInt(r.blocks),(u(),V)[e+16>>3]=BigInt(r.bfree),(u(),V)[e+24>>3]=BigInt(r.bavail),(u(),V)[e+32>>3]=BigInt(r.files),(u(),V)[e+40>>3]=BigInt(r.ffree),(u(),y)[e+48>>2]=r.fsid,(u(),y)[e+64>>2]=r.flags,(u(),y)[e+56>>2]=r.namelen},doMsync(e,r,t,n,i){if(!a.isFile(r.node.mode))throw new a.ErrnoError(43);if(n&2)return 0;var o=(u(),K).slice(e,e+t);a.msync(r,o,i,t,n)},getStreamFromFD(e){var r=a.getStreamChecked(e);return r},varargs:void 0,getStr(e){var r=le(e);return r}};function Yt(e){if(w)return B(4,0,1,e);try{var r=z.getStreamFromFD(e);return a.dupStream(r).fd}catch(t){if(typeof a>"u"||t.name!=="ErrnoError")throw t;return-t.errno}}var sr=()=>{_(z.varargs!=null);var e=(u(),S)[+z.varargs>>2];return z.varargs+=4,e},Ne=sr;function Jt(e,r,t){if(w)return B(5,0,1,e,r,t);z.varargs=t;try{var n=z.getStreamFromFD(e);switch(r){case 0:{var i=sr();if(i<0)return-28;for(;a.streams[i];)i++;var o;return o=a.dupStream(n,i),o.fd}case 1:case 2:return 0;case 3:return n.flags;case 4:{var i=sr(),s=289792;return n.flags=n.flags&~s|i&s,0}case 12:{var i=Ne(),l=0;return(u(),J)[i+l>>1]=2,0}case 13:case 14:return 0}return-28}catch(d){if(typeof a>"u"||d.name!=="ErrnoError")throw d;return-d.errno}}var he=(e,r,t)=>(_(typeof t=="number","stringToUTF8 requires a third parameter that specifies the length of the output buffer"),Bt(e,(u(),K),r,t));function Zt(e,r){if(w)return B(6,0,1,e,r);try{if(r===0)return-28;var t=a.cwd(),n=be(t)+1;return r<n?-68:(he(t,e,r),n)}catch(i){if(typeof a>"u"||i.name!=="ErrnoError")throw i;return-i.errno}}function Qt(e,r,t){if(w)return B(7,0,1,e,r,t);z.varargs=t;try{var n=z.getStreamFromFD(e);switch(r){case 21509:return n.tty?0:-59;case 21505:{if(!n.tty)return-59;if(n.tty.ops.ioctl_tcgets){var i=n.tty.ops.ioctl_tcgets(n),o=Ne();(u(),S)[o>>2]=i.c_iflag||0,(u(),S)[o+4>>2]=i.c_oflag||0,(u(),S)[o+8>>2]=i.c_cflag||0,(u(),S)[o+12>>2]=i.c_lflag||0;for(var s=0;s<32;s++)(u(),W)[o+s+17]=i.c_cc[s]||0;return 0}return 0}case 21510:case 21511:case 21512:return n.tty?0:-59;case 21506:case 21507:case 21508:{if(!n.tty)return-59;if(n.tty.ops.ioctl_tcsets){for(var o=Ne(),l=(u(),S)[o>>2],d=(u(),S)[o+4>>2],c=(u(),S)[o+8>>2],v=(u(),S)[o+12>>2],m=[],s=0;s<32;s++)m.push((u(),W)[o+s+17]);return n.tty.ops.ioctl_tcsets(n.tty,r,{c_iflag:l,c_oflag:d,c_cflag:c,c_lflag:v,c_cc:m})}return 0}case 21519:{if(!n.tty)return-59;var o=Ne();return(u(),S)[o>>2]=0,0}case 21520:return n.tty?-28:-59;case 21537:case 21531:{var o=Ne();return a.ioctl(n,r,o)}case 21523:{if(!n.tty)return-59;if(n.tty.ops.ioctl_tiocgwinsz){var h=n.tty.ops.ioctl_tiocgwinsz(n.tty),o=Ne();(u(),J)[o>>1]=h[0],(u(),J)[o+2>>1]=h[1]}return 0}case 21524:return n.tty?0:-59;case 21515:return n.tty?0:-59;default:return-28}}catch(g){if(typeof a>"u"||g.name!=="ErrnoError")throw g;return-g.errno}}function en(e,r,t,n){if(w)return B(8,0,1,e,r,t,n);z.varargs=n;try{r=z.getStr(r),r=z.calculateAt(e,r);var i=n?sr():0;return t&64&&(i&=~z.currentUmask),a.open(r,t,i).fd}catch(o){if(typeof a>"u"||o.name!=="ErrnoError")throw o;return-o.errno}}function rn(e,r,t,n){if(w)return B(9,0,1,e,r,t,n);try{if(r=z.getStr(r),r=z.calculateAt(e,r),n<=0)return-28;var i=a.readlink(r),o=Math.min(n,be(i)),s=(u(),W)[t+o];return he(i,t,n+1),(u(),W)[t+o]=s,o}catch(l){if(typeof a>"u"||l.name!=="ErrnoError")throw l;return-l.errno}}var tn=(e,r)=>(u(),K).fill(0,e,e+r),nn=(e,r,t,n,i)=>{switch(r){case 2:t=or(t),tn(e,16),i&&((u(),S)[i>>2]=16),(u(),J)[e>>1]=r,(u(),S)[e+4>>2]=t,(u(),J)[e+2>>1]=br(n);break;case 10:t=zr(t),tn(e,28),i&&((u(),S)[i>>2]=28),(u(),S)[e>>2]=r,(u(),S)[e+8>>2]=t[0],(u(),S)[e+12>>2]=t[1],(u(),S)[e+16>>2]=t[2],(u(),S)[e+20>>2]=t[3],(u(),J)[e+2>>1]=br(n);break;default:return 5}return 0};function an(e,r,t,n,i,o){if(w)return B(10,0,1,e,r,t,n,i,o);try{var s=Hr(e),l=s.sock_ops.recvmsg(s,t);if(!l)return 0;if(i){var d=nn(i,s.family,de.lookup_name(l.addr),l.port,o);_(!d)}return(u(),K).set(l.buffer,r),l.buffer.byteLength}catch(c){if(typeof a>"u"||c.name!=="ErrnoError")throw c;return-c.errno}}function on(e){if(w)return B(11,0,1,e);try{return e=z.getStr(e),a.rmdir(e),0}catch(r){if(typeof a>"u"||r.name!=="ErrnoError")throw r;return-r.errno}}function sn(e,r,t,n,i,o){if(w)return B(12,0,1,e,r,t,n,i,o);try{var s=Hr(e);if(!i)return a.write(s.stream,(u(),W),r,t);var l=Kt(i,o);return s.sock_ops.sendmsg(s,(u(),W),r,t,l.addr,l.port)}catch(d){if(typeof a>"u"||d.name!=="ErrnoError")throw d;return-d.errno}}function ln(e,r,t){if(w)return B(13,0,1,e,r,t);try{var n=T.createSocket(e,r,t);return _(n.stream.fd<64),n.stream.fd}catch(i){if(typeof a>"u"||i.name!=="ErrnoError")throw i;return-i.errno}}function dn(e,r,t){if(w)return B(14,0,1,e,r,t);try{if(r=z.getStr(r),r=z.calculateAt(e,r),!t)a.unlink(r);else if(t===512)a.rmdir(r);else return-28;return 0}catch(n){if(typeof a>"u"||n.name!=="ErrnoError")throw n;return-n.errno}}var Hi=()=>H("native code called abort()"),lr={},dr=e=>{for(;e.length;){var r=e.pop(),t=e.pop();t(r)}};function je(e){return this.fromWireType((u(),y)[e>>2])}var Me={},Se={},ur={},Bi=class extends Error{constructor(r){super(r),this.name="InternalError"}},cr=e=>{throw new Bi(e)},ie=(e,r,t)=>{e.forEach(l=>ur[l]=r);function n(l){var d=t(l);d.length!==e.length&&cr("Mismatched type converter count");for(var c=0;c<e.length;++c)Z(e[c],d[c])}var i=new Array(r.length),o=[],s=0;for(let[l,d]of r.entries())Se.hasOwnProperty(d)?i[l]=Se[d]:(o.push(d),Me.hasOwnProperty(d)||(Me[d]=[]),Me[d].push(()=>{i[l]=Se[d],++s,s===o.length&&n(i)}));o.length===0&&n(i)},zi=e=>{var r=lr[e];delete lr[e];var t=r.rawConstructor,n=r.rawDestructor,i=r.fields,o=i.map(s=>s.getterReturnType).concat(i.map(s=>s.setterArgumentType));ie([e],o,s=>{var l={};for(var[d,c]of i.entries()){let v=s[d],m=c.getter,h=c.getterContext,g=s[d+i.length],E=c.setter,k=c.setterContext;l[c.fieldName]={read:R=>v.fromWireType(m(h,R)),write:(R,D)=>{var x=[];E(k,R,g.toWireType(x,D)),dr(x)},optional:v.optional}}return[{name:r.name,fromWireType:v=>{var m={};for(var h in l)m[h]=l[h].read(v);return n(v),m},toWireType:(v,m)=>{for(var h in l)if(!(h in m)&&!l[h].optional)throw new TypeError(`Missing field: "${h}"`);var g=t();for(h in l)l[h].write(g,m[h]);return v!==null&&v.push(n,g),g},readValueFromPointer:je,destructorFunction:n}]})},G=e=>{for(var r="";;){var t=(u(),K)[e++];if(!t)return r;r+=String.fromCharCode(t)}},He=class extends Error{constructor(r){super(r),this.name="BindingError"}},O=e=>{throw new He(e)};function Gi(e,r,t={}){var n=r.name;if(e||O(`type "${n}" must have a positive integer typeid pointer`),Se.hasOwnProperty(e)){if(t.ignoreDuplicateRegistrations)return;O(`Cannot register type '${n}' twice`)}if(Se[e]=r,delete ur[e],Me.hasOwnProperty(e)){var i=Me[e];delete Me[e],i.forEach(o=>o())}}function Z(e,r,t={}){return Gi(e,r,t)}var un=(e,r,t)=>{switch(r){case 1:return t?n=>(u(),W)[n]:n=>(u(),K)[n];case 2:return t?n=>(u(),J)[n>>1]:n=>(u(),ye)[n>>1];case 4:return t?n=>(u(),S)[n>>2]:n=>(u(),y)[n>>2];case 8:return t?n=>(u(),V)[n>>3]:n=>(u(),Tt)[n>>3];default:throw new TypeError(`invalid integer width (${r}): ${e}`)}},ke=e=>{if(e===null)return"null";var r=typeof e;return r==="object"||r==="array"||r==="function"?e.toString():""+e},cn=(e,r,t,n)=>{if(r<t||r>n)throw new TypeError(`Passing a number "${ke(r)}" from JS side to C/C++ side to an argument of type "${e}", which is outside the valid range [${t}, ${n}]!`)},Vi=(e,r,t,n,i)=>{r=G(r);let o=n===0n,s=l=>l;if(o){let l=t*8;s=d=>BigInt.asUintN(l,d),i=s(i)}Z(e,{name:r,fromWireType:s,toWireType:(l,d)=>{if(typeof d=="number")d=BigInt(d);else if(typeof d!="bigint")throw new TypeError(`Cannot convert "${ke(d)}" to ${r}`);return cn(r,d,n,i),d},readValueFromPointer:un(r,t,!o),destructorFunction:null})},qi=(e,r,t,n)=>{r=G(r),Z(e,{name:r,fromWireType:function(i){return!!i},toWireType:function(i,o){return o?t:n},readValueFromPointer:function(i){return this.fromWireType((u(),K)[i])},destructorFunction:null})},Ki=e=>({count:e.count,deleteScheduled:e.deleteScheduled,preservePointerOnDelete:e.preservePointerOnDelete,ptr:e.ptr,ptrType:e.ptrType,smartPtr:e.smartPtr,smartPtrType:e.smartPtrType}),Gr=e=>{function r(t){return t.$$.ptrType.registeredClass.name}O(r(e)+" instance already deleted")},Vr=!1,fn=e=>{},Xi=e=>{e.smartPtr?e.smartPtrType.rawDestructor(e.smartPtr):e.ptrType.registeredClass.rawDestructor(e.ptr)},_n=e=>{e.count.value-=1;var r=e.count.value===0;r&&Xi(e)},vn=(e,r,t)=>{if(r===t)return e;if(t.baseClass===void 0)return null;var n=vn(e,r,t.baseClass);return n===null?null:t.downcast(n)},mn={},Yi={},Ji=(e,r)=>{for(r===void 0&&O("ptr should not be undefined");e.baseClass;)r=e.upcast(r),e=e.baseClass;return r},Zi=(e,r)=>(r=Ji(e,r),Yi[r]),fr=(e,r)=>{(!r.ptrType||!r.ptr)&&cr("makeClassHandle requires ptr and ptrType");var t=!!r.smartPtrType,n=!!r.smartPtr;return t!==n&&cr("Both smartPtrType and smartPtr must be specified"),r.count={value:1},Be(Object.create(e,{$$:{value:r,writable:!0}}))};function hn(e){var r=this.getPointee(e);if(!r)return this.destructor(e),null;var t=Zi(this.registeredClass,r);if(t!==void 0){if(t.$$.count.value===0)return t.$$.ptr=r,t.$$.smartPtr=e,t.clone();var n=t.clone();return this.destructor(e),n}function i(){return this.isSmartPointer?fr(this.registeredClass.instancePrototype,{ptrType:this.pointeeType,ptr:r,smartPtrType:this,smartPtr:e}):fr(this.registeredClass.instancePrototype,{ptrType:this,ptr:e})}var o=this.registeredClass.getActualType(r),s=mn[o];if(!s)return i.call(this);var l;this.isConst?l=s.constPointerType:l=s.pointerType;var d=vn(r,this.registeredClass,l.registeredClass);return d===null?i.call(this):this.isSmartPointer?fr(l.registeredClass.instancePrototype,{ptrType:l,ptr:d,smartPtrType:this,smartPtr:e}):fr(l.registeredClass.instancePrototype,{ptrType:l,ptr:d})}var Be=e=>globalThis.FinalizationRegistry?(Vr=new FinalizationRegistry(r=>{console.warn(r.leakWarning),_n(r.$$)}),Be=r=>{var t=r.$$,n=!!t.smartPtr;if(n){var i={$$:t},o=t.ptrType.registeredClass,s=new Error(`Embind found a leaked C++ instance ${o.name} <${me(t.ptr)}>.
1
+ async function li(se={}){var m;(function(){function e(c){c=c.split("-")[0];for(var u=c.split(".").slice(0,3);u.length<3;)u.push("00");return u=u.map((v,h,p)=>v.padStart(2,"0")),u.join("")}var r=c=>[c/1e4|0,(c/100|0)%100,c%100].join("."),t=2147483647,n=typeof process<"u"&&process.versions?.node?e(process.versions.node):t;if(n<180300)throw new Error(`This emscripten-generated code requires node v${r(180300)} (detected v${r(n)})`);var i=typeof navigator<"u"&&navigator.userAgent;if(i){var a=i.includes("Safari/")&&!i.includes("Chrome/")&&i.match(/Version\/(\d+\.?\d*\.?\d*)/)?e(i.match(/Version\/(\d+\.?\d*\.?\d*)/)[1]):t;if(a<15e4)throw new Error(`This emscripten-generated code requires Safari v${r(15e4)} (detected v${a})`);var s=i.match(/Firefox\/(\d+(?:\.\d+)?)/)?parseFloat(i.match(/Firefox\/(\d+(?:\.\d+)?)/)[1]):t;if(s<114)throw new Error(`This emscripten-generated code requires Firefox v114 (detected v${s})`);var l=i.match(/Chrome\/(\d+(?:\.\d+)?)/)?parseFloat(i.match(/Chrome\/(\d+(?:\.\d+)?)/)[1]):t;if(l<85)throw new Error(`This emscripten-generated code requires Chrome v85 (detected v${l})`)}})();var f=se,j=!!globalThis.window,B=!!globalThis.WorkerGlobalScope,C=globalThis.process?.versions?.node&&globalThis.process?.type!="renderer",me=!j&&!C&&!B,w=B&&globalThis.name?.startsWith("em-pthread");if(w&&(_(!globalThis.moduleLoaded,"module should only be loaded once on each pthread worker"),globalThis.moduleLoaded=!0),C){let{createRequire:e}=await import("node:module");var ue=e(import.meta.url),rr=ue("node:worker_threads");globalThis.Worker=rr.Worker,B=!rr.isMainThread,w=B&&rr.workerData=="em-pthread"}var gt=[],Ar="./this.program",Or=(e,r)=>{throw r},Rr=import.meta.url,tr="";function pi(e){return f.locateFile?f.locateFile(e,tr):tr+e}var nr,He;if(C){if(!(globalThis.process?.versions?.node&&globalThis.process?.type!="renderer"))throw new Error("not compiled for this environment (did you build to HTML and try to run it not on the web, or set ENVIRONMENT to something - like node - and run it someplace else - like on the web?)");var N=ue("node:fs");Rr.startsWith("file:")&&(tr=ue("node:path").dirname(ue("node:url").fileURLToPath(Rr))+"/"),He=r=>{r=ir(r)?new URL(r):r;var t=N.readFileSync(r);return _(Buffer.isBuffer(t)),t},nr=async(r,t=!0)=>{r=ir(r)?new URL(r):r;var n=N.readFileSync(r,t?void 0:"utf8");return _(t?Buffer.isBuffer(n):typeof n=="string"),n},process.argv.length>1&&(Ar=process.argv[1].replace(/\\/g,"/")),gt=process.argv.slice(2),Or=(r,t)=>{throw process.exitCode=r,t}}else if(!me)if(j||B){try{tr=new URL(".",Rr).href}catch{}if(!(globalThis.window||globalThis.WorkerGlobalScope))throw new Error("not compiled for this environment (did you build to HTML and try to run it not on the web, or set ENVIRONMENT to something - like node - and run it someplace else - like on the web?)");C||(B&&(He=e=>{var r=new XMLHttpRequest;return r.open("GET",e,!1),r.responseType="arraybuffer",r.send(null),new Uint8Array(r.response)}),nr=async e=>{_(!ir(e),"readAsync does not work with file:// URLs");var r=await fetch(e,{credentials:"same-origin"});if(r.ok)return r.arrayBuffer();throw new Error(r.status+" : "+r.url)})}else throw new Error("environment detection error");var yt=console.log.bind(console),wt=console.error.bind(console);if(C){var mi=ue("node:util"),Et=e=>typeof e=="object"?mi.inspect(e):e;yt=(...e)=>N.writeSync(1,e.map(Et).join(" ")+`
2
+ `),wt=(...e)=>N.writeSync(2,e.map(Et).join(" ")+`
3
+ `)}var ge=yt,A=wt,Ds="IDBFS is no longer included by default; build with -lidbfs.js",Is="PROXYFS is no longer included by default; build with -lproxyfs.js",$s="WORKERFS is no longer included by default; build with -lworkerfs.js",Ns="FETCHFS is no longer included by default; build with -lfetchfs.js",Ms="ICASEFS is no longer included by default; build with -licasefs.js",xs="JSFILEFS is no longer included by default; build with -ljsfilefs.js",Ws="OPFS is no longer included by default; build with -lopfs.js";_(j||B||C,"pthreads do not work in this environment yet (need Web Workers, or an alternative to them)"),_(!j,"web environment detected but not enabled at build time (add `web` to `-sENVIRONMENT` to enable)"),_(!me,"shell environment detected but not enabled at build time (add `shell` to `-sENVIRONMENT` to enable)");var Be;globalThis.WebAssembly||A("no native wasm support detected");var be,Ie=!1,$e;function _(e,r){e||q("Assertion failed"+(r?": "+r:""))}var ir=e=>e.startsWith("file://");function bt(){var e=ct();_((e&3)==0),e==0&&(e+=4),(d(),y)[e>>2]=34821223,(d(),y)[e+4>>2]=2310721022,(d(),y)[0]=1668509029}function ze(){if(!Ie){var e=ct();e==0&&(e+=4);var r=(d(),y)[e>>2],t=(d(),y)[e+4>>2];(r!=34821223||t!=2310721022)&&q(`Stack overflow! Stack cookie has been overwritten at ${we(e)}, expected hex dwords 0x89BACDFE and 0x2135467, but received ${we(t)} ${we(r)}`),(d(),y)[0]!=1668509029&&q("Runtime error: The application has corrupted its heap memory area (address zero)!")}}class L{}class Ls extends L{}var St=!0;function Dr(...e){if(!(!St&&typeof St<"u"))if(C){let n=function(i){switch(typeof i){case"object":return t.inspect(i);case"undefined":return"undefined"}return i};var r=ue("node:fs"),t=ue("node:util");r.writeSync(2,e.map(n).join(" ")+`
4
+ `)}else console.warn(...e)}(()=>{var e=new Int16Array(1),r=new Int8Array(e.buffer);e[0]=25459,(r[0]!==115||r[1]!==99)&&q("Runtime error: expected the system to be little-endian! (Run with -sSUPPORT_BIG_ENDIAN to bypass)")})();function ar(e){Object.getOwnPropertyDescriptor(f,e)||Object.defineProperty(f,e,{configurable:!0,set(){q(`Attempt to set \`Module.${e}\` after it has already been processed. This can happen, for example, when code is injected via '--post-js' rather than '--pre-js'`)}})}function $(e){return()=>_(!1,`call to '${e}' via reference taken before Wasm module initialization`)}function Se(e){Object.getOwnPropertyDescriptor(f,e)&&q(`\`Module.${e}\` was supplied but \`${e}\` not included in INCOMING_MODULE_JS_API`)}function gi(e){return e==="FS_createPath"||e==="FS_createDataFile"||e==="FS_createPreloadedFile"||e==="FS_preloadFile"||e==="FS_unlink"||e==="addRunDependency"||e==="FS_createLazyFile"||e==="FS_createDevice"||e==="removeRunDependency"}function yi(e){kt(e)}function kt(e){w||Object.getOwnPropertyDescriptor(f,e)||Object.defineProperty(f,e,{configurable:!0,get(){var r=`'${e}' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the Emscripten FAQ)`;gi(e)&&(r+=". Alternatively, forcing filesystem support (-sFORCE_FILESYSTEM) can export this for you"),q(r)}})}function wi(){function e(){var t=0;return Ne&&typeof Re<"u"&&(t=Re()),`w:${Ft},t:${we(t)}:`}var r=Dr;Dr=(...t)=>r(e(),...t)}wi();function d(){fe.buffer!=H.buffer&&or()}var Ir,$r;if(C&&w){globalThis.self=globalThis;var Tt=rr.parentPort;globalThis.postMessage||(Tt.on("message",e=>globalThis.onmessage?.({data:e})),globalThis.postMessage=e=>Tt.postMessage(e)),process.on("uncaughtException",e=>{postMessage({cmd:"uncaughtException",error:e}),process.exit(1)})}var Ft=0,Pt;if(w){let e=function(r){try{var t=r.data,n=t.cmd;if(n==="load"){Ft=t.workerID;let i=[];self.onmessage=a=>i.push(a),Pt=()=>{postMessage({cmd:"loaded"});for(let a of i)e(a);self.onmessage=e};for(let a of t.handlers)(!f[a]||f[a].proxy)&&(f[a]=(...s)=>{postMessage({cmd:"callHandler",handler:a,args:s})},a=="print"&&(ge=f[a]),a=="printErr"&&(A=f[a]));fe=t.wasmMemory,or(),be=t.wasmModule,Ot(),Cr()}else if(n==="run"){_(t.pthread_ptr),Di(t.pthread_ptr),st(t.pthread_ptr,0,0,1,0,0),P.threadInitTLS(),it(t.pthread_ptr),Nr||(qn(),Nr=!0);try{Ii(t.start_routine,t.arg)}catch(i){if(i!="unwind")throw i}}else t.target==="setimmediate"||(n==="checkMailbox"?Nr&&Tr():n&&(A(`worker: received unknown command ${n}`),A(t)))}catch(i){throw A(`worker: onmessage() captured an uncaught exception: ${i}`),i?.stack&&A(i.stack),Yn(),i}};var Nr=!1;self.onunhandledrejection=r=>{throw r.reason||r},self.onmessage=e}var Ne=!1;function or(){var e=fe.buffer;H=new Int8Array(e),te=new Int16Array(e),f.HEAPU8=Q=new Uint8Array(e),ke=new Uint16Array(e),S=new Int32Array(e),y=new Uint32Array(e),sr=new Float32Array(e),Me=new Float64Array(e),Z=new BigInt64Array(e),Dt=new BigUint64Array(e)}function Ei(){if(!w){if(f.wasmMemory)fe=f.wasmMemory;else{var e=f.INITIAL_MEMORY||16777216;_(e>=65536,`INITIAL_MEMORY should be larger than STACK_SIZE, was ${e}! (STACK_SIZE=65536)`),fe=new WebAssembly.Memory({initial:e/65536,maximum:32768,shared:!0})}or()}}_(globalThis.Int32Array&&globalThis.Float64Array&&Int32Array.prototype.subarray&&Int32Array.prototype.set,"JS engine does not provide full typed array support");function bi(){if(_(!w),f.preRun)for(typeof f.preRun=="function"&&(f.preRun=[f.preRun]);f.preRun.length;)xt(f.preRun.shift());ar("preRun"),Nt(Mt)}function Ct(){if(_(!Ne),Ne=!0,w)return Pt();ze(),T.root=o.mount(T,{},null),!f.noFSInit&&!o.initialized&&o.init(),pe.init(),De.__wasm_call_ctors(),o.ignorePermissions=!1}function Si(){if(ze(),!w){if(f.postRun)for(typeof f.postRun=="function"&&(f.postRun=[f.postRun]);f.postRun.length;)Ri(f.postRun.shift());ar("postRun"),Nt(Ht)}}function q(e){f.onAbort?.(e),e=`Aborted(${e})`,A(e),Ie=!0;var r=new WebAssembly.RuntimeError(e);throw $r?.(r),r}function J(e,r){return(...t)=>{_(Ne,`native function \`${e}\` called before runtime initialization`);var n=De[e];return _(n,`exported native function \`${e}\` not found`),_(t.length<=r,`native function \`${e}\` called with ${t.length} args but expects ${r}`),n(...t)}}var Mr;function ki(){return f.locateFile?pi("libe57-js.wasm"):new URL("libe57-js.wasm",import.meta.url).href}function Ti(e){if(e==Mr&&Be)return new Uint8Array(Be);if(He)return He(e);throw"both async and sync fetching of the wasm failed"}async function Fi(e){if(!Be)try{var r=await nr(e);return new Uint8Array(r)}catch{}return Ti(e)}async function Pi(e,r){try{var t=await Fi(e),n=await WebAssembly.instantiate(t,r);return n}catch(i){A(`failed to asynchronously prepare wasm: ${i}`),ir(e)&&A(`warning: Loading from a file URI (${e}) is not supported in most browsers. See https://emscripten.org/docs/getting_started/FAQ.html#how-do-i-run-a-local-webserver-for-testing-why-does-my-program-stall-in-downloading-or-preparing`),q(i)}}async function Ci(e,r,t){if(!e&&!C)try{var n=fetch(r,{credentials:"same-origin"}),i=await WebAssembly.instantiateStreaming(n,t);return i}catch(a){A(`wasm streaming compile failed: ${a}`),A("falling back to ArrayBuffer instantiation")}return Pi(r,t)}function At(){Qo();var e={env:vt,wasi_snapshot_preview1:vt};return e}async function Ot(){function e(l,c){return De=l.exports,$i(De._emscripten_tls_init),Zo(De),be=c,De}var r=f;function t(l){return _(f===r,"the Module object should not be replaced during async compilation - perhaps the order of HTML elements is wrong?"),r=null,e(l.instance,l.module)}var n=At();if(f.instantiateWasm)return new Promise((l,c)=>{try{f.instantiateWasm(n,(u,v)=>{l(e(u,v))})}catch(u){A(`Module.instantiateWasm callback failed with error: ${u}`),c(u)}});if(w){_(be,"wasmModule should have been received via postMessage");var i=new WebAssembly.Instance(be,At());return e(i,be)}Mr??=ki();var a=await Ci(Be,Mr,n),s=t(a);return s}class Rt{name="ExitStatus";constructor(r){this.message=`Program terminated with exit(${r})`,this.status=r}}var te,S,Z,H,sr,Me,ke,y,Dt,Q,It=e=>{e.terminate(),e.onmessage=r=>{var t=r.data.cmd;A(`received "${t}" command from terminated worker: ${e.workerID}`)}},$t=e=>{_(!w,"cleanupThread() should only be called from the main thread"),_(e,"null pthread_ptr passed to cleanupThread");var r=P.pthreads[e];_(r),P.returnWorkerToPool(r)},Nt=e=>{for(;e.length>0;)e.shift()(f)},Mt=[],xt=e=>Mt.push(e),Te=0,Ge=null,xe={},ye=null,xr=e=>{if(Te--,f.monitorRunDependencies?.(Te),_(e,"removeRunDependency requires an ID"),_(xe[e]),delete xe[e],Te==0&&(ye!==null&&(clearInterval(ye),ye=null),Ge)){var r=Ge;Ge=null,r()}},Wr=e=>{Te++,f.monitorRunDependencies?.(Te),_(e,"addRunDependency requires an ID"),_(!xe[e]),xe[e]=1,ye===null&&globalThis.setInterval&&(ye=setInterval(()=>{if(Ie){clearInterval(ye),ye=null;return}var r=!1;for(var t in xe)r||(r=!0,A("still waiting on run dependencies:")),A(`dependency: ${t}`);r&&A("(end of list)")},1e4),ye.unref?.())},Wt=e=>{_(!w,"spawnThread() should only be called from the main thread"),_(e.pthread_ptr,"spawnThread called with null pthread ptr");var r=P.getNewWorker();if(!r)return 6;_(!r.pthread_ptr),P.runningWorkers.push(r),P.pthreads[e.pthread_ptr]=r,r.pthread_ptr=e.pthread_ptr;var t={cmd:"run",start_routine:e.startRoutine,arg:e.arg,pthread_ptr:e.pthread_ptr};return C&&r.unref(),r.postMessage(t,e.transferList),0},lr=0,cr=()=>Ur||lr>0,U=()=>ft(),M=e=>ni(e),Ai=e=>ii(e),K=(e,r,t,...n)=>{var i=8*n.length*2,a=U(),s=Ai(i),l=s>>3;for(var c of n)typeof c=="bigint"?((d(),Z)[l++]=1n,(d(),Z)[l++]=c):((d(),Z)[l++]=0n,(d(),Me)[l++]=c);var u=Zn(e,r,i,s,t);return M(a),u};function Lt(e){if(w)return K(0,0,1,e);$e=e,cr()||(P.terminateAllThreads(),f.onExit?.(e),Ie=!0),Or(e,new Rt(e))}function Ut(e){if(w)return K(1,0,0,e);Lr(e)}var Oi=(e,r)=>{if($e=e,As(),w)throw _(!r),Ut(e),"unwind";if(cr()&&!r){var t=`program exited (with status: ${e}), but keepRuntimeAlive() is set (counter=${lr}) due to an async operation, so halting execution but not exiting the runtime or preventing further async execution (you can use emscripten_force_exit, if you want to force a true shutdown)`;$r?.(t),A(t)}Lt(e)},Lr=Oi,jt=!Atomics.waitAsync||globalThis.navigator?.userAgent&&Number((navigator.userAgent.match(/Chrom(e|ium)\/([0-9]+)\./)||[])[2])<91;function we(e){return _(typeof e=="number",`ptrToString expects a number, got ${typeof e}`),e>>>=0,"0x"+e.toString(16).padStart(8,"0")}var P={unusedWorkers:[],runningWorkers:[],tlsInitFunctions:[],pthreads:{},nextWorkerID:1,init(){w||P.initMainThread()},initMainThread(){for(var e=2;e--;)P.allocateUnusedWorker();xt(async()=>{var r=P.loadWasmModuleToAllWorkers();Wr("loading-workers"),await r,xr("loading-workers")})},terminateAllThreads:()=>{_(!w,"terminateAllThreads() should only be called from the main thread");for(var e of P.runningWorkers)It(e);for(var e of P.unusedWorkers)It(e);P.unusedWorkers=[],P.runningWorkers=[],P.pthreads={}},terminateRuntime:()=>{_(!w,"terminateRuntime() should only be called from the main thread"),P.terminateAllThreads();var e=Re();Xn(0,0,0,1),jt||Atomics.notify((d(),S),e>>2)},returnWorkerToPool:e=>{var r=e.pthread_ptr;delete P.pthreads[r],P.unusedWorkers.push(e),P.runningWorkers.splice(P.runningWorkers.indexOf(e),1),e.pthread_ptr=0,Qn(r)},threadInitTLS(){P.tlsInitFunctions.forEach(e=>e())},loadWasmModuleToWorker:e=>new Promise(r=>{e.onmessage=a=>{var s=a.data,l=s.cmd;if(s.targetThread&&s.targetThread!=Re()){var c=P.pthreads[s.targetThread];c?c.postMessage(s,s.transferList):A(`worker sent message (${l}) to pthread (${s.targetThread}) that no longer exists`);return}l==="checkMailbox"?Tr():l==="spawnThread"?Wt(s):l==="cleanupThread"?$n(()=>$t(s.thread)):l==="loaded"?(e.loaded=!0,C&&!e.pthread_ptr&&e.unref(),r(e)):s.target==="setimmediate"?e.postMessage(s):l==="uncaughtException"?e.onerror(s.error):l==="callHandler"?f[s.handler](...s.args):l&&A(`worker sent an unknown command ${l}`)},e.onerror=a=>{var s="worker sent an error!";throw e.pthread_ptr&&(s=`Pthread ${we(e.pthread_ptr)} sent an error!`),A(`${s} ${a.filename}:${a.lineno}: ${a.message}`),a},C&&(e.on("message",a=>e.onmessage({data:a})),e.on("error",a=>e.onerror(a))),_(fe instanceof WebAssembly.Memory,"wasmMemory should have been loaded by now"),_(be instanceof WebAssembly.Module,"wasmModule should have been loaded by now");var t=[],n=["onExit","onAbort","print","printErr"];for(var i of n)f.propertyIsEnumerable(i)&&t.push(i);e.postMessage({cmd:"load",handlers:t,wasmMemory:fe,wasmModule:be,workerID:e.workerID})}),async loadWasmModuleToAllWorkers(){return w?void 0:Promise.all(P.unusedWorkers.map(P.loadWasmModuleToWorker))},allocateUnusedWorker(){var e;if(f.mainScriptUrlOrBlob){var r=f.mainScriptUrlOrBlob;typeof r!="string"&&(r=URL.createObjectURL(r)),e=new Worker(r,{type:"module",workerData:"em-pthread",name:"em-pthread-"+P.nextWorkerID})}else e=new Worker(new URL("libe57-js.js",import.meta.url),{type:"module",workerData:"em-pthread",name:"em-pthread-"+P.nextWorkerID});e.workerID=P.nextWorkerID++,P.unusedWorkers.push(e)},getNewWorker(){return P.unusedWorkers.length==0&&(C||A("Tried to spawn a new thread, but the thread pool is exhausted.\nThis might result in a deadlock unless some threads eventually exit or the code explicitly breaks out to the event loop.\nIf you want to increase the pool size, use setting `-sPTHREAD_POOL_SIZE=...`.\nIf you want to throw an explicit error instead of the risk of deadlocking in those cases, use setting `-sPTHREAD_POOL_SIZE_STRICT=2`."),P.allocateUnusedWorker(),P.loadWasmModuleToWorker(P.unusedWorkers[0])),P.unusedWorkers.pop()}},Ht=[],Ri=e=>Ht.push(e);function Di(e){var r=(d(),y)[e+48>>2],t=(d(),y)[e+52>>2],n=r-t;_(r!=0),_(n!=0),_(r>n,"stackHigh must be higher then stackLow"),ti(r,n),M(r),bt()}function Us(e,r="i8"){switch(r.endsWith("*")&&(r="*"),r){case"i1":return(d(),H)[e];case"i8":return(d(),H)[e];case"i16":return(d(),te)[e>>1];case"i32":return(d(),S)[e>>2];case"i64":return(d(),Z)[e>>3];case"float":return(d(),sr)[e>>2];case"double":return(d(),Me)[e>>3];case"*":return(d(),y)[e>>2];default:q(`invalid type for getValue: ${r}`)}}var Bt=[],x=e=>{var r=Bt[e];return r||(Bt[e]=r=_t.get(e)),_(_t.get(e)==r,"table mirror is out of date"),r},Ii=(e,r)=>{lr=0,Ur=0;var t=x(e)(r);ze();function n(i){if(cr()){$e=i;return}ut(i)}n(t)},Ur=!0,$i=e=>P.tlsInitFunctions.push(e);function js(e,r,t="i8"){switch(t.endsWith("*")&&(t="*"),t){case"i1":(d(),H)[e]=r;break;case"i8":(d(),H)[e]=r;break;case"i16":(d(),te)[e>>1]=r;break;case"i32":(d(),S)[e>>2]=r;break;case"i64":(d(),Z)[e>>3]=BigInt(r);break;case"float":(d(),sr)[e>>2]=r;break;case"double":(d(),Me)[e>>3]=r;break;case"*":(d(),y)[e>>2]=r;break;default:q(`invalid type for setValue: ${t}`)}}var Fe=e=>{Fe.shown||={},Fe.shown[e]||(Fe.shown[e]=1,C&&(e="warning: "+e),A(e))},fe,zt=globalThis.TextDecoder&&new TextDecoder,Gt=(e,r,t,n)=>{var i=r+t;if(n)return i;for(;e[r]&&!(r>=i);)++r;return r},We=(e,r=0,t,n)=>{var i=Gt(e,r,t,n);if(i-r>16&&e.buffer&&zt)return zt.decode(e.buffer instanceof ArrayBuffer?e.subarray(r,i):e.slice(r,i));for(var a="";r<i;){var s=e[r++];if(!(s&128)){a+=String.fromCharCode(s);continue}var l=e[r++]&63;if((s&224)==192){a+=String.fromCharCode((s&31)<<6|l);continue}var c=e[r++]&63;if((s&240)==224?s=(s&15)<<12|l<<6|c:((s&248)!=240&&Fe(`Invalid UTF-8 leading byte ${we(s)} encountered when deserializing a UTF-8 string in wasm memory to a JS string!`),s=(s&7)<<18|l<<12|c<<6|e[r++]&63),s<65536)a+=String.fromCharCode(s);else{var u=s-65536;a+=String.fromCharCode(55296|u>>10,56320|u&1023)}}return a},_e=(e,r,t)=>(_(typeof e=="number",`UTF8ToString expects a number (got ${typeof e})`),e?We((d(),Q),e,r,t):""),Ni=(e,r,t,n)=>q(`Assertion failed: ${_e(e)}, at: `+[r?_e(r):"unknown filename",t,n?_e(n):"unknown function"]),jr=[],Vt=0,Mi=e=>{var r=new qt(e);return r.get_caught()||(r.set_caught(!0),Vt--),r.set_rethrown(!1),jr.push(r),oi(e)},xi=()=>{W(0,0),_(jr.length>0);var e=jr.pop();ai(e.excPtr)},Hr=e=>(setTempRet0(0),0),Wi=()=>Hr([]),Li=e=>Hr([e]),Ui=(e,r)=>Hr([e,r]);class qt{constructor(r){this.excPtr=r,this.ptr=r-24}set_type(r){(d(),y)[this.ptr+4>>2]=r}get_type(){return(d(),y)[this.ptr+4>>2]}set_destructor(r){(d(),y)[this.ptr+8>>2]=r}get_destructor(){return(d(),y)[this.ptr+8>>2]}set_caught(r){r=r?1:0,(d(),H)[this.ptr+12]=r}get_caught(){return(d(),H)[this.ptr+12]!=0}set_rethrown(r){r=r?1:0,(d(),H)[this.ptr+13]=r}get_rethrown(){return(d(),H)[this.ptr+13]!=0}init(r,t){this.set_adjusted_ptr(0),this.set_type(r),this.set_destructor(t)}set_adjusted_ptr(r){(d(),y)[this.ptr+16>>2]=r}get_adjusted_ptr(){return(d(),y)[this.ptr+16>>2]}}var ji=(e,r,t)=>{var n=new qt(e);n.init(r,t),Vt++,_(!1,"Exception thrown, but exception catching is not enabled. Compile with -sNO_DISABLE_EXCEPTION_CATCHING or -sEXCEPTION_CATCHING_ALLOWED=[..] to catch.")};function Kt(e,r,t,n){return w?K(2,0,1,e,r,t,n):Xt(e,r,t,n)}var Hi=()=>!!globalThis.SharedArrayBuffer,Xt=(e,r,t,n)=>{if(!Hi())return Dr("pthread_create: environment does not support SharedArrayBuffer, pthreads are not available"),6;var i=[],a=0;if(w&&(i.length===0||a))return Kt(e,r,t,n);if(a)return a;var s={startRoutine:t,pthread_ptr:e,arg:n,transferList:i};return w?(s.cmd="spawnThread",postMessage(s,i),0):Wt(s)},Bi=e=>{_(!1,"Exception thrown, but exception catching is not enabled. Compile with -sNO_DISABLE_EXCEPTION_CATCHING or -sEXCEPTION_CATCHING_ALLOWED=[..] to catch.")},zi=()=>{if(C){var e=ue("node:crypto");return r=>e.randomFillSync(r)}return r=>(r.set(crypto.getRandomValues(new Uint8Array(r.byteLength))),0)},Br=e=>(Br=zi())(e),I={isAbs:e=>e.charAt(0)==="/",splitPath:e=>{var r=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/;return r.exec(e).slice(1)},normalizeArray:(e,r)=>{for(var t=0,n=e.length-1;n>=0;n--){var i=e[n];i==="."?e.splice(n,1):i===".."?(e.splice(n,1),t++):t&&(e.splice(n,1),t--)}if(r)for(;t;t--)e.unshift("..");return e},normalize:e=>{var r=I.isAbs(e),t=e.slice(-1)==="/";return e=I.normalizeArray(e.split("/").filter(n=>!!n),!r).join("/"),!e&&!r&&(e="."),e&&t&&(e+="/"),(r?"/":"")+e},dirname:e=>{var r=I.splitPath(e),t=r[0],n=r[1];return!t&&!n?".":(n&&(n=n.slice(0,-1)),t+n)},basename:e=>e&&e.match(/([^\/]+|\/)\/*$/)[1],join:(...e)=>I.normalize(e.join("/")),join2:(e,r)=>I.normalize(e+"/"+r)},Le={resolve:(...e)=>{for(var r="",t=!1,n=e.length-1;n>=-1&&!t;n--){var i=n>=0?e[n]:o.cwd();if(typeof i!="string")throw new TypeError("Arguments to path.resolve must be strings");if(!i)return"";r=i+"/"+r,t=I.isAbs(i)}return r=I.normalizeArray(r.split("/").filter(a=>!!a),!t).join("/"),(t?"/":"")+r||"."},relative:(e,r)=>{e=Le.resolve(e).slice(1),r=Le.resolve(r).slice(1);function t(u){for(var v=0;v<u.length&&u[v]==="";v++);for(var h=u.length-1;h>=0&&u[h]==="";h--);return v>h?[]:u.slice(v,h-v+1)}for(var n=t(e.split("/")),i=t(r.split("/")),a=Math.min(n.length,i.length),s=a,l=0;l<a;l++)if(n[l]!==i[l]){s=l;break}for(var c=[],l=s;l<n.length;l++)c.push("..");return c=c.concat(i.slice(s)),c.join("/")}},zr=[],Pe=e=>{for(var r=0,t=0;t<e.length;++t){var n=e.charCodeAt(t);n<=127?r++:n<=2047?r+=2:n>=55296&&n<=57343?(r+=4,++t):r+=3}return r},Yt=(e,r,t,n)=>{if(_(typeof e=="string",`stringToUTF8Array expects a string (got ${typeof e})`),!(n>0))return 0;for(var i=t,a=t+n-1,s=0;s<e.length;++s){var l=e.codePointAt(s);if(l<=127){if(t>=a)break;r[t++]=l}else if(l<=2047){if(t+1>=a)break;r[t++]=192|l>>6,r[t++]=128|l&63}else if(l<=65535){if(t+2>=a)break;r[t++]=224|l>>12,r[t++]=128|l>>6&63,r[t++]=128|l&63}else{if(t+3>=a)break;l>1114111&&Fe(`Invalid Unicode code point ${we(l)} encountered when serializing a JS string to a UTF-8 string in wasm memory! (Valid unicode code points should be in range 0-0x10FFFF).`),r[t++]=240|l>>18,r[t++]=128|l>>12&63,r[t++]=128|l>>6&63,r[t++]=128|l&63,s++}}return r[t]=0,t-i},Gr=(e,r,t)=>{var n=t>0?t:Pe(e)+1,i=new Array(n),a=Yt(e,i,0,i.length);return r&&(i.length=a),i},Gi=()=>{if(!zr.length){var e=null;if(C){var r=256,t=Buffer.alloc(r),n=0,i=process.stdin.fd;try{n=N.readSync(i,t,0,r)}catch(a){if(a.toString().includes("EOF"))n=0;else throw a}n>0&&(e=t.slice(0,n).toString("utf-8"))}if(!e)return null;zr=Gr(e,!0)}return zr.shift()},pe={ttys:[],init(){},shutdown(){},register(e,r){pe.ttys[e]={input:[],output:[],ops:r},o.registerDevice(e,pe.stream_ops)},stream_ops:{open(e){var r=pe.ttys[e.node.rdev];if(!r)throw new o.ErrnoError(43);e.tty=r,e.seekable=!1},close(e){e.tty.ops.fsync(e.tty)},fsync(e){e.tty.ops.fsync(e.tty)},read(e,r,t,n,i){if(!e.tty||!e.tty.ops.get_char)throw new o.ErrnoError(60);for(var a=0,s=0;s<n;s++){var l;try{l=e.tty.ops.get_char(e.tty)}catch{throw new o.ErrnoError(29)}if(l===void 0&&a===0)throw new o.ErrnoError(6);if(l==null)break;a++,r[t+s]=l}return a&&(e.node.atime=Date.now()),a},write(e,r,t,n,i){if(!e.tty||!e.tty.ops.put_char)throw new o.ErrnoError(60);try{for(var a=0;a<n;a++)e.tty.ops.put_char(e.tty,r[t+a])}catch{throw new o.ErrnoError(29)}return n&&(e.node.mtime=e.node.ctime=Date.now()),a}},default_tty_ops:{get_char(e){return Gi()},put_char(e,r){r===null||r===10?(ge(We(e.output)),e.output=[]):r!=0&&e.output.push(r)},fsync(e){e.output?.length>0&&(ge(We(e.output)),e.output=[])},ioctl_tcgets(e){return{c_iflag:25856,c_oflag:5,c_cflag:191,c_lflag:35387,c_cc:[3,28,127,21,4,0,1,0,17,19,26,0,18,15,23,22,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]}},ioctl_tcsets(e,r,t){return 0},ioctl_tiocgwinsz(e){return[24,80]}},default_tty1_ops:{put_char(e,r){r===null||r===10?(A(We(e.output)),e.output=[]):r!=0&&e.output.push(r)},fsync(e){e.output?.length>0&&(A(We(e.output)),e.output=[])}}},Vr=e=>{q("internal error: mmapAlloc called but `emscripten_builtin_memalign` native symbol not exported")},F={ops_table:null,mount(e){return F.createNode(null,"/",16895,0)},createNode(e,r,t,n){if(o.isBlkdev(t)||o.isFIFO(t))throw new o.ErrnoError(63);F.ops_table||={dir:{node:{getattr:F.node_ops.getattr,setattr:F.node_ops.setattr,lookup:F.node_ops.lookup,mknod:F.node_ops.mknod,rename:F.node_ops.rename,unlink:F.node_ops.unlink,rmdir:F.node_ops.rmdir,readdir:F.node_ops.readdir,symlink:F.node_ops.symlink},stream:{llseek:F.stream_ops.llseek}},file:{node:{getattr:F.node_ops.getattr,setattr:F.node_ops.setattr},stream:{llseek:F.stream_ops.llseek,read:F.stream_ops.read,write:F.stream_ops.write,mmap:F.stream_ops.mmap,msync:F.stream_ops.msync}},link:{node:{getattr:F.node_ops.getattr,setattr:F.node_ops.setattr,readlink:F.node_ops.readlink},stream:{}},chrdev:{node:{getattr:F.node_ops.getattr,setattr:F.node_ops.setattr},stream:o.chrdev_stream_ops}};var i=o.createNode(e,r,t,n);return o.isDir(i.mode)?(i.node_ops=F.ops_table.dir.node,i.stream_ops=F.ops_table.dir.stream,i.contents={}):o.isFile(i.mode)?(i.node_ops=F.ops_table.file.node,i.stream_ops=F.ops_table.file.stream,i.usedBytes=0,i.contents=F.emptyFileContents??=new Uint8Array(0)):o.isLink(i.mode)?(i.node_ops=F.ops_table.link.node,i.stream_ops=F.ops_table.link.stream):o.isChrdev(i.mode)&&(i.node_ops=F.ops_table.chrdev.node,i.stream_ops=F.ops_table.chrdev.stream),i.atime=i.mtime=i.ctime=Date.now(),e&&(e.contents[r]=i,e.atime=e.mtime=e.ctime=i.atime),i},getFileDataAsTypedArray(e){return _(o.isFile(e.mode),"getFileDataAsTypedArray called on non-file"),e.contents.subarray(0,e.usedBytes)},expandFileStorage(e,r){var t=e.contents.length;if(!(t>=r)){var n=1024*1024;r=Math.max(r,t*(t<n?2:1.125)>>>0),t&&(r=Math.max(r,256));var i=F.getFileDataAsTypedArray(e);e.contents=new Uint8Array(r),e.contents.set(i)}},resizeFileStorage(e,r){if(e.usedBytes!=r){var t=e.contents;e.contents=new Uint8Array(r),e.contents.set(t.subarray(0,Math.min(r,e.usedBytes))),e.usedBytes=r}},node_ops:{getattr(e){var r={};return r.dev=o.isChrdev(e.mode)?e.id:1,r.ino=e.id,r.mode=e.mode,r.nlink=1,r.uid=0,r.gid=0,r.rdev=e.rdev,o.isDir(e.mode)?r.size=4096:o.isFile(e.mode)?r.size=e.usedBytes:o.isLink(e.mode)?r.size=e.link.length:r.size=0,r.atime=new Date(e.atime),r.mtime=new Date(e.mtime),r.ctime=new Date(e.ctime),r.blksize=4096,r.blocks=Math.ceil(r.size/r.blksize),r},setattr(e,r){for(let t of["mode","atime","mtime","ctime"])r[t]!=null&&(e[t]=r[t]);r.size!==void 0&&F.resizeFileStorage(e,r.size)},lookup(e,r){throw new o.ErrnoError(44)},mknod(e,r,t,n){return F.createNode(e,r,t,n)},rename(e,r,t){var n;try{n=o.lookupNode(r,t)}catch{}if(n){if(o.isDir(e.mode))for(var i in n.contents)throw new o.ErrnoError(55);o.hashRemoveNode(n)}delete e.parent.contents[e.name],r.contents[t]=e,e.name=t,r.ctime=r.mtime=e.parent.ctime=e.parent.mtime=Date.now()},unlink(e,r){delete e.contents[r],e.ctime=e.mtime=Date.now()},rmdir(e,r){var t=o.lookupNode(e,r);for(var n in t.contents)throw new o.ErrnoError(55);delete e.contents[r],e.ctime=e.mtime=Date.now()},readdir(e){return[".","..",...Object.keys(e.contents)]},symlink(e,r,t){var n=F.createNode(e,r,41471,0);return n.link=t,n},readlink(e){if(!o.isLink(e.mode))throw new o.ErrnoError(28);return e.link}},stream_ops:{read(e,r,t,n,i){var a=e.node.contents;if(i>=e.node.usedBytes)return 0;var s=Math.min(e.node.usedBytes-i,n);return _(s>=0),r.set(a.subarray(i,i+s),t),s},write(e,r,t,n,i,a){if(_(r.subarray,"FS.write expects a TypedArray"),r.buffer===(d(),H).buffer&&(a=!1),!n)return 0;var s=e.node;return s.mtime=s.ctime=Date.now(),a?(_(i===0,"canOwn must imply no weird position inside the file"),s.contents=r.subarray(t,t+n),s.usedBytes=n):s.usedBytes===0&&i===0?(s.contents=r.slice(t,t+n),s.usedBytes=n):(F.expandFileStorage(s,i+n),s.contents.set(r.subarray(t,t+n),i),s.usedBytes=Math.max(s.usedBytes,i+n)),n},llseek(e,r,t){var n=r;if(t===1?n+=e.position:t===2&&o.isFile(e.node.mode)&&(n+=e.node.usedBytes),n<0)throw new o.ErrnoError(28);return n},mmap(e,r,t,n,i){if(!o.isFile(e.node.mode))throw new o.ErrnoError(43);var a,s,l=e.node.contents;if(!(i&2)&&l.buffer===(d(),H).buffer)s=!1,a=l.byteOffset;else{if(s=!0,a=Vr(r),!a)throw new o.ErrnoError(48);l&&((t>0||t+r<l.length)&&(l.subarray?l=l.subarray(t,t+r):l=Array.prototype.slice.call(l,t,t+r)),(d(),H).set(l,a))}return{ptr:a,allocated:s}},msync(e,r,t,n,i){return F.stream_ops.write(e,r,0,n,t,!1),0}}},Vi=e=>{if(typeof e!="string")return e;var r={r:0,"r+":2,w:577,"w+":578,a:1089,"a+":1090},t=r[e];if(typeof t>"u")throw new Error(`Unknown file open mode: ${e}`);return t},Jt=e=>(typeof e=="string"&&(e=Gr(e,!0)),e.subarray||(e=new Uint8Array(e)),e),qr=(e,r)=>{var t=0;return e&&(t|=365),r&&(t|=146),t},dr={EPERM:63,ENOENT:44,ESRCH:71,EINTR:27,EIO:29,ENXIO:60,E2BIG:1,ENOEXEC:45,EBADF:8,ECHILD:12,EAGAIN:6,EWOULDBLOCK:6,ENOMEM:48,EACCES:2,EFAULT:21,ENOTBLK:105,EBUSY:10,EEXIST:20,EXDEV:75,ENODEV:43,ENOTDIR:54,EISDIR:31,EINVAL:28,ENFILE:41,EMFILE:33,ENOTTY:59,ETXTBSY:74,EFBIG:22,ENOSPC:51,ESPIPE:70,EROFS:69,EMLINK:34,EPIPE:64,EDOM:18,ERANGE:68,ENOMSG:49,EIDRM:24,ECHRNG:106,EL2NSYNC:156,EL3HLT:107,EL3RST:108,ELNRNG:109,EUNATCH:110,ENOCSI:111,EL2HLT:112,EDEADLK:16,ENOLCK:46,EBADE:113,EBADR:114,EXFULL:115,ENOANO:104,EBADRQC:103,EBADSLT:102,EDEADLOCK:16,EBFONT:101,ENOSTR:100,ENODATA:116,ETIME:117,ENOSR:118,ENONET:119,ENOPKG:120,EREMOTE:121,ENOLINK:47,EADV:122,ESRMNT:123,ECOMM:124,EPROTO:65,EMULTIHOP:36,EDOTDOT:125,EBADMSG:9,ENOTUNIQ:126,EBADFD:127,EREMCHG:128,ELIBACC:129,ELIBBAD:130,ELIBSCN:131,ELIBMAX:132,ELIBEXEC:133,ENOSYS:52,ENOTEMPTY:55,ENAMETOOLONG:37,ELOOP:32,EOPNOTSUPP:138,EPFNOSUPPORT:139,ECONNRESET:15,ENOBUFS:42,EAFNOSUPPORT:5,EPROTOTYPE:67,ENOTSOCK:57,ENOPROTOOPT:50,ESHUTDOWN:140,ECONNREFUSED:14,EADDRINUSE:3,ECONNABORTED:13,ENETUNREACH:40,ENETDOWN:38,ETIMEDOUT:73,EHOSTDOWN:142,EHOSTUNREACH:23,EINPROGRESS:26,EALREADY:7,EDESTADDRREQ:17,EMSGSIZE:35,EPROTONOSUPPORT:66,ESOCKTNOSUPPORT:137,EADDRNOTAVAIL:4,ENETRESET:39,EISCONN:30,ENOTCONN:53,ETOOMANYREFS:141,EUSERS:136,EDQUOT:19,ESTALE:72,ENOTSUP:138,ENOMEDIUM:148,EILSEQ:25,EOVERFLOW:61,ECANCELED:11,ENOTRECOVERABLE:56,EOWNERDEAD:62,ESTRPIPE:135},b={isWindows:!1,staticInit(){b.isWindows=!!process.platform.match(/^win/);var e=process.binding("constants").fs;b.flagsForNodeMap={1024:e.O_APPEND,64:e.O_CREAT,128:e.O_EXCL,256:e.O_NOCTTY,0:e.O_RDONLY,2:e.O_RDWR,4096:e.O_SYNC,512:e.O_TRUNC,1:e.O_WRONLY,131072:e.O_NOFOLLOW},_(b.flagsForNodeMap[0]===0)},convertNodeCode(e){var r=e.code;return _(r in dr,`unexpected node error code: ${r} (${e})`),dr[r]},tryFSOperation(e){try{return e()}catch(r){throw r.code?r.code==="UNKNOWN"?new o.ErrnoError(28):new o.ErrnoError(b.convertNodeCode(r)):r}},mount(e){return _(C),b.createNode(null,"/",b.getMode(e.opts.root),0)},createNode(e,r,t,n){if(!o.isDir(t)&&!o.isFile(t)&&!o.isLink(t))throw new o.ErrnoError(28);var i=o.createNode(e,r,t);return i.node_ops=b.node_ops,i.stream_ops=b.stream_ops,i},getMode(e){return b.tryFSOperation(()=>{var r=N.lstatSync(e).mode;return b.isWindows&&(r|=(r&292)>>2),r})},realPath(e){for(var r=[];e.parent!==e;)r.push(e.name),e=e.parent;return r.push(e.mount.opts.root),r.reverse(),I.join(...r)},flagsForNode(e){e&=-2097153,e&=-2049,e&=-32769,e&=-524289,e&=-65537;var r=0;for(var t in b.flagsForNodeMap)e&t&&(r|=b.flagsForNodeMap[t],e^=t);if(e)throw new o.ErrnoError(28);return r},getattr(e,r){var t=b.tryFSOperation(e);return b.isWindows&&(t.blksize||(t.blksize=4096),t.blocks||(t.blocks=(t.size+t.blksize-1)/t.blksize|0),t.mode|=(t.mode&292)>>2),{dev:t.dev,ino:r.id,mode:t.mode,nlink:t.nlink,uid:t.uid,gid:t.gid,rdev:t.rdev,size:t.size,atime:t.atime,mtime:t.mtime,ctime:t.ctime,blksize:t.blksize,blocks:t.blocks}},setattr(e,r,t,n,i,a,s){b.tryFSOperation(()=>{if(t.mode!==void 0){var l=t.mode;b.isWindows&&(l&=384),n(e,l),r.mode=t.mode}if(typeof(t.atime??t.mtime)=="number"){var c=new Date(t.atime??s(e).atime),u=new Date(t.mtime??s(e).mtime);i(e,c,u)}t.size!==void 0&&a(e,t.size)})},node_ops:{getattr(e){var r=b.realPath(e);return b.getattr(()=>N.lstatSync(r),e)},setattr(e,r){var t=b.realPath(e);if(r.mode!=null&&r.dontFollow)throw new o.ErrnoError(52);b.setattr(t,e,r,N.chmodSync,N.utimesSync,N.truncateSync,N.lstatSync)},lookup(e,r){var t=I.join2(b.realPath(e),r),n=b.getMode(t);return b.createNode(e,r,n)},mknod(e,r,t,n){var i=b.createNode(e,r,t,n),a=b.realPath(i);return b.tryFSOperation(()=>{o.isDir(i.mode)?N.mkdirSync(a,i.mode):N.writeFileSync(a,"",{mode:i.mode})}),i},rename(e,r,t){var n=b.realPath(e),i=I.join2(b.realPath(r),t);try{o.unlink(i)}catch{}b.tryFSOperation(()=>N.renameSync(n,i)),e.name=t},unlink(e,r){var t=I.join2(b.realPath(e),r);b.tryFSOperation(()=>N.unlinkSync(t))},rmdir(e,r){var t=I.join2(b.realPath(e),r);b.tryFSOperation(()=>N.rmdirSync(t))},readdir(e){var r=b.realPath(e);return b.tryFSOperation(()=>N.readdirSync(r))},symlink(e,r,t){var n=I.join2(b.realPath(e),r);b.tryFSOperation(()=>N.symlinkSync(t,n))},readlink(e){var r=b.realPath(e);return b.tryFSOperation(()=>N.readlinkSync(r))},statfs(e){var r=b.tryFSOperation(()=>N.statfsSync(e));return r.frsize=r.bsize,r}},stream_ops:{getattr(e){return b.getattr(()=>N.fstatSync(e.nfd),e.node)},setattr(e,r){b.setattr(e.nfd,e.node,r,N.fchmodSync,N.futimesSync,N.ftruncateSync,N.fstatSync)},open(e){var r=b.realPath(e.node);b.tryFSOperation(()=>{e.shared.refcount=1,e.nfd=N.openSync(r,b.flagsForNode(e.flags))})},close(e){b.tryFSOperation(()=>{e.nfd&&--e.shared.refcount===0&&N.closeSync(e.nfd)})},dup(e){e.shared.refcount++},read(e,r,t,n,i){return b.tryFSOperation(()=>N.readSync(e.nfd,r,t,n,i))},write(e,r,t,n,i){return b.tryFSOperation(()=>N.writeSync(e.nfd,r,t,n,i))},llseek(e,r,t){var n=r;if(t===1?n+=e.position:t===2&&o.isFile(e.node.mode)&&b.tryFSOperation(()=>{var i=N.fstatSync(e.nfd);n+=i.size}),n<0)throw new o.ErrnoError(28);return n},mmap(e,r,t,n,i){if(!o.isFile(e.node.mode))throw new o.ErrnoError(43);var a=Vr(r);return b.stream_ops.read(e,(d(),H),a,r,t),{ptr:a,allocated:!0}},msync(e,r,t,n,i){return b.stream_ops.write(e,r,0,n,t,!1),0}}},qi=e=>_e(Kn(e)),Ki=async e=>{var r=await nr(e);return _(r,`Loading data file "${e}" failed (no arrayBuffer).`),new Uint8Array(r)},Zt=(...e)=>o.createDataFile(...e),Xi=e=>{for(var r=e;;){if(!xe[e])return e;e=r+Math.random()}},Qt=[],Yi=async(e,r)=>{typeof Browser<"u"&&Browser.init();for(var t of Qt)if(t.canHandle(r))return _(t.handle.constructor.name==="AsyncFunction","Filesystem plugin handlers must be async functions (See #24914)"),t.handle(e,r);return e},Kr=async(e,r,t,n,i,a,s,l)=>{var c=r?Le.resolve(I.join2(e,r)):e,u=Xi(`cp ${c}`);Wr(u);try{var v=t;typeof t=="string"&&(v=await Ki(t)),v=await Yi(v,c),l?.(),a||Zt(e,r,v,n,i,s)}finally{xr(u)}},Ji=(e,r,t,n,i,a,s,l,c,u)=>{Kr(e,r,t,n,i,l,c,u).then(a).catch(s)},o={root:null,mounts:[],devices:{},streams:[],nextInode:1,nameTable:null,currentPath:"/",initialized:!1,ignorePermissions:!0,filesystems:null,syncFSRequests:0,ErrnoError:class extends Error{name="ErrnoError";constructor(e){super(Ne?qi(e):""),this.errno=e;for(var r in dr)if(dr[r]===e){this.code=r;break}}},FSStream:class{shared={};get object(){return this.node}set object(e){this.node=e}get isRead(){return(this.flags&2097155)!==1}get isWrite(){return(this.flags&2097155)!==0}get isAppend(){return this.flags&1024}get flags(){return this.shared.flags}set flags(e){this.shared.flags=e}get position(){return this.shared.position}set position(e){this.shared.position=e}},FSNode:class{node_ops={};stream_ops={};readMode=365;writeMode=146;mounted=null;constructor(e,r,t,n){e||(e=this),this.parent=e,this.mount=e.mount,this.id=o.nextInode++,this.name=r,this.mode=t,this.rdev=n,this.atime=this.mtime=this.ctime=Date.now()}get read(){return(this.mode&this.readMode)===this.readMode}set read(e){e?this.mode|=this.readMode:this.mode&=~this.readMode}get write(){return(this.mode&this.writeMode)===this.writeMode}set write(e){e?this.mode|=this.writeMode:this.mode&=~this.writeMode}get isFolder(){return o.isDir(this.mode)}get isDevice(){return o.isChrdev(this.mode)}},lookupPath(e,r={}){if(!e)throw new o.ErrnoError(44);r.follow_mount??=!0,I.isAbs(e)||(e=o.cwd()+"/"+e);e:for(var t=0;t<40;t++){for(var n=e.split("/").filter(u=>!!u),i=o.root,a="/",s=0;s<n.length;s++){var l=s===n.length-1;if(l&&r.parent)break;if(n[s]!=="."){if(n[s]===".."){if(a=I.dirname(a),o.isRoot(i)){e=a+"/"+n.slice(s+1).join("/"),t--;continue e}else i=i.parent;continue}a=I.join2(a,n[s]);try{i=o.lookupNode(i,n[s])}catch(u){if(u?.errno===44&&l&&r.noent_okay)return{path:a};throw u}if(o.isMountpoint(i)&&(!l||r.follow_mount)&&(i=i.mounted.root),o.isLink(i.mode)&&(!l||r.follow)){if(!i.node_ops.readlink)throw new o.ErrnoError(52);var c=i.node_ops.readlink(i);I.isAbs(c)||(c=I.dirname(a)+"/"+c),e=c+"/"+n.slice(s+1).join("/");continue e}}}return{path:a,node:i}}throw new o.ErrnoError(32)},getPath(e){for(var r;;){if(o.isRoot(e)){var t=e.mount.mountpoint;return r?t[t.length-1]!=="/"?`${t}/${r}`:t+r:t}r=r?`${e.name}/${r}`:e.name,e=e.parent}},hashName(e,r){for(var t=0,n=0;n<r.length;n++)t=(t<<5)-t+r.charCodeAt(n)|0;return(e+t>>>0)%o.nameTable.length},hashAddNode(e){var r=o.hashName(e.parent.id,e.name);e.name_next=o.nameTable[r],o.nameTable[r]=e},hashRemoveNode(e){var r=o.hashName(e.parent.id,e.name);if(o.nameTable[r]===e)o.nameTable[r]=e.name_next;else for(var t=o.nameTable[r];t;){if(t.name_next===e){t.name_next=e.name_next;break}t=t.name_next}},lookupNode(e,r){var t=o.mayLookup(e);if(t)throw new o.ErrnoError(t);for(var n=o.hashName(e.id,r),i=o.nameTable[n];i;i=i.name_next){var a=i.name;if(i.parent.id===e.id&&a===r)return i}return o.lookup(e,r)},createNode(e,r,t,n){_(typeof e=="object");var i=new o.FSNode(e,r,t,n);return o.hashAddNode(i),i},destroyNode(e){o.hashRemoveNode(e)},isRoot(e){return e===e.parent},isMountpoint(e){return!!e.mounted},isFile(e){return(e&61440)===32768},isDir(e){return(e&61440)===16384},isLink(e){return(e&61440)===40960},isChrdev(e){return(e&61440)===8192},isBlkdev(e){return(e&61440)===24576},isFIFO(e){return(e&61440)===4096},isSocket(e){return(e&49152)===49152},flagsToPermissionString(e){var r=["r","w","rw"][e&3];return e&512&&(r+="w"),r},nodePermissions(e,r){return o.ignorePermissions?0:r.includes("r")&&!(e.mode&292)||r.includes("w")&&!(e.mode&146)||r.includes("x")&&!(e.mode&73)?2:0},mayLookup(e){if(!o.isDir(e.mode))return 54;var r=o.nodePermissions(e,"x");return r||(e.node_ops.lookup?0:2)},mayCreate(e,r){if(!o.isDir(e.mode))return 54;try{var t=o.lookupNode(e,r);return 20}catch{}return o.nodePermissions(e,"wx")},mayDelete(e,r,t){var n;try{n=o.lookupNode(e,r)}catch(a){return a.errno}var i=o.nodePermissions(e,"wx");if(i)return i;if(t){if(!o.isDir(n.mode))return 54;if(o.isRoot(n)||o.getPath(n)===o.cwd())return 10}else if(o.isDir(n.mode))return 31;return 0},mayOpen(e,r){if(!e)return 44;if(o.isLink(e.mode))return 32;var t=o.flagsToPermissionString(r);return o.isDir(e.mode)&&(t!=="r"||r&576)?31:o.nodePermissions(e,t)},checkOpExists(e,r){if(!e)throw new o.ErrnoError(r);return e},MAX_OPEN_FDS:4096,nextfd(){for(var e=0;e<=o.MAX_OPEN_FDS;e++)if(!o.streams[e])return e;throw new o.ErrnoError(33)},getStreamChecked(e){var r=o.getStream(e);if(!r)throw new o.ErrnoError(8);return r},getStream:e=>o.streams[e],createStream(e,r=-1){return _(r>=-1),e=Object.assign(new o.FSStream,e),r==-1&&(r=o.nextfd()),e.fd=r,o.streams[r]=e,e},closeStream(e){o.streams[e]=null},dupStream(e,r=-1){var t=o.createStream(e,r);return t.stream_ops?.dup?.(t),t},doSetAttr(e,r,t){var n=e?.stream_ops.setattr,i=n?e:r;n??=r.node_ops.setattr,o.checkOpExists(n,63);try{n(i,t)}catch(a){throw a instanceof RangeError?new o.ErrnoError(22):a}},chrdev_stream_ops:{open(e){var r=o.getDevice(e.node.rdev);e.stream_ops=r.stream_ops,e.stream_ops.open?.(e)},llseek(){throw new o.ErrnoError(70)}},major:e=>e>>8,minor:e=>e&255,makedev:(e,r)=>e<<8|r,registerDevice(e,r){o.devices[e]={stream_ops:r}},getDevice:e=>o.devices[e],getMounts(e){for(var r=[],t=[e];t.length;){var n=t.pop();r.push(n),t.push(...n.mounts)}return r},syncfs(e,r){typeof e=="function"&&(r=e,e=!1),o.syncFSRequests++,o.syncFSRequests>1&&A(`warning: ${o.syncFSRequests} FS.syncfs operations in flight at once, probably just doing extra work`);var t=o.getMounts(o.root.mount),n=0;function i(l){return _(o.syncFSRequests>0),o.syncFSRequests--,r(l)}function a(l){if(l)return a.errored?void 0:(a.errored=!0,i(l));++n>=t.length&&i(null)}for(var s of t)s.type.syncfs?s.type.syncfs(s,e,a):a(null)},mount(e,r,t){if(typeof e=="string")throw e;var n=t==="/",i=!t,a;if(n&&o.root)throw new o.ErrnoError(10);if(!n&&!i){var s=o.lookupPath(t,{follow_mount:!1});if(t=s.path,a=s.node,o.isMountpoint(a))throw new o.ErrnoError(10);if(!o.isDir(a.mode))throw new o.ErrnoError(54)}var l={type:e,opts:r,mountpoint:t,mounts:[]},c=e.mount(l);return c.mount=l,l.root=c,n?o.root=c:a&&(a.mounted=l,a.mount&&a.mount.mounts.push(l)),c},unmount(e){var r=o.lookupPath(e,{follow_mount:!1});if(!o.isMountpoint(r.node))throw new o.ErrnoError(28);var t=r.node,n=t.mounted,i=o.getMounts(n);for(var[a,s]of Object.entries(o.nameTable))for(;s;){var l=s.name_next;i.includes(s.mount)&&o.destroyNode(s),s=l}t.mounted=null;var c=t.mount.mounts.indexOf(n);_(c!==-1),t.mount.mounts.splice(c,1)},lookup(e,r){return e.node_ops.lookup(e,r)},mknod(e,r,t){var n=o.lookupPath(e,{parent:!0}),i=n.node,a=I.basename(e);if(!a)throw new o.ErrnoError(28);if(a==="."||a==="..")throw new o.ErrnoError(20);var s=o.mayCreate(i,a);if(s)throw new o.ErrnoError(s);if(!i.node_ops.mknod)throw new o.ErrnoError(63);return i.node_ops.mknod(i,a,r,t)},statfs(e){return o.statfsNode(o.lookupPath(e,{follow:!0}).node)},statfsStream(e){return o.statfsNode(e.node)},statfsNode(e){var r={bsize:4096,frsize:4096,blocks:1e6,bfree:5e5,bavail:5e5,files:o.nextInode,ffree:o.nextInode-1,fsid:42,flags:2,namelen:255};return e.node_ops.statfs&&Object.assign(r,e.node_ops.statfs(e.mount.opts.root)),r},create(e,r=438){return r&=4095,r|=32768,o.mknod(e,r,0)},mkdir(e,r=511){return r&=1023,r|=16384,o.mknod(e,r,0)},mkdirTree(e,r){var t=e.split("/"),n="";for(var i of t)if(i){(n||I.isAbs(e))&&(n+="/"),n+=i;try{o.mkdir(n,r)}catch(a){if(a.errno!=20)throw a}}},mkdev(e,r,t){return typeof t>"u"&&(t=r,r=438),r|=8192,o.mknod(e,r,t)},symlink(e,r){if(!Le.resolve(e))throw new o.ErrnoError(44);var t=o.lookupPath(r,{parent:!0}),n=t.node;if(!n)throw new o.ErrnoError(44);var i=I.basename(r),a=o.mayCreate(n,i);if(a)throw new o.ErrnoError(a);if(!n.node_ops.symlink)throw new o.ErrnoError(63);return n.node_ops.symlink(n,i,e)},rename(e,r){var t=I.dirname(e),n=I.dirname(r),i=I.basename(e),a=I.basename(r),s,l,c;if(s=o.lookupPath(e,{parent:!0}),l=s.node,s=o.lookupPath(r,{parent:!0}),c=s.node,!l||!c)throw new o.ErrnoError(44);if(l.mount!==c.mount)throw new o.ErrnoError(75);var u=o.lookupNode(l,i),v=Le.relative(e,n);if(v.charAt(0)!==".")throw new o.ErrnoError(28);if(v=Le.relative(r,t),v.charAt(0)!==".")throw new o.ErrnoError(55);var h;try{h=o.lookupNode(c,a)}catch{}if(u!==h){var p=o.isDir(u.mode),g=o.mayDelete(l,i,p);if(g)throw new o.ErrnoError(g);if(g=h?o.mayDelete(c,a,p):o.mayCreate(c,a),g)throw new o.ErrnoError(g);if(!l.node_ops.rename)throw new o.ErrnoError(63);if(o.isMountpoint(u)||h&&o.isMountpoint(h))throw new o.ErrnoError(10);if(c!==l&&(g=o.nodePermissions(l,"w"),g))throw new o.ErrnoError(g);o.hashRemoveNode(u);try{l.node_ops.rename(u,c,a),u.parent=c}catch(E){throw E}finally{o.hashAddNode(u)}}},rmdir(e){var r=o.lookupPath(e,{parent:!0}),t=r.node,n=I.basename(e),i=o.lookupNode(t,n),a=o.mayDelete(t,n,!0);if(a)throw new o.ErrnoError(a);if(!t.node_ops.rmdir)throw new o.ErrnoError(63);if(o.isMountpoint(i))throw new o.ErrnoError(10);t.node_ops.rmdir(t,n),o.destroyNode(i)},readdir(e){var r=o.lookupPath(e,{follow:!0}),t=r.node,n=o.checkOpExists(t.node_ops.readdir,54);return n(t)},unlink(e){var r=o.lookupPath(e,{parent:!0}),t=r.node;if(!t)throw new o.ErrnoError(44);var n=I.basename(e),i=o.lookupNode(t,n),a=o.mayDelete(t,n,!1);if(a)throw new o.ErrnoError(a);if(!t.node_ops.unlink)throw new o.ErrnoError(63);if(o.isMountpoint(i))throw new o.ErrnoError(10);t.node_ops.unlink(t,n),o.destroyNode(i)},readlink(e){var r=o.lookupPath(e),t=r.node;if(!t)throw new o.ErrnoError(44);if(!t.node_ops.readlink)throw new o.ErrnoError(28);return t.node_ops.readlink(t)},stat(e,r){var t=o.lookupPath(e,{follow:!r}),n=t.node,i=o.checkOpExists(n.node_ops.getattr,63);return i(n)},fstat(e){var r=o.getStreamChecked(e),t=r.node,n=r.stream_ops.getattr,i=n?r:t;return n??=t.node_ops.getattr,o.checkOpExists(n,63),n(i)},lstat(e){return o.stat(e,!0)},doChmod(e,r,t,n){o.doSetAttr(e,r,{mode:t&4095|r.mode&-4096,ctime:Date.now(),dontFollow:n})},chmod(e,r,t){var n;if(typeof e=="string"){var i=o.lookupPath(e,{follow:!t});n=i.node}else n=e;o.doChmod(null,n,r,t)},lchmod(e,r){o.chmod(e,r,!0)},fchmod(e,r){var t=o.getStreamChecked(e);o.doChmod(t,t.node,r,!1)},doChown(e,r,t){o.doSetAttr(e,r,{timestamp:Date.now(),dontFollow:t})},chown(e,r,t,n){var i;if(typeof e=="string"){var a=o.lookupPath(e,{follow:!n});i=a.node}else i=e;o.doChown(null,i,n)},lchown(e,r,t){o.chown(e,r,t,!0)},fchown(e,r,t){var n=o.getStreamChecked(e);o.doChown(n,n.node,!1)},doTruncate(e,r,t){if(o.isDir(r.mode))throw new o.ErrnoError(31);if(!o.isFile(r.mode))throw new o.ErrnoError(28);var n=o.nodePermissions(r,"w");if(n)throw new o.ErrnoError(n);o.doSetAttr(e,r,{size:t,timestamp:Date.now()})},truncate(e,r){if(r<0)throw new o.ErrnoError(28);var t;if(typeof e=="string"){var n=o.lookupPath(e,{follow:!0});t=n.node}else t=e;o.doTruncate(null,t,r)},ftruncate(e,r){var t=o.getStreamChecked(e);if(r<0||(t.flags&2097155)===0)throw new o.ErrnoError(28);o.doTruncate(t,t.node,r)},utime(e,r,t){var n=o.lookupPath(e,{follow:!0}),i=n.node,a=o.checkOpExists(i.node_ops.setattr,63);a(i,{atime:r,mtime:t})},open(e,r,t=438){if(e==="")throw new o.ErrnoError(44);r=Vi(r),r&64?t=t&4095|32768:t=0;var n,i;if(typeof e=="object")n=e;else{i=e.endsWith("/");var a=o.lookupPath(e,{follow:!(r&131072),noent_okay:!0});n=a.node,e=a.path}var s=!1;if(r&64)if(n){if(r&128)throw new o.ErrnoError(20)}else{if(i)throw new o.ErrnoError(31);n=o.mknod(e,t|511,0),s=!0}if(!n)throw new o.ErrnoError(44);if(o.isChrdev(n.mode)&&(r&=-513),r&65536&&!o.isDir(n.mode))throw new o.ErrnoError(54);if(!s){var l=o.mayOpen(n,r);if(l)throw new o.ErrnoError(l)}r&512&&!s&&o.truncate(n,0),r&=-131713;var c=o.createStream({node:n,path:o.getPath(n),flags:r,seekable:!0,position:0,stream_ops:n.stream_ops,ungotten:[],error:!1});return c.stream_ops.open&&c.stream_ops.open(c),s&&o.chmod(n,t&511),c},close(e){if(o.isClosed(e))throw new o.ErrnoError(8);e.getdents&&(e.getdents=null);try{e.stream_ops.close&&e.stream_ops.close(e)}catch(r){throw r}finally{o.closeStream(e.fd)}e.fd=null},isClosed(e){return e.fd===null},llseek(e,r,t){if(o.isClosed(e))throw new o.ErrnoError(8);if(!e.seekable||!e.stream_ops.llseek)throw new o.ErrnoError(70);if(t!=0&&t!=1&&t!=2)throw new o.ErrnoError(28);return e.position=e.stream_ops.llseek(e,r,t),e.ungotten=[],e.position},read(e,r,t,n,i){if(_(t>=0),n<0||i<0)throw new o.ErrnoError(28);if(o.isClosed(e))throw new o.ErrnoError(8);if((e.flags&2097155)===1)throw new o.ErrnoError(8);if(o.isDir(e.node.mode))throw new o.ErrnoError(31);if(!e.stream_ops.read)throw new o.ErrnoError(28);var a=typeof i<"u";if(!a)i=e.position;else if(!e.seekable)throw new o.ErrnoError(70);var s=e.stream_ops.read(e,r,t,n,i);return a||(e.position+=s),s},write(e,r,t,n,i,a){if(_(t>=0),_(r.subarray,"FS.write expects a TypedArray"),n<0||i<0)throw new o.ErrnoError(28);if(o.isClosed(e))throw new o.ErrnoError(8);if((e.flags&2097155)===0)throw new o.ErrnoError(8);if(o.isDir(e.node.mode))throw new o.ErrnoError(31);if(!e.stream_ops.write)throw new o.ErrnoError(28);e.seekable&&e.flags&1024&&o.llseek(e,0,2);var s=typeof i<"u";if(!s)i=e.position;else if(!e.seekable)throw new o.ErrnoError(70);var l=e.stream_ops.write(e,r,t,n,i,a);return s||(e.position+=l),l},mmap(e,r,t,n,i){if((n&2)!==0&&(i&2)===0&&(e.flags&2097155)!==2)throw new o.ErrnoError(2);if((e.flags&2097155)===1)throw new o.ErrnoError(2);if(!e.stream_ops.mmap)throw new o.ErrnoError(43);if(!r)throw new o.ErrnoError(28);return e.stream_ops.mmap(e,r,t,n,i)},msync(e,r,t,n,i){return _(t>=0),e.stream_ops.msync?e.stream_ops.msync(e,r,t,n,i):0},ioctl(e,r,t){if(!e.stream_ops.ioctl)throw new o.ErrnoError(59);return e.stream_ops.ioctl(e,r,t)},readFile(e,r={}){r.flags=r.flags||0,r.encoding=r.encoding||"binary",r.encoding!=="utf8"&&r.encoding!=="binary"&&q(`Invalid encoding type "${r.encoding}"`);var t=o.open(e,r.flags),n=o.stat(e),i=n.size,a=new Uint8Array(i);return o.read(t,a,0,i,0),r.encoding==="utf8"&&(a=We(a)),o.close(t),a},writeFile(e,r,t={}){t.flags=t.flags||577;var n=o.open(e,t.flags,t.mode);r=Jt(r),o.write(n,r,0,r.byteLength,void 0,t.canOwn),o.close(n)},cwd:()=>o.currentPath,chdir(e){var r=o.lookupPath(e,{follow:!0});if(r.node===null)throw new o.ErrnoError(44);if(!o.isDir(r.node.mode))throw new o.ErrnoError(54);var t=o.nodePermissions(r.node,"x");if(t)throw new o.ErrnoError(t);o.currentPath=r.path},createDefaultDirectories(){o.mkdir("/tmp"),o.mkdir("/home"),o.mkdir("/home/web_user")},createDefaultDevices(){o.mkdir("/dev"),o.registerDevice(o.makedev(1,3),{read:()=>0,write:(n,i,a,s,l)=>s,llseek:()=>0}),o.mkdev("/dev/null",o.makedev(1,3)),pe.register(o.makedev(5,0),pe.default_tty_ops),pe.register(o.makedev(6,0),pe.default_tty1_ops),o.mkdev("/dev/tty",o.makedev(5,0)),o.mkdev("/dev/tty1",o.makedev(6,0));var e=new Uint8Array(1024),r=0,t=()=>(r===0&&(Br(e),r=e.byteLength),e[--r]);o.createDevice("/dev","random",t),o.createDevice("/dev","urandom",t),o.mkdir("/dev/shm"),o.mkdir("/dev/shm/tmp")},createSpecialDirectories(){o.mkdir("/proc");var e=o.mkdir("/proc/self");o.mkdir("/proc/self/fd"),o.mount({mount(){var r=o.createNode(e,"fd",16895,73);return r.stream_ops={llseek:F.stream_ops.llseek},r.node_ops={lookup(t,n){var i=+n,a=o.getStreamChecked(i),s={parent:null,mount:{mountpoint:"fake"},node_ops:{readlink:()=>a.path},id:i+1};return s.parent=s,s},readdir(){return Array.from(o.streams.entries()).filter(([t,n])=>n).map(([t,n])=>t.toString())}},r}},{},"/proc/self/fd")},createStandardStreams(e,r,t){e?o.createDevice("/dev","stdin",e):o.symlink("/dev/tty","/dev/stdin"),r?o.createDevice("/dev","stdout",null,r):o.symlink("/dev/tty","/dev/stdout"),t?o.createDevice("/dev","stderr",null,t):o.symlink("/dev/tty1","/dev/stderr");var n=o.open("/dev/stdin",0),i=o.open("/dev/stdout",1),a=o.open("/dev/stderr",1);_(n.fd===0,`invalid handle for stdin (${n.fd})`),_(i.fd===1,`invalid handle for stdout (${i.fd})`),_(a.fd===2,`invalid handle for stderr (${a.fd})`)},staticInit(){o.nameTable=new Array(4096),o.mount(F,{},"/"),o.createDefaultDirectories(),o.createDefaultDevices(),o.createSpecialDirectories(),o.filesystems={MEMFS:F,NODEFS:b}},init(e,r,t){_(!o.initialized,"FS.init was previously called. If you want to initialize later with custom parameters, remove any earlier calls (note that one is automatically added to the generated code)"),o.initialized=!0,e??=f.stdin,r??=f.stdout,t??=f.stderr,o.createStandardStreams(e,r,t)},quit(){o.initialized=!1,lt(0);for(var e of o.streams)e&&o.close(e)},findObject(e,r){var t=o.analyzePath(e,r);return t.exists?t.object:null},analyzePath(e,r){try{var t=o.lookupPath(e,{follow:!r});e=t.path}catch{}var n={isRoot:!1,exists:!1,error:0,name:null,path:null,object:null,parentExists:!1,parentPath:null,parentObject:null};try{var t=o.lookupPath(e,{parent:!0});n.parentExists=!0,n.parentPath=t.path,n.parentObject=t.node,n.name=I.basename(e),t=o.lookupPath(e,{follow:!r}),n.exists=!0,n.path=t.path,n.object=t.node,n.name=t.node.name,n.isRoot=t.path==="/"}catch(i){n.error=i.errno}return n},createPath(e,r,t,n){e=typeof e=="string"?e:o.getPath(e);for(var i=r.split("/").reverse();i.length;){var a=i.pop();if(a){var s=I.join2(e,a);try{o.mkdir(s)}catch(l){if(l.errno!=20)throw l}e=s}}return s},createFile(e,r,t,n,i){var a=I.join2(typeof e=="string"?e:o.getPath(e),r),s=qr(n,i);return o.create(a,s)},createDataFile(e,r,t,n,i,a){var s=r;e&&(e=typeof e=="string"?e:o.getPath(e),s=r?I.join2(e,r):e);var l=qr(n,i),c=o.create(s,l);if(t){t=Jt(t),o.chmod(c,l|146);var u=o.open(c,577);o.write(u,t,0,t.length,0,a),o.close(u),o.chmod(c,l)}},createDevice(e,r,t,n){var i=I.join2(typeof e=="string"?e:o.getPath(e),r),a=qr(!!t,!!n);o.createDevice.major??=64;var s=o.makedev(o.createDevice.major++,0);return o.registerDevice(s,{open(l){l.seekable=!1},close(l){n?.buffer?.length&&n(10)},read(l,c,u,v,h){for(var p=0,g=0;g<v;g++){var E;try{E=t()}catch{throw new o.ErrnoError(29)}if(E===void 0&&p===0)throw new o.ErrnoError(6);if(E==null)break;p++,c[u+g]=E}return p&&(l.node.atime=Date.now()),p},write(l,c,u,v,h){for(var p=0;p<v;p++)try{n(c[u+p])}catch{throw new o.ErrnoError(29)}return v&&(l.node.mtime=l.node.ctime=Date.now()),p}}),o.mkdev(i,a,s)},forceLoadFile(e){if(e.isDevice||e.isFolder||e.link||e.contents)return!0;if(globalThis.XMLHttpRequest)q("Lazy loading should have been performed (contents set) in createLazyFile, but it was not. Lazy loading only works in web workers. Use --embed-file or --preload-file in emcc on the main thread.");else try{e.contents=He(e.url)}catch{throw new o.ErrnoError(29)}},createLazyFile(e,r,t,n,i){class a{lengthKnown=!1;chunks=[];get(p){if(!(p>this.length-1||p<0)){var g=p%this.chunkSize,E=p/this.chunkSize|0;return this.getter(E)[g]}}setDataGetter(p){this.getter=p}cacheLength(){var p=new XMLHttpRequest;p.open("HEAD",t,!1),p.send(null),p.status>=200&&p.status<300||p.status===304||q("Couldn't load "+t+". Status: "+p.status);var g=Number(p.getResponseHeader("Content-length")),E,k=(E=p.getResponseHeader("Accept-Ranges"))&&E==="bytes",R=(E=p.getResponseHeader("Content-Encoding"))&&E==="gzip",D=1024*1024;k||(D=g);var z=(ae,le)=>{ae>le&&q("invalid range ("+ae+", "+le+") or no bytes requested!"),le>g-1&&q("only "+g+" bytes available! programmer error!");var V=new XMLHttpRequest;return V.open("GET",t,!1),g!==D&&V.setRequestHeader("Range","bytes="+ae+"-"+le),V.responseType="arraybuffer",V.overrideMimeType&&V.overrideMimeType("text/plain; charset=x-user-defined"),V.send(null),V.status>=200&&V.status<300||V.status===304||q("Couldn't load "+t+". Status: "+V.status),V.response!==void 0?new Uint8Array(V.response||[]):Gr(V.responseText||"",!0)},G=this;G.setDataGetter(ae=>{var le=ae*D,V=(ae+1)*D-1;return V=Math.min(V,g-1),typeof G.chunks[ae]>"u"&&(G.chunks[ae]=z(le,V)),typeof G.chunks[ae]>"u"&&q("doXHR failed!"),G.chunks[ae]}),(R||!g)&&(D=g=1,g=this.getter(0).length,D=g,ge("LazyFiles on gzip forces download of the whole file when length is accessed")),this._length=g,this._chunkSize=D,this.lengthKnown=!0}get length(){return this.lengthKnown||this.cacheLength(),this._length}get chunkSize(){return this.lengthKnown||this.cacheLength(),this._chunkSize}}if(globalThis.XMLHttpRequest){B||q("Cannot do synchronous binary XHRs outside webworkers in modern browsers. Use --embed-file or --preload-file in emcc");var s=new a,l={isDevice:!1,contents:s}}else var l={isDevice:!1,url:t};var c=o.createFile(e,r,l,n,i);l.contents?c.contents=l.contents:l.url&&(c.contents=null,c.url=l.url),Object.defineProperties(c,{usedBytes:{get:function(){return this.contents.length}}});var u={};for(let[h,p]of Object.entries(c.stream_ops))u[h]=(...g)=>(o.forceLoadFile(c),p(...g));function v(h,p,g,E,k){var R=h.node.contents;if(k>=R.length)return 0;var D=Math.min(R.length-k,E);if(_(D>=0),R.slice)for(var z=0;z<D;z++)p[g+z]=R[k+z];else for(var z=0;z<D;z++)p[g+z]=R.get(k+z);return D}return u.read=(h,p,g,E,k)=>(o.forceLoadFile(c),v(h,p,g,E,k)),u.mmap=(h,p,g,E,k)=>{o.forceLoadFile(c);var R=Vr(p);if(!R)throw new o.ErrnoError(48);return v(h,(d(),H),R,p,g),{ptr:R,allocated:!0}},c.stream_ops=u,c}},T={websocketArgs:{},callbacks:{},on(e,r){T.callbacks[e]=r},emit(e,r){T.callbacks[e]?.(r)},mount(e){return T.websocketArgs=f.websocket||{},(f.websocket??={}).on=T.on,o.createNode(null,"/",16895,0)},createSocket(e,r,t){if(e!=2)throw new o.ErrnoError(5);if(r&=-526337,r!=1&&r!=2)throw new o.ErrnoError(28);var n=r==1;if(n&&t&&t!=6)throw new o.ErrnoError(66);var i={family:e,type:r,protocol:t,server:null,error:null,peers:{},pending:[],recv_queue:[],sock_ops:T.websocket_sock_ops},a=T.nextname(),s=o.createNode(T.root,a,49152,0);s.sock=i;var l=o.createStream({path:a,node:s,flags:2,seekable:!1,stream_ops:T.stream_ops});return i.stream=l,i},getSocket(e){var r=o.getStream(e);return!r||!o.isSocket(r.node.mode)?null:r.node.sock},stream_ops:{poll(e){var r=e.node.sock;return r.sock_ops.poll(r)},ioctl(e,r,t){var n=e.node.sock;return n.sock_ops.ioctl(n,r,t)},read(e,r,t,n,i){var a=e.node.sock,s=a.sock_ops.recvmsg(a,n);return s?(r.set(s.buffer,t),s.buffer.length):0},write(e,r,t,n,i){var a=e.node.sock;return a.sock_ops.sendmsg(a,r,t,n)},close(e){var r=e.node.sock;r.sock_ops.close(r)}},nextname(){return T.nextname.current||(T.nextname.current=0),`socket[${T.nextname.current++}]`},websocket_sock_ops:{createPeer(e,r,t){var n;if(typeof r=="object"&&(n=r,r=null,t=null),n)if(n._socket)r=n._socket.remoteAddress,t=n._socket.remotePort;else{var i=/ws[s]?:\/\/([^:]+):(\d+)/.exec(n.url);if(!i)throw new Error("WebSocket URL must be in the format ws(s)://address:port");r=i[1],t=parseInt(i[2],10)}else try{var a="ws://".replace("#","//"),s="binary",l=void 0;if(T.websocketArgs.url&&(a=T.websocketArgs.url),T.websocketArgs.subprotocol?s=T.websocketArgs.subprotocol:T.websocketArgs.subprotocol===null&&(s="null"),a==="ws://"||a==="wss://"){var c=r.split("/");a=a+c[0]+":"+t+"/"+c.slice(1).join("/")}s!=="null"&&(s=s.replace(/^ +| +$/g,"").split(/ *, */),l=s);var u;C?u=ue("ws"):u=WebSocket,n=new u(a,l),n.binaryType="arraybuffer"}catch{throw new o.ErrnoError(23)}var v={addr:r,port:t,socket:n,msg_send_queue:[]};return T.websocket_sock_ops.addPeer(e,v),T.websocket_sock_ops.handlePeerEvents(e,v),e.type===2&&typeof e.sport<"u"&&v.msg_send_queue.push(new Uint8Array([255,255,255,255,112,111,114,116,(e.sport&65280)>>8,e.sport&255])),v},getPeer(e,r,t){return e.peers[r+":"+t]},addPeer(e,r){e.peers[r.addr+":"+r.port]=r},removePeer(e,r){delete e.peers[r.addr+":"+r.port]},handlePeerEvents(e,r){var t=!0;function n(){e.connecting=!1,T.emit("open",e.stream.fd);try{for(var a=r.msg_send_queue.shift();a;)r.socket.send(a),a=r.msg_send_queue.shift()}catch{r.socket.close()}}function i(a){if(typeof a=="string"){var s=new TextEncoder;a=s.encode(a)}else{if(_(a.byteLength!==void 0),a.byteLength==0)return;a=new Uint8Array(a)}var l=t;if(t=!1,l&&a.length===10&&a[0]===255&&a[1]===255&&a[2]===255&&a[3]===255&&a[4]===112&&a[5]===111&&a[6]===114&&a[7]===116){var c=a[8]<<8|a[9];T.websocket_sock_ops.removePeer(e,r),r.port=c,T.websocket_sock_ops.addPeer(e,r);return}e.recv_queue.push({addr:r.addr,port:r.port,data:a}),T.emit("message",e.stream.fd)}if(C){r.socket.on("open",n),r.socket.on("message",(a,s)=>{s&&i(new Uint8Array(a).buffer)}),r.socket.on("close",()=>T.emit("close",e.stream.fd)),r.socket.on("error",a=>{e.error=14,T.emit("error",[e.stream.fd,e.error,"ECONNREFUSED: Connection refused"])});return}r.socket.onopen=n,r.socket.onclose=()=>T.emit("close",e.stream.fd),r.socket.onmessage=a=>i(a.data),r.socket.onerror=a=>{e.error=14,T.emit("error",[e.stream.fd,e.error,"ECONNREFUSED: Connection refused"])}},poll(e){if(e.type===1&&e.server)return e.pending.length?65:0;var r=0,t=e.type===1?T.websocket_sock_ops.getPeer(e,e.daddr,e.dport):null;return(e.recv_queue.length||!t||t&&t.socket.readyState===t.socket.CLOSING||t&&t.socket.readyState===t.socket.CLOSED)&&(r|=65),(!t||t&&t.socket.readyState===t.socket.OPEN)&&(r|=4),(t&&t.socket.readyState===t.socket.CLOSING||t&&t.socket.readyState===t.socket.CLOSED)&&(e.connecting?r|=4:r|=16),r},ioctl(e,r,t){switch(r){case 21531:var n=0;return e.recv_queue.length&&(n=e.recv_queue[0].data.length),(d(),S)[t>>2]=n,0;case 21537:var i=(d(),S)[t>>2];return i?e.stream.flags|=2048:e.stream.flags&=-2049,0;default:return 28}},close(e){if(e.server){try{e.server.close()}catch{}e.server=null}for(var r of Object.values(e.peers)){try{r.socket.close()}catch{}T.websocket_sock_ops.removePeer(e,r)}return 0},bind(e,r,t){if(typeof e.saddr<"u"||typeof e.sport<"u")throw new o.ErrnoError(28);if(e.saddr=r,e.sport=t,e.type===2){e.server&&(e.server.close(),e.server=null);try{e.sock_ops.listen(e,0)}catch(n){if(n.name!=="ErrnoError"||n.errno!==138)throw n}}},connect(e,r,t){if(e.server)throw new o.ErrnoError(138);if(typeof e.daddr<"u"&&typeof e.dport<"u"){var n=T.websocket_sock_ops.getPeer(e,e.daddr,e.dport);if(n)throw n.socket.readyState===n.socket.CONNECTING?new o.ErrnoError(7):new o.ErrnoError(30)}var i=T.websocket_sock_ops.createPeer(e,r,t);e.daddr=i.addr,e.dport=i.port,e.connecting=!0},listen(e,r){if(!C)throw new o.ErrnoError(138);if(e.server)throw new o.ErrnoError(28);var t=ue("ws").Server,n=e.saddr;e.server=new t({host:n,port:e.sport}),T.emit("listen",e.stream.fd),e.server.on("connection",i=>{if(e.type===1){var a=T.createSocket(e.family,e.type,e.protocol),s=T.websocket_sock_ops.createPeer(a,i);a.daddr=s.addr,a.dport=s.port,e.pending.push(a),T.emit("connection",a.stream.fd)}else T.websocket_sock_ops.createPeer(e,i),T.emit("connection",e.stream.fd)}),e.server.on("close",()=>{T.emit("close",e.stream.fd),e.server=null}),e.server.on("error",i=>{e.error=23,T.emit("error",[e.stream.fd,e.error,"EHOSTUNREACH: Host is unreachable"])})},accept(e){if(!e.server||!e.pending.length)throw new o.ErrnoError(28);var r=e.pending.shift();return r.stream.flags=e.stream.flags,r},getname(e,r){var t,n;if(r){if(e.daddr===void 0||e.dport===void 0)throw new o.ErrnoError(53);t=e.daddr,n=e.dport}else t=e.saddr||0,n=e.sport||0;return{addr:t,port:n}},sendmsg(e,r,t,n,i,a){if(e.type===2){if((i===void 0||a===void 0)&&(i=e.daddr,a=e.dport),i===void 0||a===void 0)throw new o.ErrnoError(17)}else i=e.daddr,a=e.dport;var s=T.websocket_sock_ops.getPeer(e,i,a);if(e.type===1&&(!s||s.socket.readyState===s.socket.CLOSING||s.socket.readyState===s.socket.CLOSED))throw new o.ErrnoError(53);ArrayBuffer.isView(r)&&(t+=r.byteOffset,r=r.buffer);var l=r.slice(t,t+n);if(l instanceof SharedArrayBuffer&&(l=new Uint8Array(new Uint8Array(l)).buffer),!s||s.socket.readyState!==s.socket.OPEN)return e.type===2&&(!s||s.socket.readyState===s.socket.CLOSING||s.socket.readyState===s.socket.CLOSED)&&(s=T.websocket_sock_ops.createPeer(e,i,a)),s.msg_send_queue.push(l),n;try{return s.socket.send(l),n}catch{throw new o.ErrnoError(28)}},recvmsg(e,r){if(e.type===1&&e.server)throw new o.ErrnoError(53);var t=e.recv_queue.shift();if(!t){if(e.type===1){var n=T.websocket_sock_ops.getPeer(e,e.daddr,e.dport);if(!n)throw new o.ErrnoError(53);if(n.socket.readyState===n.socket.CLOSING||n.socket.readyState===n.socket.CLOSED)return null;throw new o.ErrnoError(6)}throw new o.ErrnoError(6)}var i=t.data.byteLength||t.data.length,a=t.data.byteOffset||0,s=t.data.buffer||t.data,l=Math.min(r,i),c={buffer:new Uint8Array(s,a,l),addr:t.addr,port:t.port};if(e.type===1&&l<i){var u=i-l;t.data=new Uint8Array(s,a+l,u),e.recv_queue.unshift(t)}return c}}},Xr=e=>{var r=T.getSocket(e);if(!r)throw new o.ErrnoError(8);return r},Yr=e=>(e&255)+"."+(e>>8&255)+"."+(e>>16&255)+"."+(e>>24&255),en=e=>{var r="",t=0,n=0,i=0,a=0,s=0,l=0,c=[e[0]&65535,e[0]>>16,e[1]&65535,e[1]>>16,e[2]&65535,e[2]>>16,e[3]&65535,e[3]>>16],u=!0,v="";for(l=0;l<5;l++)if(c[l]!==0){u=!1;break}if(u){if(v=Yr(c[6]|c[7]<<16),c[5]===-1)return r="::ffff:",r+=v,r;if(c[5]===0)return r="::",v==="0.0.0.0"&&(v=""),v==="0.0.0.1"&&(v="1"),r+=v,r}for(t=0;t<8;t++)c[t]===0&&(t-i>1&&(s=0),i=t,s++),s>n&&(n=s,a=t-n+1);for(t=0;t<8;t++){if(n>1&&c[t]===0&&t>=a&&t<a+n){t===a&&(r+=":",a===0&&(r+=":"));continue}r+=Number(dt(c[t]&65535)).toString(16),r+=t<7?":":""}return r},Zi=(e,r)=>{var t=(d(),te)[e>>1],n=dt((d(),ke)[e+2>>1]),i;switch(t){case 2:if(r!==16)return{errno:28};i=(d(),S)[e+4>>2],i=Yr(i);break;case 10:if(r!==28)return{errno:28};i=[(d(),S)[e+8>>2],(d(),S)[e+12>>2],(d(),S)[e+16>>2],(d(),S)[e+20>>2]],i=en(i);break;default:return{errno:5}}return{family:t,addr:i,port:n}},ur=e=>{for(var r=e.split("."),t=0;t<4;t++){var n=Number(r[t]);if(isNaN(n))return null;r[t]=n}return(r[0]|r[1]<<8|r[2]<<16|r[3]<<24)>>>0},Jr=e=>{var r,t,n,i,a,s=/^((?=.*::)(?!.*::.+::)(::)?([\dA-F]{1,4}:(:|\b)|){5}|([\dA-F]{1,4}:){6})((([\dA-F]{1,4}((?!\3)::|:\b|$))|(?!\2\3)){2}|(((2[0-4]|1\d|[1-9])?\d|25[0-5])\.?\b){4})$/i,l=[];if(!s.test(e))return null;if(e==="::")return[0,0,0,0,0,0,0,0];for(e.startsWith("::")?e=e.replace("::","Z:"):e=e.replace("::",":Z:"),e.indexOf(".")>0?(e=e.replace(new RegExp("[.]","g"),":"),r=e.split(":"),r[r.length-4]=Number(r[r.length-4])+Number(r[r.length-3])*256,r[r.length-3]=Number(r[r.length-2])+Number(r[r.length-1])*256,r=r.slice(0,r.length-2)):r=e.split(":"),n=0,i=0,t=0;t<r.length;t++)if(typeof r[t]=="string")if(r[t]==="Z"){for(i=0;i<8-r.length+1;i++)l[t+i]=0;n=i-1}else l[t+n]=Pr(parseInt(r[t],16));else l[t+n]=r[t];return[l[1]<<16|l[0],l[3]<<16|l[2],l[5]<<16|l[4],l[7]<<16|l[6]]},ve={address_map:{id:1,addrs:{},names:{}},lookup_name(e){var r=ur(e);if(r!==null||(r=Jr(e),r!==null))return e;var t;if(ve.address_map.addrs[e])t=ve.address_map.addrs[e];else{var n=ve.address_map.id++;_(n<65535,"exceeded max address mappings of 65535"),t="172.29."+(n&255)+"."+(n&65280),ve.address_map.names[t]=e,ve.address_map.addrs[e]=t}return t},lookup_addr(e){return ve.address_map.names[e]?ve.address_map.names[e]:null}},rn=(e,r)=>{var t=Zi(e,r);if(t.errno)throw new o.ErrnoError(t.errno);return t.addr=ve.lookup_addr(t.addr)||t.addr,t};function tn(e,r,t,n,i,a){if(w)return K(3,0,1,e,r,t,n,i,a);try{var s=Xr(e),l=rn(r,t);return s.sock_ops.connect(s,l.addr,l.port),0}catch(c){if(typeof o>"u"||c.name!=="ErrnoError")throw c;return-c.errno}}var X={currentUmask:18,calculateAt(e,r,t){if(I.isAbs(r))return r;var n;if(e===-100)n=o.cwd();else{var i=X.getStreamFromFD(e);n=i.path}if(r.length==0){if(!t)throw new o.ErrnoError(44);return n}return n+"/"+r},writeStat(e,r){(d(),y)[e>>2]=r.dev,(d(),y)[e+4>>2]=r.mode,(d(),y)[e+8>>2]=r.nlink,(d(),y)[e+12>>2]=r.uid,(d(),y)[e+16>>2]=r.gid,(d(),y)[e+20>>2]=r.rdev,(d(),Z)[e+24>>3]=BigInt(r.size),(d(),S)[e+32>>2]=4096,(d(),S)[e+36>>2]=r.blocks;var t=r.atime.getTime(),n=r.mtime.getTime(),i=r.ctime.getTime();return(d(),Z)[e+40>>3]=BigInt(Math.floor(t/1e3)),(d(),y)[e+48>>2]=t%1e3*1e3*1e3,(d(),Z)[e+56>>3]=BigInt(Math.floor(n/1e3)),(d(),y)[e+64>>2]=n%1e3*1e3*1e3,(d(),Z)[e+72>>3]=BigInt(Math.floor(i/1e3)),(d(),y)[e+80>>2]=i%1e3*1e3*1e3,(d(),Z)[e+88>>3]=BigInt(r.ino),0},writeStatFs(e,r){(d(),y)[e+4>>2]=r.bsize,(d(),y)[e+60>>2]=r.bsize,(d(),Z)[e+8>>3]=BigInt(r.blocks),(d(),Z)[e+16>>3]=BigInt(r.bfree),(d(),Z)[e+24>>3]=BigInt(r.bavail),(d(),Z)[e+32>>3]=BigInt(r.files),(d(),Z)[e+40>>3]=BigInt(r.ffree),(d(),y)[e+48>>2]=r.fsid,(d(),y)[e+64>>2]=r.flags,(d(),y)[e+56>>2]=r.namelen},doMsync(e,r,t,n,i){if(!o.isFile(r.node.mode))throw new o.ErrnoError(43);if(n&2)return 0;var a=(d(),Q).slice(e,e+t);o.msync(r,a,i,t,n)},getStreamFromFD(e){var r=o.getStreamChecked(e);return r},varargs:void 0,getStr(e){var r=_e(e);return r}};function nn(e){if(w)return K(4,0,1,e);try{var r=X.getStreamFromFD(e);return o.dupStream(r).fd}catch(t){if(typeof o>"u"||t.name!=="ErrnoError")throw t;return-t.errno}}var fr=()=>{_(X.varargs!=null);var e=(d(),S)[+X.varargs>>2];return X.varargs+=4,e},Ue=fr;function an(e,r,t){if(w)return K(5,0,1,e,r,t);X.varargs=t;try{var n=X.getStreamFromFD(e);switch(r){case 0:{var i=fr();if(i<0)return-28;for(;o.streams[i];)i++;var a;return a=o.dupStream(n,i),a.fd}case 1:case 2:return 0;case 3:return n.flags;case 4:{var i=fr(),s=289792;return n.flags=n.flags&~s|i&s,0}case 12:{var i=Ue(),l=0;return(d(),te)[i+l>>1]=2,0}case 13:case 14:return 0}return-28}catch(c){if(typeof o>"u"||c.name!=="ErrnoError")throw c;return-c.errno}}var Ee=(e,r,t)=>(_(typeof t=="number","stringToUTF8 requires a third parameter that specifies the length of the output buffer"),Yt(e,(d(),Q),r,t));function on(e,r){if(w)return K(6,0,1,e,r);try{if(r===0)return-28;var t=o.cwd(),n=Pe(t)+1;return r<n?-68:(Ee(t,e,r),n)}catch(i){if(typeof o>"u"||i.name!=="ErrnoError")throw i;return-i.errno}}function sn(e,r,t){if(w)return K(7,0,1,e,r,t);X.varargs=t;try{var n=X.getStreamFromFD(e);switch(r){case 21509:return n.tty?0:-59;case 21505:{if(!n.tty)return-59;if(n.tty.ops.ioctl_tcgets){var i=n.tty.ops.ioctl_tcgets(n),a=Ue();(d(),S)[a>>2]=i.c_iflag||0,(d(),S)[a+4>>2]=i.c_oflag||0,(d(),S)[a+8>>2]=i.c_cflag||0,(d(),S)[a+12>>2]=i.c_lflag||0;for(var s=0;s<32;s++)(d(),H)[a+s+17]=i.c_cc[s]||0;return 0}return 0}case 21510:case 21511:case 21512:return n.tty?0:-59;case 21506:case 21507:case 21508:{if(!n.tty)return-59;if(n.tty.ops.ioctl_tcsets){for(var a=Ue(),l=(d(),S)[a>>2],c=(d(),S)[a+4>>2],u=(d(),S)[a+8>>2],v=(d(),S)[a+12>>2],h=[],s=0;s<32;s++)h.push((d(),H)[a+s+17]);return n.tty.ops.ioctl_tcsets(n.tty,r,{c_iflag:l,c_oflag:c,c_cflag:u,c_lflag:v,c_cc:h})}return 0}case 21519:{if(!n.tty)return-59;var a=Ue();return(d(),S)[a>>2]=0,0}case 21520:return n.tty?-28:-59;case 21537:case 21531:{var a=Ue();return o.ioctl(n,r,a)}case 21523:{if(!n.tty)return-59;if(n.tty.ops.ioctl_tiocgwinsz){var p=n.tty.ops.ioctl_tiocgwinsz(n.tty),a=Ue();(d(),te)[a>>1]=p[0],(d(),te)[a+2>>1]=p[1]}return 0}case 21524:return n.tty?0:-59;case 21515:return n.tty?0:-59;default:return-28}}catch(g){if(typeof o>"u"||g.name!=="ErrnoError")throw g;return-g.errno}}function ln(e,r,t,n){if(w)return K(8,0,1,e,r,t,n);X.varargs=n;try{r=X.getStr(r),r=X.calculateAt(e,r);var i=n?fr():0;return t&64&&(i&=~X.currentUmask),o.open(r,t,i).fd}catch(a){if(typeof o>"u"||a.name!=="ErrnoError")throw a;return-a.errno}}function cn(e,r,t,n){if(w)return K(9,0,1,e,r,t,n);try{if(r=X.getStr(r),r=X.calculateAt(e,r),n<=0)return-28;var i=o.readlink(r),a=Math.min(n,Pe(i)),s=(d(),H)[t+a];return Ee(i,t,n+1),(d(),H)[t+a]=s,a}catch(l){if(typeof o>"u"||l.name!=="ErrnoError")throw l;return-l.errno}}var dn=(e,r)=>(d(),Q).fill(0,e,e+r),un=(e,r,t,n,i)=>{switch(r){case 2:t=ur(t),dn(e,16),i&&((d(),S)[i>>2]=16),(d(),te)[e>>1]=r,(d(),S)[e+4>>2]=t,(d(),te)[e+2>>1]=Pr(n);break;case 10:t=Jr(t),dn(e,28),i&&((d(),S)[i>>2]=28),(d(),S)[e>>2]=r,(d(),S)[e+8>>2]=t[0],(d(),S)[e+12>>2]=t[1],(d(),S)[e+16>>2]=t[2],(d(),S)[e+20>>2]=t[3],(d(),te)[e+2>>1]=Pr(n);break;default:return 5}return 0};function fn(e,r,t,n,i,a){if(w)return K(10,0,1,e,r,t,n,i,a);try{var s=Xr(e),l=s.sock_ops.recvmsg(s,t);if(!l)return 0;if(i){var c=un(i,s.family,ve.lookup_name(l.addr),l.port,a);_(!c)}return(d(),Q).set(l.buffer,r),l.buffer.byteLength}catch(u){if(typeof o>"u"||u.name!=="ErrnoError")throw u;return-u.errno}}function _n(e){if(w)return K(11,0,1,e);try{return e=X.getStr(e),o.rmdir(e),0}catch(r){if(typeof o>"u"||r.name!=="ErrnoError")throw r;return-r.errno}}function vn(e,r,t,n,i,a){if(w)return K(12,0,1,e,r,t,n,i,a);try{var s=Xr(e);if(!i)return o.write(s.stream,(d(),H),r,t);var l=rn(i,a);return s.sock_ops.sendmsg(s,(d(),H),r,t,l.addr,l.port)}catch(c){if(typeof o>"u"||c.name!=="ErrnoError")throw c;return-c.errno}}function hn(e,r,t){if(w)return K(13,0,1,e,r,t);try{var n=T.createSocket(e,r,t);return _(n.stream.fd<64),n.stream.fd}catch(i){if(typeof o>"u"||i.name!=="ErrnoError")throw i;return-i.errno}}function pn(e,r,t){if(w)return K(14,0,1,e,r,t);try{if(r=X.getStr(r),r=X.calculateAt(e,r),!t)o.unlink(r);else if(t===512)o.rmdir(r);else return-28;return 0}catch(n){if(typeof o>"u"||n.name!=="ErrnoError")throw n;return-n.errno}}var Qi=()=>q("native code called abort()"),_r={},vr=e=>{for(;e.length;){var r=e.pop(),t=e.pop();t(r)}};function Ve(e){return this.fromWireType((d(),y)[e>>2])}var je={},Ce={},hr={},ea=class extends Error{constructor(r){super(r),this.name="InternalError"}},pr=e=>{throw new ea(e)},ce=(e,r,t)=>{e.forEach(l=>hr[l]=r);function n(l){var c=t(l);c.length!==e.length&&pr("Mismatched type converter count");for(var u=0;u<e.length;++u)ne(e[u],c[u])}var i=new Array(r.length),a=[],s=0;for(let[l,c]of r.entries())Ce.hasOwnProperty(c)?i[l]=Ce[c]:(a.push(c),je.hasOwnProperty(c)||(je[c]=[]),je[c].push(()=>{i[l]=Ce[c],++s,s===a.length&&n(i)}));a.length===0&&n(i)},ra=e=>{var r=_r[e];delete _r[e];var t=r.rawConstructor,n=r.rawDestructor,i=r.fields,a=i.map(s=>s.getterReturnType).concat(i.map(s=>s.setterArgumentType));ce([e],a,s=>{var l={};for(var[c,u]of i.entries()){let v=s[c],h=u.getter,p=u.getterContext,g=s[c+i.length],E=u.setter,k=u.setterContext;l[u.fieldName]={read:R=>v.fromWireType(h(p,R)),write:(R,D)=>{var z=[];E(k,R,g.toWireType(z,D)),vr(z)},optional:v.optional}}return[{name:r.name,fromWireType:v=>{var h={};for(var p in l)h[p]=l[p].read(v);return n(v),h},toWireType:(v,h)=>{for(var p in l)if(!(p in h)&&!l[p].optional)throw new TypeError(`Missing field: "${p}"`);var g=t();for(p in l)l[p].write(g,h[p]);return v!==null&&v.push(n,g),g},readValueFromPointer:Ve,destructorFunction:n}]})},Y=e=>{for(var r="";;){var t=(d(),Q)[e++];if(!t)return r;r+=String.fromCharCode(t)}},qe=class extends Error{constructor(r){super(r),this.name="BindingError"}},O=e=>{throw new qe(e)};function ta(e,r,t={}){var n=r.name;if(e||O(`type "${n}" must have a positive integer typeid pointer`),Ce.hasOwnProperty(e)){if(t.ignoreDuplicateRegistrations)return;O(`Cannot register type '${n}' twice`)}if(Ce[e]=r,delete hr[e],je.hasOwnProperty(e)){var i=je[e];delete je[e],i.forEach(a=>a())}}function ne(e,r,t={}){return ta(e,r,t)}var mn=(e,r,t)=>{switch(r){case 1:return t?n=>(d(),H)[n]:n=>(d(),Q)[n];case 2:return t?n=>(d(),te)[n>>1]:n=>(d(),ke)[n>>1];case 4:return t?n=>(d(),S)[n>>2]:n=>(d(),y)[n>>2];case 8:return t?n=>(d(),Z)[n>>3]:n=>(d(),Dt)[n>>3];default:throw new TypeError(`invalid integer width (${r}): ${e}`)}},Ae=e=>{if(e===null)return"null";var r=typeof e;return r==="object"||r==="array"||r==="function"?e.toString():""+e},gn=(e,r,t,n)=>{if(r<t||r>n)throw new TypeError(`Passing a number "${Ae(r)}" from JS side to C/C++ side to an argument of type "${e}", which is outside the valid range [${t}, ${n}]!`)},na=(e,r,t,n,i)=>{r=Y(r);let a=n===0n,s=l=>l;if(a){let l=t*8;s=c=>BigInt.asUintN(l,c),i=s(i)}ne(e,{name:r,fromWireType:s,toWireType:(l,c)=>{if(typeof c=="number")c=BigInt(c);else if(typeof c!="bigint")throw new TypeError(`Cannot convert "${Ae(c)}" to ${r}`);return gn(r,c,n,i),c},readValueFromPointer:mn(r,t,!a),destructorFunction:null})},ia=(e,r,t,n)=>{r=Y(r),ne(e,{name:r,fromWireType:function(i){return!!i},toWireType:function(i,a){return a?t:n},readValueFromPointer:function(i){return this.fromWireType((d(),Q)[i])},destructorFunction:null})},aa=e=>({count:e.count,deleteScheduled:e.deleteScheduled,preservePointerOnDelete:e.preservePointerOnDelete,ptr:e.ptr,ptrType:e.ptrType,smartPtr:e.smartPtr,smartPtrType:e.smartPtrType}),Zr=e=>{function r(t){return t.$$.ptrType.registeredClass.name}O(r(e)+" instance already deleted")},Qr=!1,yn=e=>{},oa=e=>{e.smartPtr?e.smartPtrType.rawDestructor(e.smartPtr):e.ptrType.registeredClass.rawDestructor(e.ptr)},wn=e=>{e.count.value-=1;var r=e.count.value===0;r&&oa(e)},En=(e,r,t)=>{if(r===t)return e;if(t.baseClass===void 0)return null;var n=En(e,r,t.baseClass);return n===null?null:t.downcast(n)},bn={},sa={},la=(e,r)=>{for(r===void 0&&O("ptr should not be undefined");e.baseClass;)r=e.upcast(r),e=e.baseClass;return r},ca=(e,r)=>(r=la(e,r),sa[r]),mr=(e,r)=>{(!r.ptrType||!r.ptr)&&pr("makeClassHandle requires ptr and ptrType");var t=!!r.smartPtrType,n=!!r.smartPtr;return t!==n&&pr("Both smartPtrType and smartPtr must be specified"),r.count={value:1},Ke(Object.create(e,{$$:{value:r,writable:!0}}))};function Sn(e){var r=this.getPointee(e);if(!r)return this.destructor(e),null;var t=ca(this.registeredClass,r);if(t!==void 0){if(t.$$.count.value===0)return t.$$.ptr=r,t.$$.smartPtr=e,t.clone();var n=t.clone();return this.destructor(e),n}function i(){return this.isSmartPointer?mr(this.registeredClass.instancePrototype,{ptrType:this.pointeeType,ptr:r,smartPtrType:this,smartPtr:e}):mr(this.registeredClass.instancePrototype,{ptrType:this,ptr:e})}var a=this.registeredClass.getActualType(r),s=bn[a];if(!s)return i.call(this);var l;this.isConst?l=s.constPointerType:l=s.pointerType;var c=En(r,this.registeredClass,l.registeredClass);return c===null?i.call(this):this.isSmartPointer?mr(l.registeredClass.instancePrototype,{ptrType:l,ptr:c,smartPtrType:this,smartPtr:e}):mr(l.registeredClass.instancePrototype,{ptrType:l,ptr:c})}var Ke=e=>globalThis.FinalizationRegistry?(Qr=new FinalizationRegistry(r=>{console.warn(r.leakWarning),wn(r.$$)}),Ke=r=>{var t=r.$$,n=!!t.smartPtr;if(n){var i={$$:t},a=t.ptrType.registeredClass,s=new Error(`Embind found a leaked C++ instance ${a.name} <${we(t.ptr)}>.
5
5
  We'll free it automatically in this case, but this functionality is not reliable across various environments.
6
6
  Make sure to invoke .delete() manually once you're done with the instance instead.
7
- Originally allocated`);"captureStackTrace"in Error&&Error.captureStackTrace(s,hn),i.leakWarning=s.stack.replace(/^Error: /,""),Vr.register(r,i,r)}return r},fn=r=>Vr.unregister(r),Be(e)):(Be=r=>r,e),_r=[],Qi=()=>{for(;_r.length;){var e=_r.pop();e.$$.deleteScheduled=!1,e.delete()}},pn,ea=()=>{let e=vr.prototype;Object.assign(e,{isAliasOf(t){if(!(this instanceof vr)||!(t instanceof vr))return!1;var n=this.$$.ptrType.registeredClass,i=this.$$.ptr;t.$$=t.$$;for(var o=t.$$.ptrType.registeredClass,s=t.$$.ptr;n.baseClass;)i=n.upcast(i),n=n.baseClass;for(;o.baseClass;)s=o.upcast(s),o=o.baseClass;return n===o&&i===s},clone(){if(this.$$.ptr||Gr(this),this.$$.preservePointerOnDelete)return this.$$.count.value+=1,this;var t=Be(Object.create(Object.getPrototypeOf(this),{$$:{value:Ki(this.$$)}}));return t.$$.count.value+=1,t.$$.deleteScheduled=!1,t},delete(){this.$$.ptr||Gr(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&O("Object already scheduled for deletion"),fn(this),_n(this.$$),this.$$.preservePointerOnDelete||(this.$$.smartPtr=void 0,this.$$.ptr=void 0)},isDeleted(){return!this.$$.ptr},deleteLater(){return this.$$.ptr||Gr(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&O("Object already scheduled for deletion"),_r.push(this),_r.length===1&&pn&&pn(Qi),this.$$.deleteScheduled=!0,this}});let r=Symbol.dispose;r&&(e[r]=e.delete)};function vr(){}var mr=(e,r)=>Object.defineProperty(r,"name",{value:e}),qr=(e,r,t)=>{if(e[r].overloadTable===void 0){var n=e[r];e[r]=function(...i){return e[r].overloadTable.hasOwnProperty(i.length)||O(`Function '${t}' called with an invalid number of arguments (${i.length}) - expects one of (${e[r].overloadTable})!`),e[r].overloadTable[i.length].apply(this,i)},e[r].overloadTable=[],e[r].overloadTable[n.argCount]=n}},ze=(e,r,t)=>{f.hasOwnProperty(e)?((t===void 0||f[e].overloadTable!==void 0&&f[e].overloadTable[t]!==void 0)&&O(`Cannot register public name '${e}' twice`),qr(f,e,e),f[e].overloadTable.hasOwnProperty(t)&&O(`Cannot register multiple overloads of a function with the same number of arguments (${t})!`),f[e].overloadTable[t]=r):(f[e]=r,f[e].argCount=t)},ra=48,ta=57,na=e=>{_(typeof e=="string"),e=e.replace(/[^a-zA-Z0-9_]/g,"$");var r=e.charCodeAt(0);return r>=ra&&r<=ta?`_${e}`:e};function ia(e,r,t,n,i,o,s,l){this.name=e,this.constructor=r,this.instancePrototype=t,this.rawDestructor=n,this.baseClass=i,this.getActualType=o,this.upcast=s,this.downcast=l,this.pureVirtualFunctions=[]}var hr=(e,r,t)=>{for(;r!==t;)r.upcast||O(`Expected null or instance of ${t.name}, got an instance of ${r.name}`),e=r.upcast(e),r=r.baseClass;return e};function aa(e,r){if(r===null)return this.isReference&&O(`null is not a valid ${this.name}`),0;r.$$||O(`Cannot pass "${ke(r)}" as a ${this.name}`),r.$$.ptr||O(`Cannot pass deleted object as a pointer of type ${this.name}`);var t=r.$$.ptrType.registeredClass,n=hr(r.$$.ptr,t,this.registeredClass);return n}function oa(e,r){var t;if(r===null)return this.isReference&&O(`null is not a valid ${this.name}`),this.isSmartPointer?(t=this.rawConstructor(),e!==null&&e.push(this.rawDestructor,t),t):0;(!r||!r.$$)&&O(`Cannot pass "${ke(r)}" as a ${this.name}`),r.$$.ptr||O(`Cannot pass deleted object as a pointer of type ${this.name}`),!this.isConst&&r.$$.ptrType.isConst&&O(`Cannot convert argument of type ${r.$$.smartPtrType?r.$$.smartPtrType.name:r.$$.ptrType.name} to parameter type ${this.name}`);var n=r.$$.ptrType.registeredClass;if(t=hr(r.$$.ptr,n,this.registeredClass),this.isSmartPointer)switch(r.$$.smartPtr===void 0&&O("Passing raw pointer to smart pointer is illegal"),this.sharingPolicy){case 0:r.$$.smartPtrType===this?t=r.$$.smartPtr:O(`Cannot convert argument of type ${r.$$.smartPtrType?r.$$.smartPtrType.name:r.$$.ptrType.name} to parameter type ${this.name}`);break;case 1:t=r.$$.smartPtr;break;case 2:if(r.$$.smartPtrType===this)t=r.$$.smartPtr;else{var i=r.clone();t=this.rawShare(t,X.toHandle(()=>i.delete())),e!==null&&e.push(this.rawDestructor,t)}break;default:O("Unsupported sharing policy")}return t}function sa(e,r){if(r===null)return this.isReference&&O(`null is not a valid ${this.name}`),0;r.$$||O(`Cannot pass "${ke(r)}" as a ${this.name}`),r.$$.ptr||O(`Cannot pass deleted object as a pointer of type ${this.name}`),r.$$.ptrType.isConst&&O(`Cannot convert argument of type ${r.$$.ptrType.name} to parameter type ${this.name}`);var t=r.$$.ptrType.registeredClass,n=hr(r.$$.ptr,t,this.registeredClass);return n}var la=()=>{Object.assign(pr.prototype,{getPointee(e){return this.rawGetPointee&&(e=this.rawGetPointee(e)),e},destructor(e){this.rawDestructor?.(e)},readValueFromPointer:je,fromWireType:hn})};function pr(e,r,t,n,i,o,s,l,d,c,v){this.name=e,this.registeredClass=r,this.isReference=t,this.isConst=n,this.isSmartPointer=i,this.pointeeType=o,this.sharingPolicy=s,this.rawGetPointee=l,this.rawConstructor=d,this.rawShare=c,this.rawDestructor=v,!i&&r.baseClass===void 0?n?(this.toWireType=aa,this.destructorFunction=null):(this.toWireType=sa,this.destructorFunction=null):this.toWireType=oa}var gn=(e,r,t)=>{f.hasOwnProperty(e)||cr("Replacing nonexistent public symbol"),f[e].overloadTable!==void 0&&t!==void 0?f[e].overloadTable[t]=r:(f[e]=r,f[e].argCount=t)},Q=(e,r,t=!1)=>{_(!t,"async bindings are only supported with JSPI"),e=G(e);function n(){var o=Lt(r);return o}var i=n();return typeof i!="function"&&O(`unknown function pointer with signature ${e}: ${r}`),i};class da extends Error{}var yn=e=>{var r=xn(e),t=G(r);return ue(r),t},Te=(e,r)=>{var t=[],n={};function i(o){if(!n[o]&&!Se[o]){if(ur[o]){ur[o].forEach(i);return}t.push(o),n[o]=!0}}throw r.forEach(i),new da(`${e}: `+t.map(yn).join([", "]))},ua=(e,r,t,n,i,o,s,l,d,c,v,m,h)=>{v=G(v),o=Q(i,o),l&&=Q(s,l),c&&=Q(d,c),h=Q(m,h);var g=na(v);ze(g,function(){Te(`Cannot construct ${v} due to unbound types`,[n])}),ie([e,r,t],n?[n]:[],E=>{E=E[0];var k,R;n?(k=E.registeredClass,R=k.instancePrototype):R=vr.prototype;var D=mr(v,function(...re){if(Object.getPrototypeOf(this)!==x)throw new He(`Use 'new' to construct ${v}`);if(U.constructor_body===void 0)throw new He(`${v} has no accessible constructor`);var Ke=U.constructor_body[re.length];if(Ke===void 0)throw new He(`Tried to invoke ctor of ${v} with invalid number of parameters (${re.length}) - expected (${Object.keys(U.constructor_body).toString()}) parameters instead!`);return Ke.apply(this,re)}),x=Object.create(R,{constructor:{value:D}});D.prototype=x;var U=new ia(v,D,x,h,k,o,l,c);U.baseClass&&(U.baseClass.__derivedClasses??=[],U.baseClass.__derivedClasses.push(U));var ee=new pr(v,U,!0,!1,!1),ne=new pr(v+"*",U,!1,!1,!1),j=new pr(v+" const*",U,!1,!0,!1);return mn[e]={pointerType:ne,constPointerType:j},gn(g,D),[ee,ne,j]})};function wn(e){for(var r=1;r<e.length;++r)if(e[r]!==null&&e[r].destructorFunction===void 0)return!0;return!1}function ca(e,r,t,n,i){if(e<r||e>t){var o=r==t?r:`${r} to ${t}`;i(`function ${n} called with ${e} arguments, expected ${o}`)}}function fa(e,r,t,n){var i=wn(e),o=e.length-2,s=[],l=["fn"];r&&l.push("thisWired");for(var d=0;d<o;++d)s.push(`arg${d}`),l.push(`arg${d}Wired`);s=s.join(","),l=l.join(",");var c=`return function (${s}) {
8
- `;c+=`checkArgCount(arguments.length, minArgs, maxArgs, humanName, throwBindingError);
9
- `,i&&(c+=`var destructors = [];
10
- `);var v=i?"destructors":"null",m=["humanName","throwBindingError","invoker","fn","runDestructors","fromRetWire","toClassParamWire"];r&&(c+=`var thisWired = toClassParamWire(${v}, this);
11
- `);for(var d=0;d<o;++d){var h=`toArg${d}Wire`;c+=`var arg${d}Wired = ${h}(${v}, arg${d});
12
- `,m.push(h)}c+=(t||n?"var rv = ":"")+`invoker(${l});
13
- `;var g=t?"rv":"";if(i)c+=`runDestructors(destructors);
14
- `;else for(var d=r?1:2;d<e.length;++d){var E=d===1?"thisWired":"arg"+(d-2)+"Wired";e[d].destructorFunction!==null&&(c+=`${E}_dtor(${E});
15
- `,m.push(`${E}_dtor`))}return t&&(c+=`var ret = fromRetWire(rv);
7
+ Originally allocated`);"captureStackTrace"in Error&&Error.captureStackTrace(s,Sn),i.leakWarning=s.stack.replace(/^Error: /,""),Qr.register(r,i,r)}return r},yn=r=>Qr.unregister(r),Ke(e)):(Ke=r=>r,e),gr=[],da=()=>{for(;gr.length;){var e=gr.pop();e.$$.deleteScheduled=!1,e.delete()}},kn,ua=()=>{let e=yr.prototype;Object.assign(e,{isAliasOf(t){if(!(this instanceof yr)||!(t instanceof yr))return!1;var n=this.$$.ptrType.registeredClass,i=this.$$.ptr;t.$$=t.$$;for(var a=t.$$.ptrType.registeredClass,s=t.$$.ptr;n.baseClass;)i=n.upcast(i),n=n.baseClass;for(;a.baseClass;)s=a.upcast(s),a=a.baseClass;return n===a&&i===s},clone(){if(this.$$.ptr||Zr(this),this.$$.preservePointerOnDelete)return this.$$.count.value+=1,this;var t=Ke(Object.create(Object.getPrototypeOf(this),{$$:{value:aa(this.$$)}}));return t.$$.count.value+=1,t.$$.deleteScheduled=!1,t},delete(){this.$$.ptr||Zr(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&O("Object already scheduled for deletion"),yn(this),wn(this.$$),this.$$.preservePointerOnDelete||(this.$$.smartPtr=void 0,this.$$.ptr=void 0)},isDeleted(){return!this.$$.ptr},deleteLater(){return this.$$.ptr||Zr(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&O("Object already scheduled for deletion"),gr.push(this),gr.length===1&&kn&&kn(da),this.$$.deleteScheduled=!0,this}});let r=Symbol.dispose;r&&(e[r]=e.delete)};function yr(){}var wr=(e,r)=>Object.defineProperty(r,"name",{value:e}),et=(e,r,t)=>{if(e[r].overloadTable===void 0){var n=e[r];e[r]=function(...i){return e[r].overloadTable.hasOwnProperty(i.length)||O(`Function '${t}' called with an invalid number of arguments (${i.length}) - expects one of (${e[r].overloadTable})!`),e[r].overloadTable[i.length].apply(this,i)},e[r].overloadTable=[],e[r].overloadTable[n.argCount]=n}},Xe=(e,r,t)=>{f.hasOwnProperty(e)?((t===void 0||f[e].overloadTable!==void 0&&f[e].overloadTable[t]!==void 0)&&O(`Cannot register public name '${e}' twice`),et(f,e,e),f[e].overloadTable.hasOwnProperty(t)&&O(`Cannot register multiple overloads of a function with the same number of arguments (${t})!`),f[e].overloadTable[t]=r):(f[e]=r,f[e].argCount=t)},fa=48,_a=57,va=e=>{_(typeof e=="string"),e=e.replace(/[^a-zA-Z0-9_]/g,"$");var r=e.charCodeAt(0);return r>=fa&&r<=_a?`_${e}`:e};function ha(e,r,t,n,i,a,s,l){this.name=e,this.constructor=r,this.instancePrototype=t,this.rawDestructor=n,this.baseClass=i,this.getActualType=a,this.upcast=s,this.downcast=l,this.pureVirtualFunctions=[]}var Er=(e,r,t)=>{for(;r!==t;)r.upcast||O(`Expected null or instance of ${t.name}, got an instance of ${r.name}`),e=r.upcast(e),r=r.baseClass;return e};function pa(e,r){if(r===null)return this.isReference&&O(`null is not a valid ${this.name}`),0;r.$$||O(`Cannot pass "${Ae(r)}" as a ${this.name}`),r.$$.ptr||O(`Cannot pass deleted object as a pointer of type ${this.name}`);var t=r.$$.ptrType.registeredClass,n=Er(r.$$.ptr,t,this.registeredClass);return n}function ma(e,r){var t;if(r===null)return this.isReference&&O(`null is not a valid ${this.name}`),this.isSmartPointer?(t=this.rawConstructor(),e!==null&&e.push(this.rawDestructor,t),t):0;(!r||!r.$$)&&O(`Cannot pass "${Ae(r)}" as a ${this.name}`),r.$$.ptr||O(`Cannot pass deleted object as a pointer of type ${this.name}`),!this.isConst&&r.$$.ptrType.isConst&&O(`Cannot convert argument of type ${r.$$.smartPtrType?r.$$.smartPtrType.name:r.$$.ptrType.name} to parameter type ${this.name}`);var n=r.$$.ptrType.registeredClass;if(t=Er(r.$$.ptr,n,this.registeredClass),this.isSmartPointer)switch(r.$$.smartPtr===void 0&&O("Passing raw pointer to smart pointer is illegal"),this.sharingPolicy){case 0:r.$$.smartPtrType===this?t=r.$$.smartPtr:O(`Cannot convert argument of type ${r.$$.smartPtrType?r.$$.smartPtrType.name:r.$$.ptrType.name} to parameter type ${this.name}`);break;case 1:t=r.$$.smartPtr;break;case 2:if(r.$$.smartPtrType===this)t=r.$$.smartPtr;else{var i=r.clone();t=this.rawShare(t,ee.toHandle(()=>i.delete())),e!==null&&e.push(this.rawDestructor,t)}break;default:O("Unsupported sharing policy")}return t}function ga(e,r){if(r===null)return this.isReference&&O(`null is not a valid ${this.name}`),0;r.$$||O(`Cannot pass "${Ae(r)}" as a ${this.name}`),r.$$.ptr||O(`Cannot pass deleted object as a pointer of type ${this.name}`),r.$$.ptrType.isConst&&O(`Cannot convert argument of type ${r.$$.ptrType.name} to parameter type ${this.name}`);var t=r.$$.ptrType.registeredClass,n=Er(r.$$.ptr,t,this.registeredClass);return n}var ya=()=>{Object.assign(br.prototype,{getPointee(e){return this.rawGetPointee&&(e=this.rawGetPointee(e)),e},destructor(e){this.rawDestructor?.(e)},readValueFromPointer:Ve,fromWireType:Sn})};function br(e,r,t,n,i,a,s,l,c,u,v){this.name=e,this.registeredClass=r,this.isReference=t,this.isConst=n,this.isSmartPointer=i,this.pointeeType=a,this.sharingPolicy=s,this.rawGetPointee=l,this.rawConstructor=c,this.rawShare=u,this.rawDestructor=v,!i&&r.baseClass===void 0?n?(this.toWireType=pa,this.destructorFunction=null):(this.toWireType=ga,this.destructorFunction=null):this.toWireType=ma}var Tn=(e,r,t)=>{f.hasOwnProperty(e)||pr("Replacing nonexistent public symbol"),f[e].overloadTable!==void 0&&t!==void 0?f[e].overloadTable[t]=r:(f[e]=r,f[e].argCount=t)},ie=(e,r,t=!1)=>{_(!t,"async bindings are only supported with JSPI"),e=Y(e);function n(){var a=x(r);return a}var i=n();return typeof i!="function"&&O(`unknown function pointer with signature ${e}: ${r}`),i};class wa extends Error{}var Fn=e=>{var r=Vn(e),t=Y(r);return he(r),t},Oe=(e,r)=>{var t=[],n={};function i(a){if(!n[a]&&!Ce[a]){if(hr[a]){hr[a].forEach(i);return}t.push(a),n[a]=!0}}throw r.forEach(i),new wa(`${e}: `+t.map(Fn).join([", "]))},Ea=(e,r,t,n,i,a,s,l,c,u,v,h,p)=>{v=Y(v),a=ie(i,a),l&&=ie(s,l),u&&=ie(c,u),p=ie(h,p);var g=va(v);Xe(g,function(){Oe(`Cannot construct ${v} due to unbound types`,[n])}),ce([e,r,t],n?[n]:[],E=>{E=E[0];var k,R;n?(k=E.registeredClass,R=k.instancePrototype):R=yr.prototype;var D=wr(v,function(...oe){if(Object.getPrototypeOf(this)!==z)throw new qe(`Use 'new' to construct ${v}`);if(G.constructor_body===void 0)throw new qe(`${v} has no accessible constructor`);var Qe=G.constructor_body[oe.length];if(Qe===void 0)throw new qe(`Tried to invoke ctor of ${v} with invalid number of parameters (${oe.length}) - expected (${Object.keys(G.constructor_body).toString()}) parameters instead!`);return Qe.apply(this,oe)}),z=Object.create(R,{constructor:{value:D}});D.prototype=z;var G=new ha(v,D,z,p,k,a,l,u);G.baseClass&&(G.baseClass.__derivedClasses??=[],G.baseClass.__derivedClasses.push(G));var ae=new br(v,G,!0,!1,!1),le=new br(v+"*",G,!1,!1,!1),V=new br(v+" const*",G,!1,!0,!1);return bn[e]={pointerType:le,constPointerType:V},Tn(g,D),[ae,le,V]})};function Pn(e){for(var r=1;r<e.length;++r)if(e[r]!==null&&e[r].destructorFunction===void 0)return!0;return!1}function ba(e,r,t,n,i){if(e<r||e>t){var a=r==t?r:`${r} to ${t}`;i(`function ${n} called with ${e} arguments, expected ${a}`)}}function Sa(e,r,t,n){var i=Pn(e),a=e.length-2,s=[],l=["fn"];r&&l.push("thisWired");for(var c=0;c<a;++c)s.push(`arg${c}`),l.push(`arg${c}Wired`);s=s.join(","),l=l.join(",");var u=`return function (${s}) {
8
+ `;u+=`checkArgCount(arguments.length, minArgs, maxArgs, humanName, throwBindingError);
9
+ `,i&&(u+=`var destructors = [];
10
+ `);var v=i?"destructors":"null",h=["humanName","throwBindingError","invoker","fn","runDestructors","fromRetWire","toClassParamWire"];r&&(u+=`var thisWired = toClassParamWire(${v}, this);
11
+ `);for(var c=0;c<a;++c){var p=`toArg${c}Wire`;u+=`var arg${c}Wired = ${p}(${v}, arg${c});
12
+ `,h.push(p)}u+=(t||n?"var rv = ":"")+`invoker(${l});
13
+ `;var g=t?"rv":"";if(i)u+=`runDestructors(destructors);
14
+ `;else for(var c=r?1:2;c<e.length;++c){var E=c===1?"thisWired":"arg"+(c-2)+"Wired";e[c].destructorFunction!==null&&(u+=`${E}_dtor(${E});
15
+ `,h.push(`${E}_dtor`))}return t&&(u+=`var ret = fromRetWire(rv);
16
16
  return ret;
17
- `),c+=`}
18
- `,m.push("checkArgCount","minArgs","maxArgs"),c=`if (arguments.length !== ${m.length}){ throw new Error(humanName + "Expected ${m.length} closure arguments " + arguments.length + " given."); }
19
- ${c}`,new Function(m,c)}function _a(e){for(var r=e.length-2,t=e.length-1;t>=2&&e[t].optional;--t)r--;return r}function gr(e,r,t,n,i,o){var s=r.length;s<2&&O("argTypes array size mismatch! Must at least get return value and 'this' types!"),_(!o,"async bindings are only supported with JSPI");for(var l=r[1]!==null&&t!==null,d=wn(r),c=!r[0].isVoid,v=s-2,m=_a(r),h=r[0],g=r[1],E=[e,O,n,i,dr,h.fromWireType.bind(h),g?.toWireType.bind(g)],k=2;k<s;++k){var R=r[k];E.push(R.toWireType.bind(R))}if(!d)for(var k=l?1:2;k<r.length;++k)r[k].destructorFunction!==null&&E.push(r[k].destructorFunction);E.push(ca,m,v);var x=fa(r,l,c,o)(...E);return mr(e,x)}var yr=(e,r)=>{for(var t=[],n=0;n<e;n++)t.push((u(),y)[r+n*4>>2]);return t},Kr=e=>{e=e.trim();let r=e.indexOf("(");return r===-1?e:(_(e.endsWith(")"),"Parentheses for argument names should match."),e.slice(0,r))},va=(e,r,t,n,i,o,s,l,d)=>{var c=yr(t,n);r=G(r),r=Kr(r),o=Q(i,o,l),ie([],[e],v=>{v=v[0];var m=`${v.name}.${r}`;function h(){Te(`Cannot call ${m} due to unbound types`,c)}r.startsWith("@@")&&(r=Symbol[r.substring(2)]);var g=v.registeredClass.constructor;return g[r]===void 0?(h.argCount=t-1,g[r]=h):(qr(g,r,m),g[r].overloadTable[t-1]=h),ie([],c,E=>{var k=[E[0],null].concat(E.slice(1)),R=gr(m,k,null,o,s,l);if(g[r].overloadTable===void 0?(R.argCount=t-1,g[r]=R):g[r].overloadTable[t-1]=R,v.registeredClass.__derivedClasses)for(let D of v.registeredClass.__derivedClasses)D.constructor.hasOwnProperty(r)||(D.constructor[r]=R);return[]}),[]})},ma=(e,r,t,n,i,o)=>{_(r>0);var s=yr(r,t);i=Q(n,i);var l=[o],d=[];ie([],[e],c=>{c=c[0];var v=`constructor ${c.name}`;if(c.registeredClass.constructor_body===void 0&&(c.registeredClass.constructor_body=[]),c.registeredClass.constructor_body[r-1]!==void 0)throw new He(`Cannot register multiple constructors with identical number of parameters (${r-1}) for class '${c.name}'! Overload resolution is currently only performed using the parameter count, not actual type info!`);return c.registeredClass.constructor_body[r-1]=()=>{Te(`Cannot construct ${c.name} due to unbound types`,s)},ie([],s,m=>(m.splice(1,0,null),c.registeredClass.constructor_body[r-1]=gr(v,m,null,i,o),[])),[]})},ha=(e,r,t,n,i,o,s,l,d,c)=>{var v=yr(t,n);r=G(r),r=Kr(r),o=Q(i,o,d),ie([],[e],m=>{m=m[0];var h=`${m.name}.${r}`;r.startsWith("@@")&&(r=Symbol[r.substring(2)]),l&&m.registeredClass.pureVirtualFunctions.push(r);function g(){Te(`Cannot call ${h} due to unbound types`,v)}var E=m.registeredClass.instancePrototype,k=E[r];return k===void 0||k.overloadTable===void 0&&k.className!==m.name&&k.argCount===t-2?(g.argCount=t-2,g.className=m.name,E[r]=g):(qr(E,r,h),E[r].overloadTable[t-2]=g),ie([],v,R=>{var D=gr(h,R,m,o,s,d);return E[r].overloadTable===void 0?(D.argCount=t-2,E[r]=D):E[r].overloadTable[t-2]=D,[]}),[]})},En=(e,r,t)=>(e instanceof Object||O(`${t} with invalid "this": ${e}`),e instanceof r.registeredClass.constructor||O(`${t} incompatible with "this" of type ${e.constructor.name}`),e.$$.ptr||O(`cannot call emscripten binding method ${t} on deleted object`),hr(e.$$.ptr,e.$$.ptrType.registeredClass,r.registeredClass)),pa=(e,r,t,n,i,o,s,l,d,c)=>{r=G(r),i=Q(n,i),ie([],[e],v=>{v=v[0];var m=`${v.name}.${r}`,h={get(){Te(`Cannot access ${m} due to unbound types`,[t,s])},enumerable:!0,configurable:!0};return d?h.set=()=>Te(`Cannot access ${m} due to unbound types`,[t,s]):h.set=g=>O(m+" is a read-only property"),Object.defineProperty(v.registeredClass.instancePrototype,r,h),ie([],d?[t,s]:[t],g=>{var E=g[0],k={get(){var D=En(this,v,m+" getter");return E.fromWireType(i(o,D))},enumerable:!0};if(d){d=Q(l,d);var R=g[1];k.set=function(D){var x=En(this,v,m+" setter"),U=[];d(c,x,R.toWireType(U,D)),dr(U)}}return Object.defineProperty(v.registeredClass.instancePrototype,r,k),[]}),[]})},bn=[],ae=[0,1,,1,null,1,!0,1,!1,1],Xr=e=>{if(e>9&&--ae[e+1]===0){_(ae[e]!==void 0,"decref for unallocated handle");var r=ae[e];ae[e]=void 0,bn.push(e)}},X={toValue:e=>(e||O(`Cannot use deleted val. handle = ${e}`),_(e===2||ae[e]!==void 0&&e%2===0,`invalid handle: ${e}`),ae[e]),toHandle:e=>{switch(e){case void 0:return 2;case null:return 4;case!0:return 6;case!1:return 8;default:{let r=bn.pop()||ae.length;return ae[r]=e,ae[r+1]=1,r}}}},Sn={name:"emscripten::val",fromWireType:e=>{var r=X.toValue(e);return Xr(e),r},toWireType:(e,r)=>X.toHandle(r),readValueFromPointer:je,destructorFunction:null},ga=e=>Z(e,Sn),Yr=(e,r,t)=>{switch(r){case 1:return t?function(n){return this.fromWireType((u(),W)[n])}:function(n){return this.fromWireType((u(),K)[n])};case 2:return t?function(n){return this.fromWireType((u(),J)[n>>1])}:function(n){return this.fromWireType((u(),ye)[n>>1])};case 4:return t?function(n){return this.fromWireType((u(),S)[n>>2])}:function(n){return this.fromWireType((u(),y)[n>>2])};default:throw new TypeError(`invalid integer width (${r}): ${e}`)}};function ya(e){return e===0?"object":e===1?"number":"string"}var wa=(e,r,t,n,i)=>{r=G(r);let o=ya(i);switch(o){case"object":{let c=function(){};c.values={},Z(e,{name:r,constructor:c,valueType:o,fromWireType:function(v){return this.constructor.values[v]},toWireType:(v,m)=>m.value,readValueFromPointer:Yr(r,t,n),destructorFunction:null}),ze(r,c);break}case"number":{var s={};Z(e,{name:r,keysMap:s,valueType:o,fromWireType:c=>c,toWireType:(c,v)=>v,readValueFromPointer:Yr(r,t,n),destructorFunction:null}),ze(r,s),delete f[r].argCount;break}case"string":{var l={},d={},s={};Z(e,{name:r,valuesMap:l,reverseMap:d,keysMap:s,valueType:o,fromWireType:function(v){return this.reverseMap[v]},toWireType:function(v,m){return this.valuesMap[m]},readValueFromPointer:Yr(r,t,n),destructorFunction:null}),ze(r,s),delete f[r].argCount;break}}},kn=(e,r)=>{var t=Se[e];return t===void 0&&O(`${r} has unknown type ${yn(e)}`),t},Ea=(e,r,t)=>{var n=kn(e,"enum");switch(r=G(r),n.valueType){case"object":{var i=n.constructor,o=Object.create(n.constructor.prototype,{value:{value:t},constructor:{value:mr(`${n.name}_${r}`,function(){})}});i.values[t]=o,i[r]=o;break}case"number":{n.keysMap[r]=t;break}case"string":{n.valuesMap[r]=t,n.reverseMap[t]=r,n.keysMap[r]=r;break}}},ba=(e,r)=>{switch(r){case 4:return function(t){return this.fromWireType((u(),tr)[t>>2])};case 8:return function(t){return this.fromWireType((u(),Re)[t>>3])};default:throw new TypeError(`invalid float width (${r}): ${e}`)}},Sa=(e,r,t)=>{r=G(r),Z(e,{name:r,fromWireType:n=>n,toWireType:(n,i)=>{if(typeof i!="number"&&typeof i!="boolean")throw new TypeError(`Cannot convert ${ke(i)} to ${r}`);return i},readValueFromPointer:ba(r,t),destructorFunction:null})},ka=(e,r,t,n,i,o,s,l)=>{var d=yr(r,t);e=G(e),e=Kr(e),i=Q(n,i,s),ze(e,function(){Te(`Cannot call ${e} due to unbound types`,d)},r-1),ie([],d,c=>{var v=[c[0],null].concat(c.slice(1));return gn(e,gr(e,v,null,i,o,s),r-1),[]})},Ta=(e,r,t,n,i)=>{r=G(r);let o=n===0,s=d=>d;if(o){var l=32-8*t;s=d=>d<<l>>>l,i=s(i)}Z(e,{name:r,fromWireType:s,toWireType:(d,c)=>{if(typeof c!="number"&&typeof c!="boolean")throw new TypeError(`Cannot convert "${ke(c)}" to ${r}`);return cn(r,c,n,i),c},readValueFromPointer:un(r,t,n!==0),destructorFunction:null})},Fa=(e,r,t)=>{let n=(i,o)=>{let s=0;return{next(){if(s>=i)return{done:!0};let l=s;return s++,{value:o(l),done:!1}},[Symbol.iterator](){return this}}};e[Symbol.iterator]||(e[Symbol.iterator]=function(){let i=this[r]();return n(i,o=>this[t](o))})},Pa=(e,r,t,n)=>{t=G(t),n=G(n),ie([],[e,r],i=>{let o=i[0];return Fa(o.registeredClass.instancePrototype,t,n),[]})},Ca=(e,r,t)=>{var n=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array,BigInt64Array,BigUint64Array],i=n[r];function o(s){var l=(u(),y)[s>>2],d=(u(),y)[s+4>>2];return new i((u(),W).buffer,d,l)}t=G(t),Z(e,{name:t,fromWireType:o,readValueFromPointer:o},{ignoreDuplicateRegistrations:!0})},Aa=Object.assign({optional:!0},Sn),Oa=(e,r)=>{Z(e,Aa)},Ra=(e,r)=>{r=G(r);var t=!0;Z(e,{name:r,fromWireType(n){var i=(u(),y)[n>>2],o=n+4,s;if(t)s=le(o,i,!0);else{s="";for(var l=0;l<i;++l)s+=String.fromCharCode((u(),K)[o+l])}return ue(n),s},toWireType(n,i){i instanceof ArrayBuffer&&(i=new Uint8Array(i));var o,s=typeof i=="string";s||ArrayBuffer.isView(i)&&i.BYTES_PER_ELEMENT==1||O("Cannot pass non-string to std::string"),t&&s?o=be(i):o=i.length;var l=Ve(4+o+1),d=l+4;if((u(),y)[l>>2]=o,s)if(t)he(i,d,o+1);else for(var c=0;c<o;++c){var v=i.charCodeAt(c);v>255&&(ue(l),O("String has UTF-16 code units that do not fit in 8 bits")),(u(),K)[d+c]=v}else(u(),K).set(i,d);return n!==null&&n.push(ue,l),l},readValueFromPointer:je,destructorFunction(n){ue(n)}})},Tn=globalThis.TextDecoder?new TextDecoder("utf-16le"):void 0,Da=(e,r,t)=>{_(e%2==0,"pointer passed to UTF16ToString must be 2-byte aligned");var n=e>>1,i=Ut((u(),ye),n,r/2,t);if(i-n>16&&Tn)return Tn.decode((u(),ye).slice(n,i));for(var o="",s=n;s<i;++s){var l=(u(),ye)[s];o+=String.fromCharCode(l)}return o},$a=(e,r,t)=>{if(_(r%2==0,"pointer passed to stringToUTF16 must be 2-byte aligned"),_(typeof t=="number","stringToUTF16 requires a third parameter that specifies the length of the output buffer"),t??=2147483647,t<2)return 0;t-=2;for(var n=r,i=t<e.length*2?t/2:e.length,o=0;o<i;++o){var s=e.charCodeAt(o);(u(),J)[r>>1]=s,r+=2}return(u(),J)[r>>1]=0,r-n},Ia=e=>e.length*2,Na=(e,r,t)=>{_(e%4==0,"pointer passed to UTF32ToString must be 2-byte aligned");for(var n="",i=e>>2,o=0;!(o>=r/4);o++){var s=(u(),y)[i+o];if(!s&&!t)break;n+=String.fromCodePoint(s)}return n},Ma=(e,r,t)=>{if(_(r%4==0,"pointer passed to stringToUTF32 must be 4-byte aligned"),_(typeof t=="number","stringToUTF32 requires a third parameter that specifies the length of the output buffer"),t??=2147483647,t<4)return 0;for(var n=r,i=n+t-4,o=0;o<e.length;++o){var s=e.codePointAt(o);if(s>65535&&o++,(u(),S)[r>>2]=s,r+=4,r+4>i)break}return(u(),S)[r>>2]=0,r-n},Wa=e=>{for(var r=0,t=0;t<e.length;++t){var n=e.codePointAt(t);n>65535&&t++,r+=4}return r},La=(e,r,t)=>{t=G(t);var n,i,o;r===2?(n=Da,i=$a,o=Ia):(_(r===4,"only 2-byte and 4-byte strings are currently supported"),n=Na,i=Ma,o=Wa),Z(e,{name:t,fromWireType:s=>{var l=(u(),y)[s>>2],d=n(s+4,l*r,!0);return ue(s),d},toWireType:(s,l)=>{typeof l!="string"&&O(`Cannot pass non-string to C++ string type ${t}`);var d=o(l),c=Ve(4+d+r);return(u(),y)[c>>2]=d/r,i(l,c+4,d+r),s!==null&&s.push(ue,c),c},readValueFromPointer:je,destructorFunction(s){ue(s)}})},xa=(e,r,t,n,i,o)=>{lr[e]={name:G(r),rawConstructor:Q(t,n),rawDestructor:Q(i,o),fields:[]}},Ua=(e,r,t,n,i,o,s,l,d,c)=>{lr[e].fields.push({fieldName:G(r),getterReturnType:t,getter:Q(n,i),getterContext:o,setterArgumentType:s,setter:Q(l,d),setterContext:c})},ja=(e,r)=>{r=G(r),Z(e,{isVoid:!0,name:r,fromWireType:()=>{},toWireType:(t,n)=>{}})},Ha=e=>{et(e,!L,1,!M,65536,!1),P.threadInitTLS()},Fn=e=>{if(e instanceof kt||e=="unwind")return Ae;xe(),e instanceof WebAssembly.RuntimeError&&at()<=0&&A("Stack overflow detected. You can try increasing -sSTACK_SIZE (currently set to 65536)"),Tr(1,e)},Ba=()=>{if(!ir())try{if(w){Fe()&&it(Ae);return}Ir(Ae)}catch(e){Fn(e)}},Pn=e=>{if(Ce){A("user callback triggered after runtime exited or application aborted. Ignoring.");return}try{return e()}catch(r){Fn(r)}finally{Ba()}},Jr=e=>{if(!Nt){var r=Atomics.waitAsync((u(),S),e>>2,e);_(r.async),r.value.then(wr);var t=e+120;Atomics.store((u(),S),t>>2,1)}},wr=()=>{var e=Fe();e&&Pn(()=>{Jr(e),qn()})},za=(e,r)=>{if(e==r)setTimeout(wr);else if(w)postMessage({targetThread:e,cmd:"checkMailbox"});else{var t=P.pthreads[e];if(!t){A(`Cannot send message to thread with ID ${e}, unknown thread ID!`);return}t.postMessage({cmd:"checkMailbox"})}},Er=[],Ga=(e,r,t,n,i,o,s)=>{Er.length=0;for(var l=i>>3,d=i+n>>3;l<d;){var c;(u(),V)[l++]?c=(u(),V)[l++]:c=(u(),Re)[l++],Er.push(c)}_(!r);var v=Oo[e];_(!(e&&r)),_(v.length==Er.length,"Call args mismatch in _emscripten_receive_on_main_thread_js"),P.currentProxiedOperationCallerThread=t;var m=v(...Er);if(P.currentProxiedOperationCallerThread=0,o){m.then(h=>zn(o,s,h));return}return _(typeof m!="bigint"),m},Va=e=>{w?postMessage({cmd:"cleanupThread",thread:e}):Pt(e)},qa=e=>{C&&P.pthreads[e].ref()},Zr=[],Ka=e=>{var r=Zr.length;return Zr.push(e),r},Xa=(e,r)=>{for(var t=new Array(e),n=0;n<e;++n)t[n]=kn((u(),y)[r+n*4>>2],`parameter ${n}`);return t},Ya=(e,r,t)=>{var n=[],i=e(n,t);return n.length&&((u(),y)[r>>2]=X.toHandle(n)),i},Ja={},Cn=e=>{var r=Ja[e];return r===void 0?G(e):r},Za=(e,r,t)=>{var n=8,[i,...o]=Xa(e,r),s=i.toWireType.bind(i),l=o.map(g=>g.readValueFromPointer.bind(g));e--;var d={toValue:X.toValue},c=l.map((g,E)=>{var k=`argFromPtr${E}`;return d[k]=g,`${k}(args${E?"+"+E*n:""})`}),v;switch(t){case 0:v="toValue(handle)";break;case 2:v="new (toValue(handle))";break;case 3:v="";break;case 1:d.getStringOrSymbol=Cn,v="toValue(handle)[getStringOrSymbol(methodName)]";break}v+=`(${c})`,i.isVoid||(d.toReturnWire=s,d.emval_returnValue=Ya,v=`return emval_returnValue(toReturnWire, destructorsRef, ${v})`),v=`return function (handle, methodName, destructorsRef, args) {
17
+ `),u+=`}
18
+ `,h.push("checkArgCount","minArgs","maxArgs"),u=`if (arguments.length !== ${h.length}){ throw new Error(humanName + "Expected ${h.length} closure arguments " + arguments.length + " given."); }
19
+ ${u}`,new Function(h,u)}function ka(e){for(var r=e.length-2,t=e.length-1;t>=2&&e[t].optional;--t)r--;return r}function Sr(e,r,t,n,i,a){var s=r.length;s<2&&O("argTypes array size mismatch! Must at least get return value and 'this' types!"),_(!a,"async bindings are only supported with JSPI");for(var l=r[1]!==null&&t!==null,c=Pn(r),u=!r[0].isVoid,v=s-2,h=ka(r),p=r[0],g=r[1],E=[e,O,n,i,vr,p.fromWireType.bind(p),g?.toWireType.bind(g)],k=2;k<s;++k){var R=r[k];E.push(R.toWireType.bind(R))}if(!c)for(var k=l?1:2;k<r.length;++k)r[k].destructorFunction!==null&&E.push(r[k].destructorFunction);E.push(ba,h,v);var z=Sa(r,l,u,a)(...E);return wr(e,z)}var kr=(e,r)=>{for(var t=[],n=0;n<e;n++)t.push((d(),y)[r+n*4>>2]);return t},rt=e=>{e=e.trim();let r=e.indexOf("(");return r===-1?e:(_(e.endsWith(")"),"Parentheses for argument names should match."),e.slice(0,r))},Ta=(e,r,t,n,i,a,s,l,c)=>{var u=kr(t,n);r=Y(r),r=rt(r),a=ie(i,a,l),ce([],[e],v=>{v=v[0];var h=`${v.name}.${r}`;function p(){Oe(`Cannot call ${h} due to unbound types`,u)}r.startsWith("@@")&&(r=Symbol[r.substring(2)]);var g=v.registeredClass.constructor;return g[r]===void 0?(p.argCount=t-1,g[r]=p):(et(g,r,h),g[r].overloadTable[t-1]=p),ce([],u,E=>{var k=[E[0],null].concat(E.slice(1)),R=Sr(h,k,null,a,s,l);if(g[r].overloadTable===void 0?(R.argCount=t-1,g[r]=R):g[r].overloadTable[t-1]=R,v.registeredClass.__derivedClasses)for(let D of v.registeredClass.__derivedClasses)D.constructor.hasOwnProperty(r)||(D.constructor[r]=R);return[]}),[]})},Fa=(e,r,t,n,i,a)=>{_(r>0);var s=kr(r,t);i=ie(n,i);var l=[a],c=[];ce([],[e],u=>{u=u[0];var v=`constructor ${u.name}`;if(u.registeredClass.constructor_body===void 0&&(u.registeredClass.constructor_body=[]),u.registeredClass.constructor_body[r-1]!==void 0)throw new qe(`Cannot register multiple constructors with identical number of parameters (${r-1}) for class '${u.name}'! Overload resolution is currently only performed using the parameter count, not actual type info!`);return u.registeredClass.constructor_body[r-1]=()=>{Oe(`Cannot construct ${u.name} due to unbound types`,s)},ce([],s,h=>(h.splice(1,0,null),u.registeredClass.constructor_body[r-1]=Sr(v,h,null,i,a),[])),[]})},Pa=(e,r,t,n,i,a,s,l,c,u)=>{var v=kr(t,n);r=Y(r),r=rt(r),a=ie(i,a,c),ce([],[e],h=>{h=h[0];var p=`${h.name}.${r}`;r.startsWith("@@")&&(r=Symbol[r.substring(2)]),l&&h.registeredClass.pureVirtualFunctions.push(r);function g(){Oe(`Cannot call ${p} due to unbound types`,v)}var E=h.registeredClass.instancePrototype,k=E[r];return k===void 0||k.overloadTable===void 0&&k.className!==h.name&&k.argCount===t-2?(g.argCount=t-2,g.className=h.name,E[r]=g):(et(E,r,p),E[r].overloadTable[t-2]=g),ce([],v,R=>{var D=Sr(p,R,h,a,s,c);return E[r].overloadTable===void 0?(D.argCount=t-2,E[r]=D):E[r].overloadTable[t-2]=D,[]}),[]})},Cn=(e,r,t)=>(e instanceof Object||O(`${t} with invalid "this": ${e}`),e instanceof r.registeredClass.constructor||O(`${t} incompatible with "this" of type ${e.constructor.name}`),e.$$.ptr||O(`cannot call emscripten binding method ${t} on deleted object`),Er(e.$$.ptr,e.$$.ptrType.registeredClass,r.registeredClass)),Ca=(e,r,t,n,i,a,s,l,c,u)=>{r=Y(r),i=ie(n,i),ce([],[e],v=>{v=v[0];var h=`${v.name}.${r}`,p={get(){Oe(`Cannot access ${h} due to unbound types`,[t,s])},enumerable:!0,configurable:!0};return c?p.set=()=>Oe(`Cannot access ${h} due to unbound types`,[t,s]):p.set=g=>O(h+" is a read-only property"),Object.defineProperty(v.registeredClass.instancePrototype,r,p),ce([],c?[t,s]:[t],g=>{var E=g[0],k={get(){var D=Cn(this,v,h+" getter");return E.fromWireType(i(a,D))},enumerable:!0};if(c){c=ie(l,c);var R=g[1];k.set=function(D){var z=Cn(this,v,h+" setter"),G=[];c(u,z,R.toWireType(G,D)),vr(G)}}return Object.defineProperty(v.registeredClass.instancePrototype,r,k),[]}),[]})},An=[],de=[0,1,,1,null,1,!0,1,!1,1],tt=e=>{if(e>9&&--de[e+1]===0){_(de[e]!==void 0,"decref for unallocated handle");var r=de[e];de[e]=void 0,An.push(e)}},ee={toValue:e=>(e||O(`Cannot use deleted val. handle = ${e}`),_(e===2||de[e]!==void 0&&e%2===0,`invalid handle: ${e}`),de[e]),toHandle:e=>{switch(e){case void 0:return 2;case null:return 4;case!0:return 6;case!1:return 8;default:{let r=An.pop()||de.length;return de[r]=e,de[r+1]=1,r}}}},On={name:"emscripten::val",fromWireType:e=>{var r=ee.toValue(e);return tt(e),r},toWireType:(e,r)=>ee.toHandle(r),readValueFromPointer:Ve,destructorFunction:null},Aa=e=>ne(e,On),nt=(e,r,t)=>{switch(r){case 1:return t?function(n){return this.fromWireType((d(),H)[n])}:function(n){return this.fromWireType((d(),Q)[n])};case 2:return t?function(n){return this.fromWireType((d(),te)[n>>1])}:function(n){return this.fromWireType((d(),ke)[n>>1])};case 4:return t?function(n){return this.fromWireType((d(),S)[n>>2])}:function(n){return this.fromWireType((d(),y)[n>>2])};default:throw new TypeError(`invalid integer width (${r}): ${e}`)}};function Oa(e){return e===0?"object":e===1?"number":"string"}var Ra=(e,r,t,n,i)=>{r=Y(r);let a=Oa(i);switch(a){case"object":{let u=function(){};u.values={},ne(e,{name:r,constructor:u,valueType:a,fromWireType:function(v){return this.constructor.values[v]},toWireType:(v,h)=>h.value,readValueFromPointer:nt(r,t,n),destructorFunction:null}),Xe(r,u);break}case"number":{var s={};ne(e,{name:r,keysMap:s,valueType:a,fromWireType:u=>u,toWireType:(u,v)=>v,readValueFromPointer:nt(r,t,n),destructorFunction:null}),Xe(r,s),delete f[r].argCount;break}case"string":{var l={},c={},s={};ne(e,{name:r,valuesMap:l,reverseMap:c,keysMap:s,valueType:a,fromWireType:function(v){return this.reverseMap[v]},toWireType:function(v,h){return this.valuesMap[h]},readValueFromPointer:nt(r,t,n),destructorFunction:null}),Xe(r,s),delete f[r].argCount;break}}},Rn=(e,r)=>{var t=Ce[e];return t===void 0&&O(`${r} has unknown type ${Fn(e)}`),t},Da=(e,r,t)=>{var n=Rn(e,"enum");switch(r=Y(r),n.valueType){case"object":{var i=n.constructor,a=Object.create(n.constructor.prototype,{value:{value:t},constructor:{value:wr(`${n.name}_${r}`,function(){})}});i.values[t]=a,i[r]=a;break}case"number":{n.keysMap[r]=t;break}case"string":{n.valuesMap[r]=t,n.reverseMap[t]=r,n.keysMap[r]=r;break}}},Ia=(e,r)=>{switch(r){case 4:return function(t){return this.fromWireType((d(),sr)[t>>2])};case 8:return function(t){return this.fromWireType((d(),Me)[t>>3])};default:throw new TypeError(`invalid float width (${r}): ${e}`)}},$a=(e,r,t)=>{r=Y(r),ne(e,{name:r,fromWireType:n=>n,toWireType:(n,i)=>{if(typeof i!="number"&&typeof i!="boolean")throw new TypeError(`Cannot convert ${Ae(i)} to ${r}`);return i},readValueFromPointer:Ia(r,t),destructorFunction:null})},Na=(e,r,t,n,i,a,s,l)=>{var c=kr(r,t);e=Y(e),e=rt(e),i=ie(n,i,s),Xe(e,function(){Oe(`Cannot call ${e} due to unbound types`,c)},r-1),ce([],c,u=>{var v=[u[0],null].concat(u.slice(1));return Tn(e,Sr(e,v,null,i,a,s),r-1),[]})},Ma=(e,r,t,n,i)=>{r=Y(r);let a=n===0,s=c=>c;if(a){var l=32-8*t;s=c=>c<<l>>>l,i=s(i)}ne(e,{name:r,fromWireType:s,toWireType:(c,u)=>{if(typeof u!="number"&&typeof u!="boolean")throw new TypeError(`Cannot convert "${Ae(u)}" to ${r}`);return gn(r,u,n,i),u},readValueFromPointer:mn(r,t,n!==0),destructorFunction:null})},xa=(e,r,t)=>{let n=(i,a)=>{let s=0;return{next(){if(s>=i)return{done:!0};let l=s;return s++,{value:a(l),done:!1}},[Symbol.iterator](){return this}}};e[Symbol.iterator]||(e[Symbol.iterator]=function(){let i=this[r]();return n(i,a=>this[t](a))})},Wa=(e,r,t,n)=>{t=Y(t),n=Y(n),ce([],[e,r],i=>{let a=i[0];return xa(a.registeredClass.instancePrototype,t,n),[]})},La=(e,r,t)=>{var n=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array,BigInt64Array,BigUint64Array],i=n[r];function a(s){var l=(d(),y)[s>>2],c=(d(),y)[s+4>>2];return new i((d(),H).buffer,c,l)}t=Y(t),ne(e,{name:t,fromWireType:a,readValueFromPointer:a},{ignoreDuplicateRegistrations:!0})},Ua=Object.assign({optional:!0},On),ja=(e,r)=>{ne(e,Ua)},Ha=(e,r)=>{r=Y(r);var t=!0;ne(e,{name:r,fromWireType(n){var i=(d(),y)[n>>2],a=n+4,s;if(t)s=_e(a,i,!0);else{s="";for(var l=0;l<i;++l)s+=String.fromCharCode((d(),Q)[a+l])}return he(n),s},toWireType(n,i){i instanceof ArrayBuffer&&(i=new Uint8Array(i));var a,s=typeof i=="string";s||ArrayBuffer.isView(i)&&i.BYTES_PER_ELEMENT==1||O("Cannot pass non-string to std::string"),t&&s?a=Pe(i):a=i.length;var l=Je(4+a+1),c=l+4;if((d(),y)[l>>2]=a,s)if(t)Ee(i,c,a+1);else for(var u=0;u<a;++u){var v=i.charCodeAt(u);v>255&&(he(l),O("String has UTF-16 code units that do not fit in 8 bits")),(d(),Q)[c+u]=v}else(d(),Q).set(i,c);return n!==null&&n.push(he,l),l},readValueFromPointer:Ve,destructorFunction(n){he(n)}})},Dn=globalThis.TextDecoder?new TextDecoder("utf-16le"):void 0,Ba=(e,r,t)=>{_(e%2==0,"pointer passed to UTF16ToString must be 2-byte aligned");var n=e>>1,i=Gt((d(),ke),n,r/2,t);if(i-n>16&&Dn)return Dn.decode((d(),ke).slice(n,i));for(var a="",s=n;s<i;++s){var l=(d(),ke)[s];a+=String.fromCharCode(l)}return a},za=(e,r,t)=>{if(_(r%2==0,"pointer passed to stringToUTF16 must be 2-byte aligned"),_(typeof t=="number","stringToUTF16 requires a third parameter that specifies the length of the output buffer"),t??=2147483647,t<2)return 0;t-=2;for(var n=r,i=t<e.length*2?t/2:e.length,a=0;a<i;++a){var s=e.charCodeAt(a);(d(),te)[r>>1]=s,r+=2}return(d(),te)[r>>1]=0,r-n},Ga=e=>e.length*2,Va=(e,r,t)=>{_(e%4==0,"pointer passed to UTF32ToString must be 2-byte aligned");for(var n="",i=e>>2,a=0;!(a>=r/4);a++){var s=(d(),y)[i+a];if(!s&&!t)break;n+=String.fromCodePoint(s)}return n},qa=(e,r,t)=>{if(_(r%4==0,"pointer passed to stringToUTF32 must be 4-byte aligned"),_(typeof t=="number","stringToUTF32 requires a third parameter that specifies the length of the output buffer"),t??=2147483647,t<4)return 0;for(var n=r,i=n+t-4,a=0;a<e.length;++a){var s=e.codePointAt(a);if(s>65535&&a++,(d(),S)[r>>2]=s,r+=4,r+4>i)break}return(d(),S)[r>>2]=0,r-n},Ka=e=>{for(var r=0,t=0;t<e.length;++t){var n=e.codePointAt(t);n>65535&&t++,r+=4}return r},Xa=(e,r,t)=>{t=Y(t);var n,i,a;r===2?(n=Ba,i=za,a=Ga):(_(r===4,"only 2-byte and 4-byte strings are currently supported"),n=Va,i=qa,a=Ka),ne(e,{name:t,fromWireType:s=>{var l=(d(),y)[s>>2],c=n(s+4,l*r,!0);return he(s),c},toWireType:(s,l)=>{typeof l!="string"&&O(`Cannot pass non-string to C++ string type ${t}`);var c=a(l),u=Je(4+c+r);return(d(),y)[u>>2]=c/r,i(l,u+4,c+r),s!==null&&s.push(he,u),u},readValueFromPointer:Ve,destructorFunction(s){he(s)}})},Ya=(e,r,t,n,i,a)=>{_r[e]={name:Y(r),rawConstructor:ie(t,n),rawDestructor:ie(i,a),fields:[]}},Ja=(e,r,t,n,i,a,s,l,c,u)=>{_r[e].fields.push({fieldName:Y(r),getterReturnType:t,getter:ie(n,i),getterContext:a,setterArgumentType:s,setter:ie(l,c),setterContext:u})},Za=(e,r)=>{r=Y(r),ne(e,{isVoid:!0,name:r,fromWireType:()=>{},toWireType:(t,n)=>{}})},Qa=e=>{st(e,!B,1,!j,65536,!1),P.threadInitTLS()},In=e=>{if(e instanceof Rt||e=="unwind")return $e;ze(),e instanceof WebAssembly.RuntimeError&&ft()<=0&&A("Stack overflow detected. You can try increasing -sSTACK_SIZE (currently set to 65536)"),Or(1,e)},eo=()=>{if(!cr())try{if(w){Re()&&ut($e);return}Lr($e)}catch(e){In(e)}},$n=e=>{if(Ie){A("user callback triggered after runtime exited or application aborted. Ignoring.");return}try{return e()}catch(r){In(r)}finally{eo()}},it=e=>{if(!jt){var r=Atomics.waitAsync((d(),S),e>>2,e);_(r.async),r.value.then(Tr);var t=e+120;Atomics.store((d(),S),t>>2,1)}},Tr=()=>{var e=Re();e&&$n(()=>{it(e),ei()})},ro=(e,r)=>{if(e==r)setTimeout(Tr);else if(w)postMessage({targetThread:e,cmd:"checkMailbox"});else{var t=P.pthreads[e];if(!t){A(`Cannot send message to thread with ID ${e}, unknown thread ID!`);return}t.postMessage({cmd:"checkMailbox"})}},Fr=[],to=(e,r,t,n,i,a,s)=>{Fr.length=0;for(var l=i>>3,c=i+n>>3;l<c;){var u;(d(),Z)[l++]?u=(d(),Z)[l++]:u=(d(),Me)[l++],Fr.push(u)}_(!r);var v=Ho[e];_(!(e&&r)),_(v.length==Fr.length,"Call args mismatch in _emscripten_receive_on_main_thread_js"),P.currentProxiedOperationCallerThread=t;var h=v(...Fr);if(P.currentProxiedOperationCallerThread=0,a){h.then(p=>Jn(a,s,p));return}return _(typeof h!="bigint"),h},no=e=>{w?postMessage({cmd:"cleanupThread",thread:e}):$t(e)},io=e=>{C&&P.pthreads[e].ref()},at=[],ao=e=>{var r=at.length;return at.push(e),r},oo=(e,r)=>{for(var t=new Array(e),n=0;n<e;++n)t[n]=Rn((d(),y)[r+n*4>>2],`parameter ${n}`);return t},so=(e,r,t)=>{var n=[],i=e(n,t);return n.length&&((d(),y)[r>>2]=ee.toHandle(n)),i},lo={},Nn=e=>{var r=lo[e];return r===void 0?Y(e):r},co=(e,r,t)=>{var n=8,[i,...a]=oo(e,r),s=i.toWireType.bind(i),l=a.map(g=>g.readValueFromPointer.bind(g));e--;var c={toValue:ee.toValue},u=l.map((g,E)=>{var k=`argFromPtr${E}`;return c[k]=g,`${k}(args${E?"+"+E*n:""})`}),v;switch(t){case 0:v="toValue(handle)";break;case 2:v="new (toValue(handle))";break;case 3:v="";break;case 1:c.getStringOrSymbol=Nn,v="toValue(handle)[getStringOrSymbol(methodName)]";break}v+=`(${u})`,i.isVoid||(c.toReturnWire=s,c.emval_returnValue=so,v=`return emval_returnValue(toReturnWire, destructorsRef, ${v})`),v=`return function (handle, methodName, destructorsRef, args) {
20
20
  ${v}
21
- }`;var m=new Function(Object.keys(d),v)(...Object.values(d)),h=`methodCaller<(${o.map(g=>g.name)}) => ${i.name}>`;return Ka(mr(h,m))},Qa=(e,r)=>(e=X.toValue(e),r=X.toValue(r),X.toHandle(e[r])),eo=e=>{e>9&&(ae[e+1]+=1)},An=(e,r,t,n,i)=>Zr[e](r,t,n,i),ro=(e,r,t,n,i)=>An(e,r,t,n,i),to=e=>X.toHandle(Cn(e)),no=e=>{var r=X.toValue(e);dr(r),Xr(e)},io=(e,r,t,n)=>{var i=new Date().getFullYear(),o=new Date(i,0,1),s=new Date(i,6,1),l=o.getTimezoneOffset(),d=s.getTimezoneOffset(),c=Math.max(l,d);(u(),y)[e>>2]=c*60,(u(),S)[r>>2]=+(l!=d);var v=g=>{var E=g>=0?"-":"+",k=Math.abs(g),R=String(Math.floor(k/60)).padStart(2,"0"),D=String(k%60).padStart(2,"0");return`UTC${E}${R}${D}`},m=v(l),h=v(d);_(m),_(h),_(be(m)<=16,`timezone name truncated to fit in TZNAME_MAX (${m})`),_(be(h)<=16,`timezone name truncated to fit in TZNAME_MAX (${h})`),d<l?(he(m,t,17),he(h,n,17)):(he(m,n,17),he(h,t,17))},On=()=>performance.timeOrigin+performance.now(),ao=()=>Date.now(),oo=1,so=e=>e>=0&&e<=3,lo=9007199254740992,uo=-9007199254740992,Rn=e=>e<uo||e>lo?NaN:Number(e);function co(e,r,t){if(r=Rn(r),!so(e))return 28;var n;if(e===0)n=ao();else if(oo)n=On();else return 52;var i=Math.round(n*1e3*1e3);return(u(),V)[t>>3]=BigInt(i),0}var fo=()=>{C||L||Ee("Blocking on the main thread is very dangerous, see https://emscripten.org/docs/porting/pthreads.html#blocking-on-the-main-browser-thread")},_o=e=>A(le(e)),vo=()=>{nr+=1},mo=()=>{throw vo(),"unwind"},ho=()=>2147483648,po=(e,r)=>(_(r,"alignment argument is required"),Math.ceil(e/r)*r),go=e=>{var r=se.buffer.byteLength,t=(e-r+65535)/65536|0;try{return se.grow(t),rr(),1}catch(n){A(`growMemory: Attempted to grow heap from ${r} bytes to ${e} bytes, but got error: ${n}`)}},yo=e=>{var r=(u(),K).length;if(e>>>=0,e<=r)return!1;var t=ho();if(e>t)return A(`Cannot enlarge memory, requested ${e} bytes, but the limit is ${t} bytes!`),!1;for(var n=1;n<=4;n*=2){var i=r*(1+.2/n);i=Math.min(i,e+100663296);var o=Math.min(t,po(Math.max(e,i),65536)),s=go(o);if(s)return!0}return A(`Failed to grow the heap from ${r} bytes to ${o} bytes, not enough memory!`),!1},Qr={},wo=()=>kr||"./this.program",Ge=()=>{if(!Ge.strings){var e=(globalThis.navigator?.language??"C").replace("-","_")+".UTF-8",r={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:e,_:wo()};for(var t in Qr)Qr[t]===void 0?delete r[t]:r[t]=Qr[t];var n=[];for(var t in r)n.push(`${t}=${r[t]}`);Ge.strings=n}return Ge.strings};function Dn(e,r){if(w)return B(15,0,1,e,r);var t=0,n=0;for(var i of Ge()){var o=r+t;(u(),y)[e+n>>2]=o,t+=he(i,o,1/0)+1,n+=4}return 0}function $n(e,r){if(w)return B(16,0,1,e,r);var t=Ge();(u(),y)[e>>2]=t.length;var n=0;for(var i of t)n+=be(i)+1;return(u(),y)[r>>2]=n,0}function In(e){if(w)return B(17,0,1,e);try{var r=z.getStreamFromFD(e);return a.close(r),0}catch(t){if(typeof a>"u"||t.name!=="ErrnoError")throw t;return t.errno}}var Eo=(e,r,t,n)=>{for(var i=0,o=0;o<t;o++){var s=(u(),y)[r>>2],l=(u(),y)[r+4>>2];r+=8;var d=a.read(e,(u(),W),s,l,n);if(d<0)return-1;if(i+=d,d<l)break;typeof n<"u"&&(n+=d)}return i};function Nn(e,r,t,n){if(w)return B(18,0,1,e,r,t,n);try{var i=z.getStreamFromFD(e),o=Eo(i,r,t);return(u(),y)[n>>2]=o,0}catch(s){if(typeof a>"u"||s.name!=="ErrnoError")throw s;return s.errno}}function Mn(e,r,t,n){if(w)return B(19,0,1,e,r,t,n);r=Rn(r);try{if(isNaN(r))return 22;var i=z.getStreamFromFD(e);return a.llseek(i,r,t),(u(),V)[n>>3]=BigInt(i.position),i.getdents&&r===0&&t===0&&(i.getdents=null),0}catch(o){if(typeof a>"u"||o.name!=="ErrnoError")throw o;return o.errno}}var bo=(e,r,t,n)=>{for(var i=0,o=0;o<t;o++){var s=(u(),y)[r>>2],l=(u(),y)[r+4>>2];r+=8;var d=a.write(e,(u(),W),s,l,n);if(d<0)return-1;if(i+=d,d<l)break;typeof n<"u"&&(n+=d)}return i};function Wn(e,r,t,n){if(w)return B(20,0,1,e,r,t,n);try{var i=z.getStreamFromFD(e),o=bo(i,r,t);return(u(),y)[n>>2]=o,0}catch(s){if(typeof a>"u"||s.name!=="ErrnoError")throw s;return s.errno}}function Ln(e,r,t,n){if(w)return B(21,0,1,e,r,t,n);var i=[],o=null,s=0,l=0,d=0,c=0,v=0,m=0,h,g;function E(k,R,D,x,U,ee){var ne,j,re,Ke;return j=k===10?28:16,U=k===10?qt(U):Br(U),ne=Ve(j),Ke=nn(ne,k,U,ee),_(!Ke),re=Ve(32),(u(),S)[re+4>>2]=k,(u(),S)[re+8>>2]=R,(u(),S)[re+12>>2]=D,(u(),y)[re+24>>2]=x,(u(),y)[re+20>>2]=ne,k===10?(u(),S)[re+16>>2]=28:(u(),S)[re+16>>2]=16,(u(),S)[re+28>>2]=0,re}if(t&&(d=(u(),S)[t>>2],c=(u(),S)[t+4>>2],v=(u(),S)[t+8>>2],m=(u(),S)[t+12>>2]),v&&!m&&(m=v===2?17:6),!v&&m&&(v=m===17?2:1),m===0&&(m=6),v===0&&(v=1),!e&&!r)return-2;if(d&-1088||t!==0&&(u(),S)[t>>2]&2&&!e)return-1;if(d&32)return-2;if(v!==0&&v!==1&&v!==2)return-7;if(c!==0&&c!==2&&c!==10)return-6;if(r&&(r=le(r),l=parseInt(r,10),isNaN(l)))return d&1024?-2:-8;if(!e)return c===0&&(c=2),(d&1)===0&&(c===2?s=qe(2130706433):s=[0,0,0,qe(1)]),h=E(c,v,m,null,s,l),(u(),y)[n>>2]=h,0;if(e=le(e),s=or(e),s!==null)if(c===0||c===2)c=2;else if(c===10&&d&8)s=[0,0,qe(65535),s],c=10;else return-2;else if(s=zr(e),s!==null)if(c===0||c===10)c=10;else return-2;return s!=null?(h=E(c,v,m,e,s,l),(u(),y)[n>>2]=h,0):d&4?-2:(e=de.lookup_name(e),s=or(e),c===0?c=2:c===10&&(s=[0,0,qe(65535),s]),h=E(c,v,m,null,s,l),(u(),y)[n>>2]=h,0)}var So=(e,r)=>Mr((u(),K).subarray(e,e+r)),ko=(...e)=>a.createPath(...e),To=(...e)=>a.unlink(...e),Fo=(...e)=>a.createLazyFile(...e),Po=(...e)=>a.createDevice(...e);P.init(),a.createPreloadedFile=Ui,a.preloadFile=jr,a.staticInit(),C&&b.staticInit(),ea(),la(),_(ae.length===10);{if(_i(),f.noExitRuntime&&(Nr=f.noExitRuntime),f.preloadPlugins&&(Vt=f.preloadPlugins),f.print&&(_e=f.print),f.printErr&&(A=f.printErr),f.wasmBinary&&(Le=f.wasmBinary),Ro(),f.arguments&&(ct=f.arguments),f.thisProgram&&(kr=f.thisProgram),_(typeof f.memoryInitializerPrefixURL>"u","Module.memoryInitializerPrefixURL option was removed, use Module.locateFile instead"),_(typeof f.pthreadMainPrefixURL>"u","Module.pthreadMainPrefixURL option was removed, use Module.locateFile instead"),_(typeof f.cdInitializerPrefixURL>"u","Module.cdInitializerPrefixURL option was removed, use Module.locateFile instead"),_(typeof f.filePackagePrefixURL>"u","Module.filePackagePrefixURL option was removed, use Module.locateFile instead"),_(typeof f.read>"u","Module.read option was removed"),_(typeof f.readAsync>"u","Module.readAsync option was removed (modify readAsync in JS)"),_(typeof f.readBinary>"u","Module.readBinary option was removed (modify readBinary in JS)"),_(typeof f.setWindowTitle>"u","Module.setWindowTitle option was removed (modify emscripten_set_window_title in JS)"),_(typeof f.TOTAL_MEMORY>"u","Module.TOTAL_MEMORY has been renamed Module.INITIAL_MEMORY"),_(typeof f.ENVIRONMENT>"u","Module.ENVIRONMENT has been deprecated. To force the environment, use the ENVIRONMENT compile-time option (for example, -sENVIRONMENT=web or -sENVIRONMENT=node)"),_(typeof f.STACK_SIZE>"u","STACK_SIZE can no longer be set at runtime. Use -sSTACK_SIZE at link time"),f.preInit)for(typeof f.preInit=="function"&&(f.preInit=[f.preInit]);f.preInit.length>0;)f.preInit.shift()();er("preInit")}f.addRunDependency=$r,f.removeRunDependency=Dr,f.FS_preloadFile=jr,f.FS_unlink=To,f.FS_createPath=ko,f.FS_createDevice=Po,f.FS=a,f.FS_createDataFile=Gt,f.FS_createLazyFile=Fo;var Co=["writeI53ToI64","writeI53ToI64Clamped","writeI53ToI64Signaling","writeI53ToU64Clamped","writeI53ToU64Signaling","readI53FromI64","readI53FromU64","convertI32PairToI53","convertI32PairToI53Checked","convertU32PairToI53","getTempRet0","setTempRet0","withStackSave","readEmAsmArgs","jstoi_q","autoResumeAudioContext","getDynCaller","dynCall","runtimeKeepalivePop","asmjsMangle","HandleAllocator","addOnInit","addOnPostCtor","addOnPreMain","addOnExit","STACK_SIZE","STACK_ALIGN","POINTER_SIZE","ASSERTIONS","ccall","cwrap","convertJsFunctionToWasm","getEmptyTableSlot","updateTableMap","getFunctionAddress","addFunction","removeFunction","intArrayToString","stringToAscii","stringToNewUTF8","stringToUTF8OnStack","writeArrayToMemory","registerKeyEventCallback","maybeCStringToJsString","findEventTarget","getBoundingClientRect","fillMouseEventData","registerMouseEventCallback","registerWheelEventCallback","registerUiEventCallback","registerFocusEventCallback","fillDeviceOrientationEventData","registerDeviceOrientationEventCallback","fillDeviceMotionEventData","registerDeviceMotionEventCallback","screenOrientation","fillOrientationChangeEventData","registerOrientationChangeEventCallback","fillFullscreenChangeEventData","registerFullscreenChangeEventCallback","JSEvents_requestFullscreen","JSEvents_resizeCanvasForFullscreen","registerRestoreOldStyle","hideEverythingExceptGivenElement","restoreHiddenElements","setLetterbox","softFullscreenResizeWebGLRenderTarget","doRequestFullscreen","fillPointerlockChangeEventData","registerPointerlockChangeEventCallback","registerPointerlockErrorEventCallback","requestPointerLock","fillVisibilityChangeEventData","registerVisibilityChangeEventCallback","registerTouchEventCallback","fillGamepadEventData","registerGamepadEventCallback","registerBeforeUnloadEventCallback","fillBatteryEventData","registerBatteryEventCallback","setCanvasElementSizeCallingThread","setCanvasElementSizeMainThread","setCanvasElementSize","getCanvasSizeCallingThread","getCanvasSizeMainThread","getCanvasElementSize","jsStackTrace","getCallstack","convertPCtoSourceLocation","wasiRightsToMuslOFlags","wasiOFlagsToMuslOFlags","safeSetTimeout","setImmediateWrapped","safeRequestAnimationFrame","clearImmediateWrapped","registerPostMainLoop","registerPreMainLoop","getPromise","makePromise","idsToPromises","makePromiseCallback","findMatchingCatch","incrementUncaughtExceptionCount","decrementUncaughtExceptionCount","Browser_asyncPrepareDataCounter","isLeapYear","ydayFromDate","arraySum","addDays","FS_mkdirTree","_setNetworkCallback","heapObjectForWebGLType","toTypedArrayIndex","webgl_enable_ANGLE_instanced_arrays","webgl_enable_OES_vertex_array_object","webgl_enable_WEBGL_draw_buffers","webgl_enable_WEBGL_multi_draw","webgl_enable_EXT_polygon_offset_clamp","webgl_enable_EXT_clip_control","webgl_enable_WEBGL_polygon_mode","emscriptenWebGLGet","computeUnpackAlignedImageSize","colorChannelsInGlTextureFormat","emscriptenWebGLGetTexPixelData","emscriptenWebGLGetUniform","webglGetUniformLocation","webglPrepareUniformLocationsBeforeFirstUse","webglGetLeftBracePos","emscriptenWebGLGetVertexAttrib","__glGetActiveAttribOrUniform","writeGLArray","emscripten_webgl_destroy_context_before_on_calling_thread","registerWebGlEventCallback","runAndAbortIfError","ALLOC_NORMAL","ALLOC_STACK","allocate","writeStringToMemory","writeAsciiToMemory","allocateUTF8","allocateUTF8OnStack","demangle","stackTrace","getNativeTypeSize","getFunctionArgsName","createJsInvokerSignature","PureVirtualError","registerInheritedInstance","unregisterInheritedInstance","getInheritedInstanceCount","getLiveInheritedInstances","setDelayFunction","count_emval_handles"];Co.forEach(ci);var Ao=["run","out","err","callMain","abort","wasmExports","writeStackCookie","checkStackCookie","INT53_MAX","INT53_MIN","bigintToI53Checked","HEAP8","HEAP16","HEAPU16","HEAP32","HEAPU32","HEAPF32","HEAPF64","HEAP64","HEAPU64","stackSave","stackRestore","stackAlloc","createNamedFunction","ptrToString","zeroMemory","exitJS","getHeapMax","growMemory","ENV","ERRNO_CODES","strError","inetPton4","inetNtop4","inetPton6","inetNtop6","readSockaddr","writeSockaddr","DNS","Protocols","Sockets","timers","warnOnce","readEmAsmArgsArray","getExecutableName","handleException","keepRuntimeAlive","runtimeKeepalivePush","callUserCallback","maybeExit","asyncLoad","alignMemory","mmapAlloc","wasmTable","wasmMemory","getUniqueRunDependency","noExitRuntime","addOnPreRun","addOnPostRun","freeTableIndexes","functionsInTableMap","setValue","getValue","PATH","PATH_FS","UTF8Decoder","UTF8ArrayToString","UTF8ToString","stringToUTF8Array","stringToUTF8","lengthBytesUTF8","intArrayFromString","AsciiToString","UTF16Decoder","UTF16ToString","stringToUTF16","lengthBytesUTF16","UTF32ToString","stringToUTF32","lengthBytesUTF32","JSEvents","specialHTMLTargets","findCanvasEventTarget","currentFullscreenStrategy","restoreOldWindowedStyle","UNWIND_CACHE","ExitStatus","getEnvStrings","checkWasiClock","doReadv","doWritev","initRandomFill","randomFill","emSetImmediate","emClearImmediate_deps","emClearImmediate","promiseMap","uncaughtExceptionCount","exceptionCaught","ExceptionInfo","Browser","requestFullscreen","requestFullScreen","setCanvasSize","getUserMedia","createContext","getPreloadedImageData__data","wget","MONTH_DAYS_REGULAR","MONTH_DAYS_LEAP","MONTH_DAYS_REGULAR_CUMULATIVE","MONTH_DAYS_LEAP_CUMULATIVE","SYSCALLS","getSocketFromFD","getSocketAddress","preloadPlugins","FS_createPreloadedFile","FS_modeStringToFlags","FS_getMode","FS_fileDataToTypedArray","FS_stdin_getChar_buffer","FS_stdin_getChar","FS_readFile","FS_root","FS_mounts","FS_devices","FS_streams","FS_nextInode","FS_nameTable","FS_currentPath","FS_initialized","FS_ignorePermissions","FS_filesystems","FS_syncFSRequests","FS_lookupPath","FS_getPath","FS_hashName","FS_hashAddNode","FS_hashRemoveNode","FS_lookupNode","FS_createNode","FS_destroyNode","FS_isRoot","FS_isMountpoint","FS_isFile","FS_isDir","FS_isLink","FS_isChrdev","FS_isBlkdev","FS_isFIFO","FS_isSocket","FS_flagsToPermissionString","FS_nodePermissions","FS_mayLookup","FS_mayCreate","FS_mayDelete","FS_mayOpen","FS_checkOpExists","FS_nextfd","FS_getStreamChecked","FS_getStream","FS_createStream","FS_closeStream","FS_dupStream","FS_doSetAttr","FS_chrdev_stream_ops","FS_major","FS_minor","FS_makedev","FS_registerDevice","FS_getDevice","FS_getMounts","FS_syncfs","FS_mount","FS_unmount","FS_lookup","FS_mknod","FS_statfs","FS_statfsStream","FS_statfsNode","FS_create","FS_mkdir","FS_mkdev","FS_symlink","FS_rename","FS_rmdir","FS_readdir","FS_readlink","FS_stat","FS_fstat","FS_lstat","FS_doChmod","FS_chmod","FS_lchmod","FS_fchmod","FS_doChown","FS_chown","FS_lchown","FS_fchown","FS_doTruncate","FS_truncate","FS_ftruncate","FS_utime","FS_open","FS_close","FS_isClosed","FS_llseek","FS_read","FS_write","FS_mmap","FS_msync","FS_ioctl","FS_writeFile","FS_cwd","FS_chdir","FS_createDefaultDirectories","FS_createDefaultDevices","FS_createSpecialDirectories","FS_createStandardStreams","FS_staticInit","FS_init","FS_quit","FS_findObject","FS_analyzePath","FS_createFile","FS_forceLoadFile","MEMFS","TTY","PIPEFS","SOCKFS","tempFixedLengthArray","miniTempWebGLFloatBuffers","miniTempWebGLIntBuffers","GL","AL","GLUT","EGL","GLEW","IDBStore","SDL","SDL_gfx","waitAsyncPolyfilled","print","printErr","jstoi_s","PThread","terminateWorker","cleanupThread","registerTLSInit","spawnThread","exitOnMainThread","proxyToMainThread","proxiedJSCallArgs","invokeEntryPoint","checkMailbox","InternalError","BindingError","throwInternalError","throwBindingError","registeredTypes","awaitingDependencies","typeDependencies","tupleRegistrations","structRegistrations","sharedRegisterType","whenDependentTypesAreResolved","getTypeName","getFunctionName","heap32VectorToArray","requireRegisteredType","usesDestructorStack","checkArgCount","getEnumValueType","getRequiredArgCount","createJsInvoker","UnboundTypeError","EmValType","EmValOptionalType","throwUnboundTypeError","ensureOverloadTable","exposePublicSymbol","replacePublicSymbol","embindRepr","registeredInstances","getBasestPointer","getInheritedInstance","registeredPointers","registerType","integerReadValueFromPointer","enumReadValueFromPointer","floatReadValueFromPointer","assertIntegerRange","readPointer","installIndexedIterator","runDestructors","craftInvokerFunction","embind__requireFunction","genericPointerToWireType","constNoSmartPtrRawPointerToWireType","nonConstNoSmartPtrRawPointerToWireType","init_RegisteredPointer","RegisteredPointer","RegisteredPointer_fromWireType","runDestructor","releaseClassHandle","finalizationRegistry","detachFinalizer_deps","detachFinalizer","attachFinalizer","makeClassHandle","init_ClassHandle","ClassHandle","throwInstanceAlreadyDeleted","deletionQueue","flushPendingDeletes","delayFunction","RegisteredClass","shallowCopyInternalPointer","downcastPointer","upcastPointer","validateThis","char_0","char_9","makeLegalFunctionName","emval_freelist","emval_handles","emval_symbols","getStringOrSymbol","Emval","emval_returnValue","emval_lookupTypes","emval_methodCallers","emval_addMethodCaller","NODEFS"];Ao.forEach(pt);var Oo=[$t,It,jt,Xt,Yt,Jt,Zt,Qt,en,rn,an,on,sn,ln,dn,Dn,$n,In,Nn,Mn,Wn,Ln];function Ro(){ge("fetchSettings"),ge("logReadFiles"),ge("loadSplitModule"),ge("onMalloc"),ge("onRealloc"),ge("onFree"),ge("onSbrkGrow")}function Do(){var e,r,t=new Promise(function(n,i){e=n,r=i});return X.toHandle({promise:t,resolve:e,reject:r})}function $o(e,r){X.toValue(e)(X.toValue(r))}function Io(e,r){X.toValue(e)(new Error(le(r)))}function No(e,r,t){var n=(u(),K).subarray(e,e+r*t);return globalThis._e57Finalizer||(globalThis._e57Finalizer=new FinalizationRegistry(function(i){ue(i)})),globalThis._e57Finalizer.register(n,e),X.toHandle(n)}var xn=N("___getTypeName"),Un=N("__embind_initialize_bindings"),Ve=f._malloc=N("_malloc"),ue=f._free=N("_free"),Fe=N("_pthread_self"),jn=N("_strerror"),Mo=N("__emscripten_tls_init"),et=N("__emscripten_thread_init"),Hn=N("___set_thread_state"),Bn=N("__emscripten_thread_crashed"),rt=N("_fflush"),qe=N("_htonl"),br=N("_htons"),tt=N("_emscripten_stack_get_end"),Wo=N("_emscripten_stack_get_base"),nt=N("_ntohs"),zn=N("__emscripten_run_js_on_main_thread_done"),Gn=N("__emscripten_run_js_on_main_thread"),Vn=N("__emscripten_thread_free_data"),it=N("__emscripten_thread_exit"),qn=N("__emscripten_check_mailbox"),Kn=N("_emscripten_stack_init"),Xn=N("_emscripten_stack_set_limits"),Lo=N("_emscripten_stack_get_free"),Yn=N("__emscripten_stack_restore"),Jn=N("__emscripten_stack_alloc"),at=N("_emscripten_stack_get_current"),xo=N("__indirect_function_table"),ot=N("wasmTable");function Uo(e){_(typeof e.__getTypeName<"u","missing Wasm export: __getTypeName"),_(typeof e._embind_initialize_bindings<"u","missing Wasm export: _embind_initialize_bindings"),_(typeof e.malloc<"u","missing Wasm export: malloc"),_(typeof e.free<"u","missing Wasm export: free"),_(typeof e.pthread_self<"u","missing Wasm export: pthread_self"),_(typeof e.strerror<"u","missing Wasm export: strerror"),_(typeof e._emscripten_tls_init<"u","missing Wasm export: _emscripten_tls_init"),_(typeof e._emscripten_thread_init<"u","missing Wasm export: _emscripten_thread_init"),_(typeof e.__set_thread_state<"u","missing Wasm export: __set_thread_state"),_(typeof e._emscripten_thread_crashed<"u","missing Wasm export: _emscripten_thread_crashed"),_(typeof e.fflush<"u","missing Wasm export: fflush"),_(typeof e.htonl<"u","missing Wasm export: htonl"),_(typeof e.htons<"u","missing Wasm export: htons"),_(typeof e.emscripten_stack_get_end<"u","missing Wasm export: emscripten_stack_get_end"),_(typeof e.emscripten_stack_get_base<"u","missing Wasm export: emscripten_stack_get_base"),_(typeof e.ntohs<"u","missing Wasm export: ntohs"),_(typeof e._emscripten_run_js_on_main_thread_done<"u","missing Wasm export: _emscripten_run_js_on_main_thread_done"),_(typeof e._emscripten_run_js_on_main_thread<"u","missing Wasm export: _emscripten_run_js_on_main_thread"),_(typeof e._emscripten_thread_free_data<"u","missing Wasm export: _emscripten_thread_free_data"),_(typeof e._emscripten_thread_exit<"u","missing Wasm export: _emscripten_thread_exit"),_(typeof e._emscripten_check_mailbox<"u","missing Wasm export: _emscripten_check_mailbox"),_(typeof e.emscripten_stack_init<"u","missing Wasm export: emscripten_stack_init"),_(typeof e.emscripten_stack_set_limits<"u","missing Wasm export: emscripten_stack_set_limits"),_(typeof e.emscripten_stack_get_free<"u","missing Wasm export: emscripten_stack_get_free"),_(typeof e._emscripten_stack_restore<"u","missing Wasm export: _emscripten_stack_restore"),_(typeof e._emscripten_stack_alloc<"u","missing Wasm export: _emscripten_stack_alloc"),_(typeof e.emscripten_stack_get_current<"u","missing Wasm export: emscripten_stack_get_current"),_(typeof e.__indirect_function_table<"u","missing Wasm export: __indirect_function_table"),xn=q("__getTypeName",1),Un=q("_embind_initialize_bindings",0),Ve=f._malloc=q("malloc",1),ue=f._free=q("free",1),Fe=e.pthread_self,jn=q("strerror",1),Mo=q("_emscripten_tls_init",0),et=q("_emscripten_thread_init",6),Hn=q("__set_thread_state",4),Bn=q("_emscripten_thread_crashed",0),rt=q("fflush",1),qe=q("htonl",1),br=q("htons",1),tt=e.emscripten_stack_get_end,Wo=e.emscripten_stack_get_base,nt=q("ntohs",1),zn=q("_emscripten_run_js_on_main_thread_done",3),Gn=q("_emscripten_run_js_on_main_thread",5),Vn=q("_emscripten_thread_free_data",1),it=q("_emscripten_thread_exit",1),qn=q("_emscripten_check_mailbox",0),Kn=e.emscripten_stack_init,Xn=e.emscripten_stack_set_limits,Lo=e.emscripten_stack_get_free,Yn=e._emscripten_stack_restore,Jn=e._emscripten_stack_alloc,at=e.emscripten_stack_get_current,xo=ot=e.__indirect_function_table}var st;function jo(){st={__assert_fail:Ci,__cxa_throw:Ri,__pthread_create_js:Ht,__syscall_connect:Xt,__syscall_dup:Yt,__syscall_fcntl64:Jt,__syscall_getcwd:Zt,__syscall_ioctl:Qt,__syscall_openat:en,__syscall_readlinkat:rn,__syscall_recvfrom:an,__syscall_rmdir:on,__syscall_sendto:sn,__syscall_socket:ln,__syscall_unlinkat:dn,_abort_js:Hi,_embind_finalize_value_object:zi,_embind_register_bigint:Vi,_embind_register_bool:qi,_embind_register_class:ua,_embind_register_class_class_function:va,_embind_register_class_constructor:ma,_embind_register_class_function:ha,_embind_register_class_property:pa,_embind_register_emval:ga,_embind_register_enum:wa,_embind_register_enum_value:Ea,_embind_register_float:Sa,_embind_register_function:ka,_embind_register_integer:Ta,_embind_register_iterable:Pa,_embind_register_memory_view:Ca,_embind_register_optional:Oa,_embind_register_std_string:Ra,_embind_register_std_wstring:La,_embind_register_value_object:xa,_embind_register_value_object_field:Ua,_embind_register_void:ja,_emjs_array_view:No,_emjs_call_reject:Io,_emjs_call_resolve:$o,_emjs_make_deferred:Do,_emscripten_init_main_thread_js:Ha,_emscripten_notify_mailbox_postmessage:za,_emscripten_receive_on_main_thread_js:Ga,_emscripten_thread_cleanup:Va,_emscripten_thread_mailbox_await:Jr,_emscripten_thread_set_strongref:qa,_emval_create_invoker:Za,_emval_decref:Xr,_emval_get_property:Qa,_emval_incref:eo,_emval_invoke:An,_emval_invoke_i64:ro,_emval_new_cstring:to,_emval_run_destructors:no,_tzset_js:io,clock_time_get:co,emscripten_check_blocking_allowed:fo,emscripten_err:_o,emscripten_exit_with_live_runtime:mo,emscripten_get_now:On,emscripten_resize_heap:yo,environ_get:Dn,environ_sizes_get:$n,exit:Ir,fd_close:In,fd_read:Nn,fd_seek:Mn,fd_write:Wn,getaddrinfo:Ln,memory:se,random_get:So}}var Zn;function Ho(){_(!w),Kn(),mt()}function Sr(){if(we>0){Ue=Sr;return}if(w){Cr?.(f),Et();return}if(Ho(),vi(),we>0){Ue=Sr;return}function e(){_(!Zn),Zn=!0,f.calledRun=!0,!Ce&&(Et(),Cr?.(f),f.onRuntimeInitialized?.(),er("onRuntimeInitialized"),_(!f._main,'compiled without a main, but one is present. if you added it from JS, use Module["onRuntimeInitialized"]'),mi())}f.setStatus?(f.setStatus("Running..."),setTimeout(()=>{setTimeout(()=>f.setStatus(""),1),e()},1)):e(),xe()}function Bo(){var e=_e,r=A,t=!1;_e=A=d=>{t=!0};try{rt(0);for(var n of["stdout","stderr"]){var i=a.analyzePath("/dev/"+n);if(!i)return;var o=i.object,s=o.rdev,l=ce.ttys[s];l?.output?.length&&(t=!0)}}catch{}_e=e,A=r,t&&Ee("stdio streams had content in them that was not flushed. you should set EXIT_RUNTIME to 1 (see the Emscripten FAQ), or make sure to emit a newline when you printf etc.")}var Pe;w||(Pe=await St(),Sr()),Oe?p=f:p=new Promise((e,r)=>{Cr=e,Ar=r});for(let e of Object.keys(f))e in te||Object.defineProperty(te,e,{configurable:!0,get(){H(`Access to module property ('${e}') is no longer possible via the module constructor argument; Instead, use the result of the module constructor.`)}});return p}var ei=Qn,ri=globalThis.name?.startsWith("em-pthread"),zo=globalThis.process?.versions?.node&&globalThis.process?.type!="renderer";zo&&(ri=(await import("node:worker_threads")).workerData==="em-pthread");ri&&Qn();var Y=class te{static LibE57=null;static RootDir="/root ";static Init(){return te.LibE57!==null?Promise.resolve():ei().then(function(p){p.FS.mkdir(te.RootDir),p.FS.mount(p.FS.filesystems.NODEFS,{root:"/"},te.RootDir),te.LibE57=p})}};import lt from"path";import Go from"fs";var dt=class{constructor(p,f){this.e57Reader=p,this.scanIdx=f}GetHeader(){return this.e57Reader.GetData3DHeader(this.scanIdx)}ReadScan(p=!0){var f=this.GetHeader(),M=f.pointCount;return this.ReadPoints(M,p)}ReadScanSync(p=!0){let f=Number(this.GetHeader().pointCount);return this.ReadPointsSync(f,p)}ReadPoints(p,f=!0){return this.e57Reader.ReadScan(this.scanIdx,p,f)}ReadPointsSync(p,f=!0){return this.e57Reader.ReadScanSync(this.scanIdx,p,f)}ScanPoints(p,f,M=!0){let L=Number(this.GetHeader().pointCount),C=Math.ceil(L/p);if(f){for(let w=0;w<C;w++)f(this.ReadPointsSync(p,M));return}let fe=[];for(let w=0;w<C;w++)fe.push(this.ReadPointsSync(p,M));return fe}},ut=class{constructor(p,f){this._e57Reader=p,this._imageIdx=f}GetHeader(){return this._e57Reader.GetImage2DHeader(this._imageIdx)}ReadImage(){return this._e57Reader.ReadImage(this._imageIdx)}ReadImageSync(){return this._e57Reader.ReadImageSync(this._imageIdx)}ToBase64(){return this.ReadImage().then(p=>Buffer.from(p).toString("base64"))}Extension(){switch(this.GetHeader().imageType){case Y.LibE57.Image2DType.ImageJPEG:return".jpeg";case Y.LibE57.Image2DType.ImagePNG:return".png";case Y.LibE57.Image2DType.ImageMaskPNG:return".png";case Y.LibE57.Image2DType.E57_JPEG_IMAGE:return".jpeg";case Y.LibE57.Image2DType.E57_PNG_IMAGE:return".png";case Y.LibE57.Image2DType.E57_PNG_IMAGE_MASK:return".png";default:return".jpg"}}Save(p){let f=this.Extension(),M=p.replace(lt.extname(p),f);return this.ReadImage().then(L=>Go.writeFile(M,L,C=>{if(C)throw C}))}},ti=class{constructor(p){let f=lt.resolve(p),M=lt.join(Y.RootDir,f);this.reader=new Y.LibE57.E57Reader(M);var L=this.GetData3DCount();this.scans=new Array(L);for(var C=0;C<L;C++)this.scans[C]=new dt(this.reader,C);var fe=this.GetImage2DCount();this.images=new Array(fe);for(var w=0;w<fe;w++)this.images[w]=new ut(this.reader,w)}GetHeader(){return this.reader.GetHeader()}GetData3DCount(){return Number(this.reader.GetData3DCount())}GetImage2DCount(){return Number(this.reader.GetImage2DCount())}GetScan(p){return this.scans[p]}GetImage(p){return this.images[p]}};import ni from"path";import oi from"fs";import Xe from"sharp";var ii=class{constructor(p,f,M){this._imgPath=p,this._imgType=f,this._imgProjection=M,this._imageHeader=new Y.LibE57.ImageHeader}getPath(){return this._imgPath}setPath(p){this._imgPath=p}getType(){return this._imgType}setType(p){this._imgType=p}getProjection(){return this._imgProjection}setProjection(p){this._imgProjection=p}getMetadata(){return Xe(this._imgPath).metadata()}async getDimensions(){let p=await Xe(this._imgPath).metadata();return[p.width,p.height]}async getWidth(){return(await Xe(this._imgPath).metadata()).width}async getHeight(){return(await Xe(this._imgPath).metadata()).height}getPose(){return this._imageHeader.pose}setPose(p){this._imageHeader.pose=p}getName(){return this._imageHeader.name}setName(p){this._imageHeader.name=p}getGuid(){return this._imageHeader.guid}setGuid(p){this._imageHeader.guid=p}getHeader(){return this._imageHeader}setHeader(p){this._imageHeader=p}async getBuffer(){let p=await oi.promises.readFile(this.getPath());return new Uint8Array(p)}setTrasnlation(p,f,M){this._imageHeader.pose.translation.x=p,this._imageHeader.pose.translation.y=f,this._imageHeader.pose.translation.z=M}setRotation(p,f,M,L){this._imageHeader.pose.rotation.w=p,this._imageHeader.pose.rotation.x=f,this._imageHeader.pose.rotation.y=M,this._imageHeader.pose.rotation.z=L}},ai=class{constructor(p){let f=ni.resolve(p),M=ni.join(Y.RootDir,f);this.writer=new Y.LibE57.E57Writer(M)}AddImageSync(p,f,M){let L=oi.readFileSync(p.getPath()),C=new Uint8Array(L);return Number(this.writer.AddImageSync(p.getHeader(),p.getType(),p.getProjection(),0,C,C.length,f,M))}async AddImage(p){let[f,M]=await Promise.all([p.getBuffer(),Xe(p.getPath()).metadata()]),L=new Uint8Array(f);return this.writer.AddImage(p.getHeader(),p.getType(),p.getProjection(),0,L,L.length,M.width,M.height).then(Number)}AddScanSync(p,f){return Number(this.writer.AddScanSync(p,f))}AddScan(p,f){return this.writer.AddScan(p,f).then(Number)}Close(){this.writer.Close()}};export{Y as E57,ti as E57Reader,ut as E57ReaderImage,dt as E57ReaderScan,ai as E57Writer,ii as E57WriterImage};
21
+ }`;var h=new Function(Object.keys(c),v)(...Object.values(c)),p=`methodCaller<(${a.map(g=>g.name)}) => ${i.name}>`;return ao(wr(p,h))},uo=(e,r)=>(e=ee.toValue(e),r=ee.toValue(r),ee.toHandle(e[r])),fo=e=>{e>9&&(de[e+1]+=1)},Mn=(e,r,t,n,i)=>at[e](r,t,n,i),_o=(e,r,t,n,i)=>Mn(e,r,t,n,i),vo=e=>ee.toHandle(Nn(e)),ho=e=>{var r=ee.toValue(e);vr(r),tt(e)},po=(e,r,t,n)=>{var i=new Date().getFullYear(),a=new Date(i,0,1),s=new Date(i,6,1),l=a.getTimezoneOffset(),c=s.getTimezoneOffset(),u=Math.max(l,c);(d(),y)[e>>2]=u*60,(d(),S)[r>>2]=+(l!=c);var v=g=>{var E=g>=0?"-":"+",k=Math.abs(g),R=String(Math.floor(k/60)).padStart(2,"0"),D=String(k%60).padStart(2,"0");return`UTC${E}${R}${D}`},h=v(l),p=v(c);_(h),_(p),_(Pe(h)<=16,`timezone name truncated to fit in TZNAME_MAX (${h})`),_(Pe(p)<=16,`timezone name truncated to fit in TZNAME_MAX (${p})`),c<l?(Ee(h,t,17),Ee(p,n,17)):(Ee(h,n,17),Ee(p,t,17))},xn=()=>performance.timeOrigin+performance.now(),mo=()=>Date.now(),go=1,yo=e=>e>=0&&e<=3,wo=9007199254740992,Eo=-9007199254740992,Wn=e=>e<Eo||e>wo?NaN:Number(e);function bo(e,r,t){if(r=Wn(r),!yo(e))return 28;var n;if(e===0)n=mo();else if(go)n=xn();else return 52;var i=Math.round(n*1e3*1e3);return(d(),Z)[t>>3]=BigInt(i),0}var So=()=>{C||B||Fe("Blocking on the main thread is very dangerous, see https://emscripten.org/docs/porting/pthreads.html#blocking-on-the-main-browser-thread")},ko=e=>A(_e(e)),To=()=>{lr+=1},Fo=()=>{throw To(),"unwind"},Po=()=>2147483648,Co=(e,r)=>(_(r,"alignment argument is required"),Math.ceil(e/r)*r),Ao=e=>{var r=fe.buffer.byteLength,t=(e-r+65535)/65536|0;try{return fe.grow(t),or(),1}catch(n){A(`growMemory: Attempted to grow heap from ${r} bytes to ${e} bytes, but got error: ${n}`)}},Oo=e=>{var r=(d(),Q).length;if(e>>>=0,e<=r)return!1;var t=Po();if(e>t)return A(`Cannot enlarge memory, requested ${e} bytes, but the limit is ${t} bytes!`),!1;for(var n=1;n<=4;n*=2){var i=r*(1+.2/n);i=Math.min(i,e+100663296);var a=Math.min(t,Co(Math.max(e,i),65536)),s=Ao(a);if(s)return!0}return A(`Failed to grow the heap from ${r} bytes to ${a} bytes, not enough memory!`),!1},ot={},Ro=()=>Ar||"./this.program",Ye=()=>{if(!Ye.strings){var e=(globalThis.navigator?.language??"C").replace("-","_")+".UTF-8",r={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:e,_:Ro()};for(var t in ot)ot[t]===void 0?delete r[t]:r[t]=ot[t];var n=[];for(var t in r)n.push(`${t}=${r[t]}`);Ye.strings=n}return Ye.strings};function Ln(e,r){if(w)return K(15,0,1,e,r);var t=0,n=0;for(var i of Ye()){var a=r+t;(d(),y)[e+n>>2]=a,t+=Ee(i,a,1/0)+1,n+=4}return 0}function Un(e,r){if(w)return K(16,0,1,e,r);var t=Ye();(d(),y)[e>>2]=t.length;var n=0;for(var i of t)n+=Pe(i)+1;return(d(),y)[r>>2]=n,0}function jn(e){if(w)return K(17,0,1,e);try{var r=X.getStreamFromFD(e);return o.close(r),0}catch(t){if(typeof o>"u"||t.name!=="ErrnoError")throw t;return t.errno}}var Do=(e,r,t,n)=>{for(var i=0,a=0;a<t;a++){var s=(d(),y)[r>>2],l=(d(),y)[r+4>>2];r+=8;var c=o.read(e,(d(),H),s,l,n);if(c<0)return-1;if(i+=c,c<l)break;typeof n<"u"&&(n+=c)}return i};function Hn(e,r,t,n){if(w)return K(18,0,1,e,r,t,n);try{var i=X.getStreamFromFD(e),a=Do(i,r,t);return(d(),y)[n>>2]=a,0}catch(s){if(typeof o>"u"||s.name!=="ErrnoError")throw s;return s.errno}}function Bn(e,r,t,n){if(w)return K(19,0,1,e,r,t,n);r=Wn(r);try{if(isNaN(r))return 22;var i=X.getStreamFromFD(e);return o.llseek(i,r,t),(d(),Z)[n>>3]=BigInt(i.position),i.getdents&&r===0&&t===0&&(i.getdents=null),0}catch(a){if(typeof o>"u"||a.name!=="ErrnoError")throw a;return a.errno}}var Io=(e,r,t,n)=>{for(var i=0,a=0;a<t;a++){var s=(d(),y)[r>>2],l=(d(),y)[r+4>>2];r+=8;var c=o.write(e,(d(),H),s,l,n);if(c<0)return-1;if(i+=c,c<l)break;typeof n<"u"&&(n+=c)}return i};function zn(e,r,t,n){if(w)return K(20,0,1,e,r,t,n);try{var i=X.getStreamFromFD(e),a=Io(i,r,t);return(d(),y)[n>>2]=a,0}catch(s){if(typeof o>"u"||s.name!=="ErrnoError")throw s;return s.errno}}function Gn(e,r,t,n){if(w)return K(21,0,1,e,r,t,n);var i=[],a=null,s=0,l=0,c=0,u=0,v=0,h=0,p,g;function E(k,R,D,z,G,ae){var le,V,oe,Qe;return V=k===10?28:16,G=k===10?en(G):Yr(G),le=Je(V),Qe=un(le,k,G,ae),_(!Qe),oe=Je(32),(d(),S)[oe+4>>2]=k,(d(),S)[oe+8>>2]=R,(d(),S)[oe+12>>2]=D,(d(),y)[oe+24>>2]=z,(d(),y)[oe+20>>2]=le,k===10?(d(),S)[oe+16>>2]=28:(d(),S)[oe+16>>2]=16,(d(),S)[oe+28>>2]=0,oe}if(t&&(c=(d(),S)[t>>2],u=(d(),S)[t+4>>2],v=(d(),S)[t+8>>2],h=(d(),S)[t+12>>2]),v&&!h&&(h=v===2?17:6),!v&&h&&(v=h===17?2:1),h===0&&(h=6),v===0&&(v=1),!e&&!r)return-2;if(c&-1088||t!==0&&(d(),S)[t>>2]&2&&!e)return-1;if(c&32)return-2;if(v!==0&&v!==1&&v!==2)return-7;if(u!==0&&u!==2&&u!==10)return-6;if(r&&(r=_e(r),l=parseInt(r,10),isNaN(l)))return c&1024?-2:-8;if(!e)return u===0&&(u=2),(c&1)===0&&(u===2?s=Ze(2130706433):s=[0,0,0,Ze(1)]),p=E(u,v,h,null,s,l),(d(),y)[n>>2]=p,0;if(e=_e(e),s=ur(e),s!==null)if(u===0||u===2)u=2;else if(u===10&&c&8)s=[0,0,Ze(65535),s],u=10;else return-2;else if(s=Jr(e),s!==null)if(u===0||u===10)u=10;else return-2;return s!=null?(p=E(u,v,h,e,s,l),(d(),y)[n>>2]=p,0):c&4?-2:(e=ve.lookup_name(e),s=ur(e),u===0?u=2:u===10&&(s=[0,0,Ze(65535),s]),p=E(u,v,h,null,s,l),(d(),y)[n>>2]=p,0)}var $o=e=>e,No=(e,r)=>Br((d(),Q).subarray(e,e+r)),Mo=(...e)=>o.createPath(...e),xo=(...e)=>o.unlink(...e),Wo=(...e)=>o.createLazyFile(...e),Lo=(...e)=>o.createDevice(...e);P.init(),o.createPreloadedFile=Ji,o.preloadFile=Kr,o.staticInit(),C&&b.staticInit(),ua(),ya(),_(de.length===10);{if(Ei(),f.noExitRuntime&&(Ur=f.noExitRuntime),f.preloadPlugins&&(Qt=f.preloadPlugins),f.print&&(ge=f.print),f.printErr&&(A=f.printErr),f.wasmBinary&&(Be=f.wasmBinary),Bo(),f.arguments&&(gt=f.arguments),f.thisProgram&&(Ar=f.thisProgram),_(typeof f.memoryInitializerPrefixURL>"u","Module.memoryInitializerPrefixURL option was removed, use Module.locateFile instead"),_(typeof f.pthreadMainPrefixURL>"u","Module.pthreadMainPrefixURL option was removed, use Module.locateFile instead"),_(typeof f.cdInitializerPrefixURL>"u","Module.cdInitializerPrefixURL option was removed, use Module.locateFile instead"),_(typeof f.filePackagePrefixURL>"u","Module.filePackagePrefixURL option was removed, use Module.locateFile instead"),_(typeof f.read>"u","Module.read option was removed"),_(typeof f.readAsync>"u","Module.readAsync option was removed (modify readAsync in JS)"),_(typeof f.readBinary>"u","Module.readBinary option was removed (modify readBinary in JS)"),_(typeof f.setWindowTitle>"u","Module.setWindowTitle option was removed (modify emscripten_set_window_title in JS)"),_(typeof f.TOTAL_MEMORY>"u","Module.TOTAL_MEMORY has been renamed Module.INITIAL_MEMORY"),_(typeof f.ENVIRONMENT>"u","Module.ENVIRONMENT has been deprecated. To force the environment, use the ENVIRONMENT compile-time option (for example, -sENVIRONMENT=web or -sENVIRONMENT=node)"),_(typeof f.STACK_SIZE>"u","STACK_SIZE can no longer be set at runtime. Use -sSTACK_SIZE at link time"),f.preInit)for(typeof f.preInit=="function"&&(f.preInit=[f.preInit]);f.preInit.length>0;)f.preInit.shift()();ar("preInit")}f.addRunDependency=Wr,f.removeRunDependency=xr,f.FS_preloadFile=Kr,f.FS_unlink=xo,f.FS_createPath=Mo,f.FS_createDevice=Lo,f.FS=o,f.FS_createDataFile=Zt,f.FS_createLazyFile=Wo;var Uo=["writeI53ToI64","writeI53ToI64Clamped","writeI53ToI64Signaling","writeI53ToU64Clamped","writeI53ToU64Signaling","readI53FromI64","readI53FromU64","convertI32PairToI53","convertI32PairToI53Checked","convertU32PairToI53","getTempRet0","setTempRet0","withStackSave","readEmAsmArgs","jstoi_q","autoResumeAudioContext","getDynCaller","dynCall","runtimeKeepalivePop","asmjsMangle","HandleAllocator","addOnInit","addOnPostCtor","addOnPreMain","addOnExit","STACK_SIZE","STACK_ALIGN","POINTER_SIZE","ASSERTIONS","ccall","cwrap","convertJsFunctionToWasm","getEmptyTableSlot","updateTableMap","getFunctionAddress","addFunction","removeFunction","intArrayToString","stringToAscii","stringToNewUTF8","stringToUTF8OnStack","writeArrayToMemory","registerKeyEventCallback","maybeCStringToJsString","findEventTarget","getBoundingClientRect","fillMouseEventData","registerMouseEventCallback","registerWheelEventCallback","registerUiEventCallback","registerFocusEventCallback","fillDeviceOrientationEventData","registerDeviceOrientationEventCallback","fillDeviceMotionEventData","registerDeviceMotionEventCallback","screenOrientation","fillOrientationChangeEventData","registerOrientationChangeEventCallback","fillFullscreenChangeEventData","registerFullscreenChangeEventCallback","JSEvents_requestFullscreen","JSEvents_resizeCanvasForFullscreen","registerRestoreOldStyle","hideEverythingExceptGivenElement","restoreHiddenElements","setLetterbox","softFullscreenResizeWebGLRenderTarget","doRequestFullscreen","fillPointerlockChangeEventData","registerPointerlockChangeEventCallback","registerPointerlockErrorEventCallback","requestPointerLock","fillVisibilityChangeEventData","registerVisibilityChangeEventCallback","registerTouchEventCallback","fillGamepadEventData","registerGamepadEventCallback","registerBeforeUnloadEventCallback","fillBatteryEventData","registerBatteryEventCallback","setCanvasElementSizeCallingThread","setCanvasElementSizeMainThread","setCanvasElementSize","getCanvasSizeCallingThread","getCanvasSizeMainThread","getCanvasElementSize","jsStackTrace","getCallstack","convertPCtoSourceLocation","wasiRightsToMuslOFlags","wasiOFlagsToMuslOFlags","safeSetTimeout","setImmediateWrapped","safeRequestAnimationFrame","clearImmediateWrapped","registerPostMainLoop","registerPreMainLoop","getPromise","makePromise","idsToPromises","makePromiseCallback","incrementUncaughtExceptionCount","decrementUncaughtExceptionCount","Browser_asyncPrepareDataCounter","isLeapYear","ydayFromDate","arraySum","addDays","FS_mkdirTree","_setNetworkCallback","heapObjectForWebGLType","toTypedArrayIndex","webgl_enable_ANGLE_instanced_arrays","webgl_enable_OES_vertex_array_object","webgl_enable_WEBGL_draw_buffers","webgl_enable_WEBGL_multi_draw","webgl_enable_EXT_polygon_offset_clamp","webgl_enable_EXT_clip_control","webgl_enable_WEBGL_polygon_mode","emscriptenWebGLGet","computeUnpackAlignedImageSize","colorChannelsInGlTextureFormat","emscriptenWebGLGetTexPixelData","emscriptenWebGLGetUniform","webglGetUniformLocation","webglPrepareUniformLocationsBeforeFirstUse","webglGetLeftBracePos","emscriptenWebGLGetVertexAttrib","__glGetActiveAttribOrUniform","writeGLArray","emscripten_webgl_destroy_context_before_on_calling_thread","registerWebGlEventCallback","runAndAbortIfError","ALLOC_NORMAL","ALLOC_STACK","allocate","writeStringToMemory","writeAsciiToMemory","allocateUTF8","allocateUTF8OnStack","demangle","stackTrace","getNativeTypeSize","getFunctionArgsName","createJsInvokerSignature","PureVirtualError","registerInheritedInstance","unregisterInheritedInstance","getInheritedInstanceCount","getLiveInheritedInstances","setDelayFunction","count_emval_handles"];Uo.forEach(yi);var jo=["run","out","err","callMain","abort","wasmExports","writeStackCookie","checkStackCookie","INT53_MAX","INT53_MIN","bigintToI53Checked","HEAP8","HEAP16","HEAPU16","HEAP32","HEAPU32","HEAPF32","HEAPF64","HEAP64","HEAPU64","stackSave","stackRestore","stackAlloc","createNamedFunction","ptrToString","zeroMemory","exitJS","getHeapMax","growMemory","ENV","ERRNO_CODES","strError","inetPton4","inetNtop4","inetPton6","inetNtop6","readSockaddr","writeSockaddr","DNS","Protocols","Sockets","timers","warnOnce","readEmAsmArgsArray","getExecutableName","handleException","keepRuntimeAlive","runtimeKeepalivePush","callUserCallback","maybeExit","asyncLoad","alignMemory","mmapAlloc","wasmTable","wasmMemory","getUniqueRunDependency","noExitRuntime","addOnPreRun","addOnPostRun","freeTableIndexes","functionsInTableMap","setValue","getValue","PATH","PATH_FS","UTF8Decoder","UTF8ArrayToString","UTF8ToString","stringToUTF8Array","stringToUTF8","lengthBytesUTF8","intArrayFromString","AsciiToString","UTF16Decoder","UTF16ToString","stringToUTF16","lengthBytesUTF16","UTF32ToString","stringToUTF32","lengthBytesUTF32","JSEvents","specialHTMLTargets","findCanvasEventTarget","currentFullscreenStrategy","restoreOldWindowedStyle","UNWIND_CACHE","ExitStatus","getEnvStrings","checkWasiClock","doReadv","doWritev","initRandomFill","randomFill","emSetImmediate","emClearImmediate_deps","emClearImmediate","promiseMap","uncaughtExceptionCount","exceptionCaught","ExceptionInfo","findMatchingCatch","Browser","requestFullscreen","requestFullScreen","setCanvasSize","getUserMedia","createContext","getPreloadedImageData__data","wget","MONTH_DAYS_REGULAR","MONTH_DAYS_LEAP","MONTH_DAYS_REGULAR_CUMULATIVE","MONTH_DAYS_LEAP_CUMULATIVE","SYSCALLS","getSocketFromFD","getSocketAddress","preloadPlugins","FS_createPreloadedFile","FS_modeStringToFlags","FS_getMode","FS_fileDataToTypedArray","FS_stdin_getChar_buffer","FS_stdin_getChar","FS_readFile","FS_root","FS_mounts","FS_devices","FS_streams","FS_nextInode","FS_nameTable","FS_currentPath","FS_initialized","FS_ignorePermissions","FS_filesystems","FS_syncFSRequests","FS_lookupPath","FS_getPath","FS_hashName","FS_hashAddNode","FS_hashRemoveNode","FS_lookupNode","FS_createNode","FS_destroyNode","FS_isRoot","FS_isMountpoint","FS_isFile","FS_isDir","FS_isLink","FS_isChrdev","FS_isBlkdev","FS_isFIFO","FS_isSocket","FS_flagsToPermissionString","FS_nodePermissions","FS_mayLookup","FS_mayCreate","FS_mayDelete","FS_mayOpen","FS_checkOpExists","FS_nextfd","FS_getStreamChecked","FS_getStream","FS_createStream","FS_closeStream","FS_dupStream","FS_doSetAttr","FS_chrdev_stream_ops","FS_major","FS_minor","FS_makedev","FS_registerDevice","FS_getDevice","FS_getMounts","FS_syncfs","FS_mount","FS_unmount","FS_lookup","FS_mknod","FS_statfs","FS_statfsStream","FS_statfsNode","FS_create","FS_mkdir","FS_mkdev","FS_symlink","FS_rename","FS_rmdir","FS_readdir","FS_readlink","FS_stat","FS_fstat","FS_lstat","FS_doChmod","FS_chmod","FS_lchmod","FS_fchmod","FS_doChown","FS_chown","FS_lchown","FS_fchown","FS_doTruncate","FS_truncate","FS_ftruncate","FS_utime","FS_open","FS_close","FS_isClosed","FS_llseek","FS_read","FS_write","FS_mmap","FS_msync","FS_ioctl","FS_writeFile","FS_cwd","FS_chdir","FS_createDefaultDirectories","FS_createDefaultDevices","FS_createSpecialDirectories","FS_createStandardStreams","FS_staticInit","FS_init","FS_quit","FS_findObject","FS_analyzePath","FS_createFile","FS_forceLoadFile","MEMFS","TTY","PIPEFS","SOCKFS","tempFixedLengthArray","miniTempWebGLFloatBuffers","miniTempWebGLIntBuffers","GL","AL","GLUT","EGL","GLEW","IDBStore","SDL","SDL_gfx","waitAsyncPolyfilled","print","printErr","jstoi_s","PThread","terminateWorker","cleanupThread","registerTLSInit","spawnThread","exitOnMainThread","proxyToMainThread","proxiedJSCallArgs","invokeEntryPoint","checkMailbox","InternalError","BindingError","throwInternalError","throwBindingError","registeredTypes","awaitingDependencies","typeDependencies","tupleRegistrations","structRegistrations","sharedRegisterType","whenDependentTypesAreResolved","getTypeName","getFunctionName","heap32VectorToArray","requireRegisteredType","usesDestructorStack","checkArgCount","getEnumValueType","getRequiredArgCount","createJsInvoker","UnboundTypeError","EmValType","EmValOptionalType","throwUnboundTypeError","ensureOverloadTable","exposePublicSymbol","replacePublicSymbol","embindRepr","registeredInstances","getBasestPointer","getInheritedInstance","registeredPointers","registerType","integerReadValueFromPointer","enumReadValueFromPointer","floatReadValueFromPointer","assertIntegerRange","readPointer","installIndexedIterator","runDestructors","craftInvokerFunction","embind__requireFunction","genericPointerToWireType","constNoSmartPtrRawPointerToWireType","nonConstNoSmartPtrRawPointerToWireType","init_RegisteredPointer","RegisteredPointer","RegisteredPointer_fromWireType","runDestructor","releaseClassHandle","finalizationRegistry","detachFinalizer_deps","detachFinalizer","attachFinalizer","makeClassHandle","init_ClassHandle","ClassHandle","throwInstanceAlreadyDeleted","deletionQueue","flushPendingDeletes","delayFunction","RegisteredClass","shallowCopyInternalPointer","downcastPointer","upcastPointer","validateThis","char_0","char_9","makeLegalFunctionName","emval_freelist","emval_handles","emval_symbols","getStringOrSymbol","Emval","emval_returnValue","emval_lookupTypes","emval_methodCallers","emval_addMethodCaller","NODEFS"];jo.forEach(kt);var Ho=[Lt,Ut,Kt,tn,nn,an,on,sn,ln,cn,fn,_n,vn,hn,pn,Ln,Un,jn,Hn,Bn,zn,Gn];function Bo(){Se("fetchSettings"),Se("logReadFiles"),Se("loadSplitModule"),Se("onMalloc"),Se("onRealloc"),Se("onFree"),Se("onSbrkGrow")}function zo(){var e,r,t=new Promise(function(n,i){e=n,r=i});return ee.toHandle({promise:t,resolve:e,reject:r})}function Go(e,r){ee.toValue(e)(ee.toValue(r))}function Vo(e,r){ee.toValue(e)(new Error(_e(r)))}function qo(e,r,t){var n=(d(),Q).subarray(e,e+r*t);return globalThis._e57Finalizer||(globalThis._e57Finalizer=new FinalizationRegistry(function(i){he(i)})),globalThis._e57Finalizer.register(n,e),ee.toHandle(n)}var Vn=$("___getTypeName"),qn=$("__embind_initialize_bindings"),Je=f._malloc=$("_malloc"),he=f._free=$("_free"),Re=$("_pthread_self"),Kn=$("_strerror"),Ko=$("__emscripten_tls_init"),st=$("__emscripten_thread_init"),Xn=$("___set_thread_state"),Yn=$("__emscripten_thread_crashed"),lt=$("_fflush"),Ze=$("_htonl"),Pr=$("_htons"),ct=$("_emscripten_stack_get_end"),Xo=$("_emscripten_stack_get_base"),dt=$("_ntohs"),Jn=$("__emscripten_run_js_on_main_thread_done"),Zn=$("__emscripten_run_js_on_main_thread"),Qn=$("__emscripten_thread_free_data"),ut=$("__emscripten_thread_exit"),ei=$("__emscripten_check_mailbox"),W=$("_setThrew"),ri=$("_emscripten_stack_init"),ti=$("_emscripten_stack_set_limits"),Yo=$("_emscripten_stack_get_free"),ni=$("__emscripten_stack_restore"),ii=$("__emscripten_stack_alloc"),ft=$("_emscripten_stack_get_current"),ai=$("___cxa_decrement_exception_refcount"),oi=$("___cxa_get_exception_ptr"),Jo=$("__indirect_function_table"),_t=$("wasmTable");function Zo(e){_(typeof e.__getTypeName<"u","missing Wasm export: __getTypeName"),_(typeof e._embind_initialize_bindings<"u","missing Wasm export: _embind_initialize_bindings"),_(typeof e.malloc<"u","missing Wasm export: malloc"),_(typeof e.free<"u","missing Wasm export: free"),_(typeof e.pthread_self<"u","missing Wasm export: pthread_self"),_(typeof e.strerror<"u","missing Wasm export: strerror"),_(typeof e._emscripten_tls_init<"u","missing Wasm export: _emscripten_tls_init"),_(typeof e._emscripten_thread_init<"u","missing Wasm export: _emscripten_thread_init"),_(typeof e.__set_thread_state<"u","missing Wasm export: __set_thread_state"),_(typeof e._emscripten_thread_crashed<"u","missing Wasm export: _emscripten_thread_crashed"),_(typeof e.fflush<"u","missing Wasm export: fflush"),_(typeof e.htonl<"u","missing Wasm export: htonl"),_(typeof e.htons<"u","missing Wasm export: htons"),_(typeof e.emscripten_stack_get_end<"u","missing Wasm export: emscripten_stack_get_end"),_(typeof e.emscripten_stack_get_base<"u","missing Wasm export: emscripten_stack_get_base"),_(typeof e.ntohs<"u","missing Wasm export: ntohs"),_(typeof e._emscripten_run_js_on_main_thread_done<"u","missing Wasm export: _emscripten_run_js_on_main_thread_done"),_(typeof e._emscripten_run_js_on_main_thread<"u","missing Wasm export: _emscripten_run_js_on_main_thread"),_(typeof e._emscripten_thread_free_data<"u","missing Wasm export: _emscripten_thread_free_data"),_(typeof e._emscripten_thread_exit<"u","missing Wasm export: _emscripten_thread_exit"),_(typeof e._emscripten_check_mailbox<"u","missing Wasm export: _emscripten_check_mailbox"),_(typeof e.setThrew<"u","missing Wasm export: setThrew"),_(typeof e.emscripten_stack_init<"u","missing Wasm export: emscripten_stack_init"),_(typeof e.emscripten_stack_set_limits<"u","missing Wasm export: emscripten_stack_set_limits"),_(typeof e.emscripten_stack_get_free<"u","missing Wasm export: emscripten_stack_get_free"),_(typeof e._emscripten_stack_restore<"u","missing Wasm export: _emscripten_stack_restore"),_(typeof e._emscripten_stack_alloc<"u","missing Wasm export: _emscripten_stack_alloc"),_(typeof e.emscripten_stack_get_current<"u","missing Wasm export: emscripten_stack_get_current"),_(typeof e.__cxa_decrement_exception_refcount<"u","missing Wasm export: __cxa_decrement_exception_refcount"),_(typeof e.__cxa_get_exception_ptr<"u","missing Wasm export: __cxa_get_exception_ptr"),_(typeof e.__indirect_function_table<"u","missing Wasm export: __indirect_function_table"),Vn=J("__getTypeName",1),qn=J("_embind_initialize_bindings",0),Je=f._malloc=J("malloc",1),he=f._free=J("free",1),Re=e.pthread_self,Kn=J("strerror",1),Ko=J("_emscripten_tls_init",0),st=J("_emscripten_thread_init",6),Xn=J("__set_thread_state",4),Yn=J("_emscripten_thread_crashed",0),lt=J("fflush",1),Ze=J("htonl",1),Pr=J("htons",1),ct=e.emscripten_stack_get_end,Xo=e.emscripten_stack_get_base,dt=J("ntohs",1),Jn=J("_emscripten_run_js_on_main_thread_done",3),Zn=J("_emscripten_run_js_on_main_thread",5),Qn=J("_emscripten_thread_free_data",1),ut=J("_emscripten_thread_exit",1),ei=J("_emscripten_check_mailbox",0),W=J("setThrew",2),ri=e.emscripten_stack_init,ti=e.emscripten_stack_set_limits,Yo=e.emscripten_stack_get_free,ni=e._emscripten_stack_restore,ii=e._emscripten_stack_alloc,ft=e.emscripten_stack_get_current,ai=J("__cxa_decrement_exception_refcount",1),oi=J("__cxa_get_exception_ptr",1),Jo=_t=e.__indirect_function_table}var vt;function Qo(){vt={__assert_fail:Ni,__cxa_begin_catch:Mi,__cxa_end_catch:xi,__cxa_find_matching_catch_2:Wi,__cxa_find_matching_catch_3:Li,__cxa_find_matching_catch_4:Ui,__cxa_throw:ji,__pthread_create_js:Xt,__resumeException:Bi,__syscall_connect:tn,__syscall_dup:nn,__syscall_fcntl64:an,__syscall_getcwd:on,__syscall_ioctl:sn,__syscall_openat:ln,__syscall_readlinkat:cn,__syscall_recvfrom:fn,__syscall_rmdir:_n,__syscall_sendto:vn,__syscall_socket:hn,__syscall_unlinkat:pn,_abort_js:Qi,_embind_finalize_value_object:ra,_embind_register_bigint:na,_embind_register_bool:ia,_embind_register_class:Ea,_embind_register_class_class_function:Ta,_embind_register_class_constructor:Fa,_embind_register_class_function:Pa,_embind_register_class_property:Ca,_embind_register_emval:Aa,_embind_register_enum:Ra,_embind_register_enum_value:Da,_embind_register_float:$a,_embind_register_function:Na,_embind_register_integer:Ma,_embind_register_iterable:Wa,_embind_register_memory_view:La,_embind_register_optional:ja,_embind_register_std_string:Ha,_embind_register_std_wstring:Xa,_embind_register_value_object:Ya,_embind_register_value_object_field:Ja,_embind_register_void:Za,_emjs_array_view:qo,_emjs_call_reject:Vo,_emjs_call_resolve:Go,_emjs_make_deferred:zo,_emscripten_init_main_thread_js:Qa,_emscripten_notify_mailbox_postmessage:ro,_emscripten_receive_on_main_thread_js:to,_emscripten_thread_cleanup:no,_emscripten_thread_mailbox_await:it,_emscripten_thread_set_strongref:io,_emval_create_invoker:co,_emval_decref:tt,_emval_get_property:uo,_emval_incref:fo,_emval_invoke:Mn,_emval_invoke_i64:_o,_emval_new_cstring:vo,_emval_run_destructors:ho,_tzset_js:po,clock_time_get:bo,emscripten_check_blocking_allowed:So,emscripten_err:ko,emscripten_exit_with_live_runtime:Fo,emscripten_get_now:xn,emscripten_resize_heap:Oo,environ_get:Ln,environ_sizes_get:Un,exit:Lr,fd_close:jn,fd_read:Hn,fd_seek:Bn,fd_write:zn,getaddrinfo:Gn,invoke_i:gs,invoke_ii:es,invoke_iii:rs,invoke_iiii:_s,invoke_iiiii:ms,invoke_iiij:cs,invoke_iiijjj:Ts,invoke_iij:os,invoke_iiji:ns,invoke_iijiiiiiii:as,invoke_ji:Es,invoke_jiii:Ss,invoke_jiiiijijii:Fs,invoke_v:ys,invoke_vi:ds,invoke_vii:ls,invoke_viii:ts,invoke_viiii:ps,invoke_viiiii:hs,invoke_viiiiii:ks,invoke_viiiiijijii:Ps,invoke_viiiijijii:ws,invoke_viij:bs,invoke_viijii:us,invoke_vij:is,invoke_viji:vs,invoke_vijj:ss,invoke_vijjii:fs,llvm_eh_typeid_for:$o,memory:fe,random_get:No}}function es(e,r){var t=U();try{return x(e)(r)}catch(n){if(M(t),!(n instanceof L))throw n;W(1,0)}}function rs(e,r,t){var n=U();try{return x(e)(r,t)}catch(i){if(M(n),!(i instanceof L))throw i;W(1,0)}}function ts(e,r,t,n){var i=U();try{x(e)(r,t,n)}catch(a){if(M(i),!(a instanceof L))throw a;W(1,0)}}function ns(e,r,t,n){var i=U();try{return x(e)(r,t,n)}catch(a){if(M(i),!(a instanceof L))throw a;W(1,0)}}function is(e,r,t){var n=U();try{x(e)(r,t)}catch(i){if(M(n),!(i instanceof L))throw i;W(1,0)}}function as(e,r,t,n,i,a,s,l,c,u){var v=U();try{return x(e)(r,t,n,i,a,s,l,c,u)}catch(h){if(M(v),!(h instanceof L))throw h;W(1,0)}}function os(e,r,t){var n=U();try{return x(e)(r,t)}catch(i){if(M(n),!(i instanceof L))throw i;W(1,0)}}function ss(e,r,t,n){var i=U();try{x(e)(r,t,n)}catch(a){if(M(i),!(a instanceof L))throw a;W(1,0)}}function ls(e,r,t){var n=U();try{x(e)(r,t)}catch(i){if(M(n),!(i instanceof L))throw i;W(1,0)}}function cs(e,r,t,n){var i=U();try{return x(e)(r,t,n)}catch(a){if(M(i),!(a instanceof L))throw a;W(1,0)}}function ds(e,r){var t=U();try{x(e)(r)}catch(n){if(M(t),!(n instanceof L))throw n;W(1,0)}}function us(e,r,t,n,i,a){var s=U();try{x(e)(r,t,n,i,a)}catch(l){if(M(s),!(l instanceof L))throw l;W(1,0)}}function fs(e,r,t,n,i,a){var s=U();try{x(e)(r,t,n,i,a)}catch(l){if(M(s),!(l instanceof L))throw l;W(1,0)}}function _s(e,r,t,n){var i=U();try{return x(e)(r,t,n)}catch(a){if(M(i),!(a instanceof L))throw a;W(1,0)}}function vs(e,r,t,n){var i=U();try{x(e)(r,t,n)}catch(a){if(M(i),!(a instanceof L))throw a;W(1,0)}}function hs(e,r,t,n,i,a){var s=U();try{x(e)(r,t,n,i,a)}catch(l){if(M(s),!(l instanceof L))throw l;W(1,0)}}function ps(e,r,t,n,i){var a=U();try{x(e)(r,t,n,i)}catch(s){if(M(a),!(s instanceof L))throw s;W(1,0)}}function ms(e,r,t,n,i){var a=U();try{return x(e)(r,t,n,i)}catch(s){if(M(a),!(s instanceof L))throw s;W(1,0)}}function gs(e){var r=U();try{return x(e)()}catch(t){if(M(r),!(t instanceof L))throw t;W(1,0)}}function ys(e){var r=U();try{x(e)()}catch(t){if(M(r),!(t instanceof L))throw t;W(1,0)}}function ws(e,r,t,n,i,a,s,l,c,u){var v=U();try{x(e)(r,t,n,i,a,s,l,c,u)}catch(h){if(M(v),!(h instanceof L))throw h;W(1,0)}}function Es(e,r){var t=U();try{return x(e)(r)}catch(n){if(M(t),!(n instanceof L))throw n;return W(1,0),0n}}function bs(e,r,t,n){var i=U();try{x(e)(r,t,n)}catch(a){if(M(i),!(a instanceof L))throw a;W(1,0)}}function Ss(e,r,t,n){var i=U();try{return x(e)(r,t,n)}catch(a){if(M(i),!(a instanceof L))throw a;return W(1,0),0n}}function ks(e,r,t,n,i,a,s){var l=U();try{x(e)(r,t,n,i,a,s)}catch(c){if(M(l),!(c instanceof L))throw c;W(1,0)}}function Ts(e,r,t,n,i,a){var s=U();try{return x(e)(r,t,n,i,a)}catch(l){if(M(s),!(l instanceof L))throw l;W(1,0)}}function Fs(e,r,t,n,i,a,s,l,c,u){var v=U();try{return x(e)(r,t,n,i,a,s,l,c,u)}catch(h){if(M(v),!(h instanceof L))throw h;return W(1,0),0n}}function Ps(e,r,t,n,i,a,s,l,c,u,v){var h=U();try{x(e)(r,t,n,i,a,s,l,c,u,v)}catch(p){if(M(h),!(p instanceof L))throw p;W(1,0)}}var si;function Cs(){_(!w),ri(),bt()}function Cr(){if(Te>0){Ge=Cr;return}if(w){Ir?.(f),Ct();return}if(Cs(),bi(),Te>0){Ge=Cr;return}function e(){_(!si),si=!0,f.calledRun=!0,!Ie&&(Ct(),Ir?.(f),f.onRuntimeInitialized?.(),ar("onRuntimeInitialized"),_(!f._main,'compiled without a main, but one is present. if you added it from JS, use Module["onRuntimeInitialized"]'),Si())}f.setStatus?(f.setStatus("Running..."),setTimeout(()=>{setTimeout(()=>f.setStatus(""),1),e()},1)):e(),ze()}function As(){var e=ge,r=A,t=!1;ge=A=c=>{t=!0};try{lt(0);for(var n of["stdout","stderr"]){var i=o.analyzePath("/dev/"+n);if(!i)return;var a=i.object,s=a.rdev,l=pe.ttys[s];l?.output?.length&&(t=!0)}}catch{}ge=e,A=r,t&&Fe("stdio streams had content in them that was not flushed. you should set EXIT_RUNTIME to 1 (see the Emscripten FAQ), or make sure to emit a newline when you printf etc.")}var De;w||(De=await Ot(),Cr()),Ne?m=f:m=new Promise((e,r)=>{Ir=e,$r=r});for(let e of Object.keys(f))e in se||Object.defineProperty(se,e,{configurable:!0,get(){q(`Access to module property ('${e}') is no longer possible via the module constructor argument; Instead, use the result of the module constructor.`)}});return m}var ci=li,di=globalThis.name?.startsWith("em-pthread"),Os=globalThis.process?.versions?.node&&globalThis.process?.type!="renderer";Os&&(di=(await import("node:worker_threads")).workerData==="em-pthread");di&&li();var re=class se{static LibE57=null;static RootDir="/root ";static Init(){return se.LibE57!==null?Promise.resolve():ci().then(function(m){m.FS.mkdir(se.RootDir),m.FS.mount(m.FS.filesystems.NODEFS,{root:"/"},se.RootDir),se.LibE57=m})}};import ht from"path";import Rs from"fs";var pt=class{constructor(m,f){this.e57Reader=m,this.scanIdx=f}GetHeader(){return this.e57Reader.GetData3DHeader(this.scanIdx)}ReadScan(m=!0){var f=this.GetHeader(),j=f.pointCount;return this.ReadPoints(j,m)}ReadScanSync(m=!0){let f=Number(this.GetHeader().pointCount);return this.ReadPointsSync(f,m)}ReadPoints(m,f=!0){return this.e57Reader.ReadScan(this.scanIdx,m,f)}ReadPointsSync(m,f=!0){return this.e57Reader.ReadScanSync(this.scanIdx,m,f)}ScanPoints(m,f,j=!0){let B=Number(this.GetHeader().pointCount),C=Math.ceil(B/m);if(f){for(let w=0;w<C;w++)f(this.ReadPointsSync(m,j));return}let me=[];for(let w=0;w<C;w++)me.push(this.ReadPointsSync(m,j));return me}},mt=class{constructor(m,f){this._e57Reader=m,this._imageIdx=f}GetHeader(){return this._e57Reader.GetImage2DHeader(this._imageIdx)}ReadImage(){return this._e57Reader.ReadImage(this._imageIdx)}ReadImageSync(){return this._e57Reader.ReadImageSync(this._imageIdx)}ToBase64(){return this.ReadImage().then(m=>Buffer.from(m).toString("base64"))}Extension(){switch(this.GetHeader().imageType){case re.LibE57.Image2DType.ImageJPEG:return".jpeg";case re.LibE57.Image2DType.ImagePNG:return".png";case re.LibE57.Image2DType.ImageMaskPNG:return".png";case re.LibE57.Image2DType.E57_JPEG_IMAGE:return".jpeg";case re.LibE57.Image2DType.E57_PNG_IMAGE:return".png";case re.LibE57.Image2DType.E57_PNG_IMAGE_MASK:return".png";default:return".jpg"}}Save(m){let f=this.Extension(),j=m.replace(ht.extname(m),f);return this.ReadImage().then(B=>Rs.writeFile(j,B,C=>{if(C)throw C}))}},ui=class{constructor(m){let f=ht.resolve(m),j=ht.join(re.RootDir,f);this.reader=new re.LibE57.E57Reader(j);var B=this.GetData3DCount();this.scans=new Array(B);for(var C=0;C<B;C++)this.scans[C]=new pt(this.reader,C);var me=this.GetImage2DCount();this.images=new Array(me);for(var w=0;w<me;w++)this.images[w]=new mt(this.reader,w)}GetHeader(){return this.reader.GetHeader()}GetData3DCount(){return Number(this.reader.GetData3DCount())}GetImage2DCount(){return Number(this.reader.GetImage2DCount())}GetScan(m){return this.scans[m]}GetImage(m){return this.images[m]}};import fi from"path";import hi from"fs";import er from"sharp";var _i=class{constructor(m,f,j){this._imgPath=m,this._imgType=f,this._imgProjection=j,this._imageHeader=new re.LibE57.ImageHeader}getPath(){return this._imgPath}setPath(m){this._imgPath=m}getType(){return this._imgType}setType(m){this._imgType=m}getProjection(){return this._imgProjection}setProjection(m){this._imgProjection=m}getMetadata(){return er(this._imgPath).metadata()}async getDimensions(){let m=await er(this._imgPath).metadata();return[m.width,m.height]}async getWidth(){return(await er(this._imgPath).metadata()).width}async getHeight(){return(await er(this._imgPath).metadata()).height}getPose(){return this._imageHeader.pose}setPose(m){this._imageHeader.pose=m}getName(){return this._imageHeader.name}setName(m){this._imageHeader.name=m}getGuid(){return this._imageHeader.guid}setGuid(m){this._imageHeader.guid=m}getHeader(){return this._imageHeader}setHeader(m){this._imageHeader=m}async getBuffer(){let m=await hi.promises.readFile(this.getPath());return new Uint8Array(m)}setTrasnlation(m,f,j){this._imageHeader.pose.translation.x=m,this._imageHeader.pose.translation.y=f,this._imageHeader.pose.translation.z=j}setRotation(m,f,j,B){this._imageHeader.pose.rotation.w=m,this._imageHeader.pose.rotation.x=f,this._imageHeader.pose.rotation.y=j,this._imageHeader.pose.rotation.z=B}},vi=class{constructor(m){let f=fi.resolve(m),j=fi.join(re.RootDir,f);this.writer=new re.LibE57.E57Writer(j)}AddImageSync(m,f,j){let B=hi.readFileSync(m.getPath()),C=new Uint8Array(B);return Number(this.writer.AddImageSync(m.getHeader(),m.getType(),m.getProjection(),0,C,C.length,f,j))}async AddImage(m){let[f,j]=await Promise.all([m.getBuffer(),er(m.getPath()).metadata()]),B=new Uint8Array(f);return this.writer.AddImage(m.getHeader(),m.getType(),m.getProjection(),0,B,B.length,j.width,j.height).then(Number)}AddScanSync(m,f){return Number(this.writer.AddScanSync(m,f))}AddScan(m,f){return this.writer.AddScan(m,f).then(Number)}Close(){this.writer.Close()}};export{re as E57,ui as E57Reader,mt as E57ReaderImage,pt as E57ReaderScan,vi as E57Writer,_i as E57WriterImage};