async function ortWasmThreaded(moduleArg={}){var moduleRtn;var f=moduleArg,aa=!!globalThis.window,ba=!!globalThis.WorkerGlobalScope,k=globalThis.process?.versions?.node&&"renderer"!=globalThis.process?.type,m=ba&&self.name?.startsWith("em-pthread");if(k){const {createRequire:a}=await import("module");var require=a(import.meta.url),ca=require("worker_threads");global.Worker=ca.Worker;m=(ba=!ca.W)&&"em-pthread"==ca.workerData}f.mountExternalData=(a,b)=>{a.startsWith("./")&&(a=a.substring(2));(f.o||(f.o=new Map)).set(a,b)};
f.unmountExternalData=()=>{delete f.o};var SharedArrayBuffer=globalThis.SharedArrayBuffer??(new WebAssembly.Memory({initial:0,maximum:0,Z:!0})).buffer.constructor,da="./this.program",ea=(a,b)=>{throw b;},fa=import.meta.url,ha="",ia,ja;
if(k){var fs=require("fs");fa.startsWith("file:")&&(ha=require("path").dirname(require("url").fileURLToPath(fa))+"/");ja=a=>{a=ka(a)?new URL(a):a;return fs.readFileSync(a)};ia=async a=>{a=ka(a)?new URL(a):a;return fs.readFileSync(a,void 0)};1<process.argv.length&&(da=process.argv[1].replace(/\\/g,"/"));process.argv.slice(2);ea=(a,b)=>{process.exitCode=a;throw b;}}else if(aa||ba){try{ha=(new URL(".",fa)).href}catch{}k||(ba&&(ja=a=>{var b=new XMLHttpRequest;b.open("GET",a,!1);b.responseType="arraybuffer";
b.send(null);return new Uint8Array(b.response)}),ia=async a=>{if(ka(a))return new Promise((c,d)=>{var e=new XMLHttpRequest;e.open("GET",a,!0);e.responseType="arraybuffer";e.onload=()=>{200==e.status||0==e.status&&e.response?c(e.response):d(e.status)};e.onerror=d;e.send(null)});var b=await fetch(a,{credentials:"same-origin"});if(b.ok)return b.arrayBuffer();throw Error(b.status+" : "+b.url);})}var la=console.log.bind(console),ma=console.error.bind(console);
if(k){var na=require("util"),oa=a=>"object"==typeof a?na.inspect(a):a;la=(...a)=>fs.writeSync(1,a.map(oa).join(" ")+"\n");ma=(...a)=>fs.writeSync(2,a.map(oa).join(" ")+"\n")}var pa=la,q=ma,qa,ra,sa=!1,ta,ka=a=>a.startsWith("file://");function r(){u.buffer!=w.buffer&&ua()}var va,wa;
if(k&&m){var xa=ca.parentPort;xa.on("message",a=>global.onmessage?.({data:a}));Object.assign(globalThis,{self:global,postMessage:a=>xa.postMessage(a)});process.on("uncaughtException",a=>{postMessage({i:"uncaughtException",error:a});process.exit(1)})}var ya;
if(m){var za=!1;self.onunhandledrejection=b=>{throw b.reason||b;};async function a(b){try{var c=b.data,d=c.i;if("load"===d){let e=[];self.onmessage=g=>e.push(g);ya=()=>{postMessage({i:"loaded"});for(let g of e)a(g);self.onmessage=a};for(const g of c.K)if(!f[g]||f[g].proxy)f[g]=(...h)=>{postMessage({i:"callHandler",J:g,args:h})},"print"==g&&(pa=f[g]),"printErr"==g&&(q=f[g]);u=c.S;ua();ra=c.T;Aa();Ba()}else if("run"===d){Ca(c.h);Da(c.h,0,0,1,0,0);Ea();Fa(c.h);za||(Ga(),za=!0);try{await Ha(c.P,c.u)}catch(e){if("unwind"!=
e)throw e;}}else"setimmediate"!==c.target&&("checkMailbox"===d?za&&Ia():d&&(q(`worker: received unknown command ${d}`),q(c)))}catch(e){throw Ja(),e;}}self.onmessage=a}var w,x,Ka,La,B,C,Ma,D,E,Na,Oa=!1;function ua(){var a=u.buffer;f.HEAP8=w=new Int8Array(a);Ka=new Int16Array(a);f.HEAPU8=x=new Uint8Array(a);La=new Uint16Array(a);f.HEAP32=B=new Int32Array(a);f.HEAPU32=C=new Uint32Array(a);Ma=new Float32Array(a);D=new Float64Array(a);E=new BigInt64Array(a);Na=new BigUint64Array(a)}
function Pa(){Oa=!0;m?ya():F.__wasm_call_ctors()}function Qa(a){a="Aborted("+a+")";q(a);sa=!0;a+=". Build with -sASSERTIONS for more info.";Oa&&Ra();a=new WebAssembly.RuntimeError(a);wa?.(a);throw a;}var Sa;async function Ta(a){if(!qa)try{var b=await ia(a);return new Uint8Array(b)}catch{}if(a==Sa&&qa)a=new Uint8Array(qa);else if(ja)a=ja(a);else throw"both async and sync fetching of the wasm failed";return a}
async function Ua(a,b){try{var c=await Ta(a);return await WebAssembly.instantiate(c,b)}catch(d){q(`failed to asynchronously prepare wasm: ${d}`),Qa(d)}}async function Va(a){var b=Sa;if(!qa&&!ka(b)&&!k)try{var c=fetch(b,{credentials:"same-origin"});return await WebAssembly.instantiateStreaming(c,a)}catch(d){q(`wasm streaming compile failed: ${d}`),q("falling back to ArrayBuffer instantiation")}return Ua(b,a)}
function Wa(){Xa={HaveOffsetConverter:Ya,__pthread_create_js:Za,__syscall_fcntl64:$a,__syscall_fstat64:ab,__syscall_getcwd:bb,__syscall_getdents64:cb,__syscall_ioctl:db,__syscall_lstat64:eb,__syscall_mkdirat:fb,__syscall_newfstatat:gb,__syscall_openat:hb,__syscall_readlinkat:ib,__syscall_rmdir:jb,__syscall_stat64:kb,__syscall_unlinkat:lb,_abort_js:mb,_embind_register_bigint:nb,_embind_register_bool:ob,_embind_register_emval:qb,_embind_register_float:rb,_embind_register_integer:sb,_embind_register_memory_view:tb,
_embind_register_std_string:ub,_embind_register_std_wstring:vb,_embind_register_void:wb,_emscripten_init_main_thread_js:xb,_emscripten_notify_mailbox_postmessage:yb,_emscripten_receive_on_main_thread_js:zb,_emscripten_runtime_keepalive_clear:Ab,_emscripten_thread_cleanup:Bb,_emscripten_thread_mailbox_await:Fa,_emscripten_thread_set_strongref:Cb,_emval_await:Db,_emval_create_invoker:Eb,_emval_decref:Fb,_emval_equals:Gb,_emval_get_global:Hb,_emval_get_module_property:Ib,_emval_get_property:Jb,_emval_incref:Kb,
_emval_invoke:Lb,_emval_invoke_i64:Lb,_emval_new_array:Mb,_emval_new_array_from_memory_view:Nb,_emval_new_cstring:Ob,_emval_new_object:Pb,_emval_run_destructors:Qb,_emval_set_property:Rb,_gmtime_js:Sb,_localtime_js:Tb,_mktime_js:Ub,_mmap_js:Vb,_munmap_js:Wb,_setitimer_js:Xb,_tzset_js:Yb,clock_time_get:Zb,emscripten_asm_const_int:$b,emscripten_asm_const_ptr:ac,emscripten_check_blocking_allowed:bc,emscripten_date_now:cc,emscripten_errn:dc,emscripten_exit_with_live_runtime:ec,emscripten_get_heap_max:fc,
emscripten_get_now:gc,emscripten_has_asyncify:hc,emscripten_num_logical_cores:ic,emscripten_pc_get_function:jc,emscripten_resize_heap:kc,emscripten_stack_snapshot:lc,emscripten_stack_unwind_buffer:mc,emwgpuAdapterRequestDevice:nc,emwgpuBufferDestroy:oc,emwgpuBufferGetConstMappedRange:pc,emwgpuBufferGetMappedRange:qc,emwgpuBufferMapAsync:rc,emwgpuBufferUnmap:sc,emwgpuDelete:tc,emwgpuDeviceCreateBuffer:uc,emwgpuDeviceCreateComputePipelineAsync:vc,emwgpuDeviceCreateShaderModule:wc,emwgpuDeviceDestroy:xc,
emwgpuDevicePopErrorScope:yc,emwgpuInstanceRequestAdapter:zc,emwgpuWaitAny:Ac,environ_get:Bc,environ_sizes_get:Cc,exit:Dc,fd_close:Ec,fd_read:Fc,fd_seek:Gc,fd_write:Hc,memory:u,proc_exit:Ic,wgpuAdapterGetLimits:Jc,wgpuAdapterHasFeature:Kc,wgpuBufferGetSize:Lc,wgpuBufferGetUsage:Mc,wgpuCommandEncoderBeginComputePass:Nc,wgpuCommandEncoderCopyBufferToBuffer:Oc,wgpuCommandEncoderFinish:Pc,wgpuCommandEncoderResolveQuerySet:Qc,wgpuComputePassEncoderDispatchWorkgroups:Rc,wgpuComputePassEncoderDispatchWorkgroupsIndirect:Sc,
wgpuComputePassEncoderEnd:Tc,wgpuComputePassEncoderSetBindGroup:Uc,wgpuComputePassEncoderSetPipeline:Vc,wgpuComputePassEncoderWriteTimestamp:Wc,wgpuComputePipelineGetBindGroupLayout:Xc,wgpuDeviceCreateBindGroup:Yc,wgpuDeviceCreateCommandEncoder:Zc,wgpuDeviceCreateQuerySet:$c,wgpuDeviceGetAdapterInfo:ad,wgpuDeviceGetFeatures:bd,wgpuDeviceGetLimits:cd,wgpuDevicePushErrorScope:dd,wgpuQueueSubmit:ed,wgpuQueueWriteBuffer:fd};if(!Xa.I){Xa.I=!0;var a=Xa,b=/^(invoke_.*|__asyncjs__.*)$/;for(let [c,d]of Object.entries(a))"function"==
typeof d&&(d.A||b.test(c))&&(a[c]=d=new WebAssembly.Suspending(d))}return{env:Xa,wasi_snapshot_preview1:Xa}}
async function Aa(){function a(d,e){d=F=d.exports;var g=/^(OrtAppendExecutionProvider|OrtCreateSession|OrtRun|OrtRunWithBinding|OrtBindInput|main|__main_argc_argv)$/;gd=new Set;var h={};for(let [l,n]of Object.entries(d))"function"==typeof n?(g.test(l)&&(gd.add(n),n=WebAssembly.promising(n)),h[l]=hd(n)):h[l]=n;F=h;F=jd();kd.push(F._emscripten_tls_init);d=F;ld=d.__getTypeName;Ga=d._embind_initialize_bindings;f._OrtInit=d.OrtInit;f._OrtGetLastError=d.OrtGetLastError;f._OrtCreateSessionOptions=d.OrtCreateSessionOptions;
f._OrtAppendExecutionProvider=d.OrtAppendExecutionProvider;f._OrtAddFreeDimensionOverride=d.OrtAddFreeDimensionOverride;f._OrtAddSessionConfigEntry=d.OrtAddSessionConfigEntry;f._OrtReleaseSessionOptions=d.OrtReleaseSessionOptions;f._OrtCreateSession=d.OrtCreateSession;f._OrtReleaseSession=d.OrtReleaseSession;f._OrtGetInputOutputCount=d.OrtGetInputOutputCount;f._OrtGetInputOutputMetadata=d.OrtGetInputOutputMetadata;f._OrtFree=d.OrtFree;f._OrtCreateTensor=d.OrtCreateTensor;f._OrtGetTensorData=d.OrtGetTensorData;
f._OrtReleaseTensor=d.OrtReleaseTensor;f._OrtCreateRunOptions=d.OrtCreateRunOptions;f._OrtAddRunConfigEntry=d.OrtAddRunConfigEntry;f._OrtReleaseRunOptions=d.OrtReleaseRunOptions;f._OrtCreateBinding=d.OrtCreateBinding;f._OrtBindInput=d.OrtBindInput;f._OrtBindOutput=d.OrtBindOutput;f._OrtClearBoundOutputs=d.OrtClearBoundOutputs;f._OrtReleaseBinding=d.OrtReleaseBinding;f._OrtRunWithBinding=d.OrtRunWithBinding;f._OrtRun=d.OrtRun;f._OrtEndProfiling=d.OrtEndProfiling;md=f._OrtGetWebGpuDevice=d.OrtGetWebGpuDevice;
nd=d.pthread_self;G=f._free=d.free;od=f._malloc=d.malloc;pd=f._wgpuBufferRelease=d.wgpuBufferRelease;qd=f._wgpuCreateInstance=d.wgpuCreateInstance;rd=d.emwgpuCreateBindGroup;sd=d.emwgpuCreateBindGroupLayout;td=d.emwgpuCreateCommandBuffer;ud=d.emwgpuCreateCommandEncoder;vd=d.emwgpuCreateComputePassEncoder;wd=d.emwgpuCreateQuerySet;xd=d.emwgpuCreateBuffer;yd=d.emwgpuCreateDevice;zd=d.emwgpuCreateQueue;Ad=d.emwgpuOnCreateComputePipelineCompleted;Bd=d.emwgpuOnDeviceLostCompleted;Cd=d.emwgpuOnMapAsyncCompleted;
Dd=d.emwgpuOnPopErrorScopeCompleted;Ed=d.emwgpuOnRequestAdapterCompleted;Fd=d.emwgpuOnRequestDeviceCompleted;Gd=d.emwgpuOnUncapturedError;Da=d._emscripten_thread_init;Ja=d._emscripten_thread_crashed;Hd=d._emscripten_run_js_on_main_thread;Id=d._emscripten_thread_free_data;Jd=d._emscripten_thread_exit;Kd=d._emscripten_timeout;Ld=d._emscripten_check_mailbox;Md=d.memalign;Ra=d.__trap;Nd=d.emscripten_stack_set_limits;H=d._emscripten_stack_restore;Od=d._emscripten_stack_alloc;I=d.emscripten_stack_get_current;
Pd=d.__indirect_function_table;ra=e;return F}var b=Wa();if(f.instantiateWasm)return new Promise(d=>{f.instantiateWasm(b,(e,g)=>{d(a(e,g))})});if(m){var c=new WebAssembly.Instance(ra,Wa());return a(c,ra)}Sa??=f.locateFile?f.locateFile?f.locateFile("ort-wasm-simd-threaded.jspi.wasm",ha):ha+"ort-wasm-simd-threaded.jspi.wasm":(new URL("ort-wasm-simd-threaded.jspi.wasm",import.meta.url)).href;return function(d){return a(d.instance,d.module)}(await Va(b))}
class Qd{name="ExitStatus";constructor(a){this.message=`Program terminated with exit(${a})`;this.status=a}}
var Rd=a=>{a.terminate();a.onmessage=()=>{}},Td=()=>{for(var a=Sd;0<a.length;)a.shift()(f)},Sd=[],Ud=0,Vd=null,Zd=a=>{0==J.length&&(Wd(),Xd(J[0]));var b=J.pop();if(!b)return 6;Yd.push(b);K[a.h]=b;b.h=a.h;var c={i:"run",P:a.O,u:a.u,h:a.h};k&&b.unref();b.postMessage(c,a.D);return 0},L=0,M=(a,b,...c)=>{for(var d=2*c.length,e=I(),g=Od(8*d),h=g>>>3,l=0;l<c.length;l++){var n=c[l];"bigint"==typeof n?((r(),E)[h+2*l>>>0]=1n,(r(),E)[h+2*l+1>>>0]=n):((r(),E)[h+2*l>>>0]=0n,(r(),D)[h+2*l+1>>>0]=n)}a=Hd(a,0,d,
g,b);H(e);return a};function Ic(a){if(m)return M(0,1,a);ta=a;if(!(0<L)){for(var b of Yd)Rd(b);for(b of J)Rd(b);J=[];Yd=[];K={};sa=!0}ea(a,new Qd(a))}function $d(a){if(m)return M(1,0,a);Dc(a)}var Dc=a=>{ta=a;if(m)throw $d(a),"unwind";Ic(a)},J=[],Yd=[],kd=[],K={};function ae(){for(var a=f.numThreads-1;a--;)Wd();Sd.push(async()=>{var b=be();Ud++;await b;Ud--;0==Ud&&Vd&&(b=Vd,Vd=null,b())})}var ce=a=>{var b=a.h;delete K[b];J.push(a);Yd.splice(Yd.indexOf(a),1);a.h=0;Id(b)};
function Ea(){kd.forEach(a=>a())}
var Xd=a=>new Promise(b=>{a.onmessage=g=>{var h=g.data;g=h.i;if(h.s&&h.s!=nd()){var l=K[h.s];l?l.postMessage(h,h.D):q(`Internal error! Worker sent a message "${g}" to target pthread ${h.s}, but that thread no longer exists!`)}else if("checkMailbox"===g)Ia();else if("spawnThread"===g)Zd(h);else if("cleanupThread"===g)de(()=>{ce(K[h.R])});else if("loaded"===g)a.loaded=!0,k&&!a.h&&a.unref(),b(a);else if("setimmediate"===h.target)a.postMessage(h);else if("uncaughtException"===g)a.onerror(h.error);else if("callHandler"===
g)f[h.J](...h.args);else g&&q(`worker sent an unknown command ${g}`)};a.onerror=g=>{q(`${"worker sent an error!"} ${g.filename}:${g.lineno}: ${g.message}`);throw g;};k&&(a.on("message",g=>a.onmessage({data:g})),a.on("error",g=>a.onerror(g)));var c=[],d=[],e;for(e of d)f.propertyIsEnumerable(e)&&c.push(e);a.postMessage({i:"load",K:c,S:u,T:ra})});async function be(){if(!m)return Promise.all(J.map(Xd))}
function Wd(){var a=new Worker(new URL(import.meta.url),{type:"module",workerData:"em-pthread",name:"em-pthread"});J.push(a)}function Ca(a){var b=(r(),C)[a+52>>>2>>>0];a=(r(),C)[a+56>>>2>>>0];Nd(b,b-a);H(b)}
var ee=[],Ha=async(a,b)=>{L=0;var c=WebAssembly,d=c.promising,e=ee[a];e||(ee[a]=e=Pd.get(a),gd?.has(e)&&(ee[a]=e=WebAssembly.promising(e)));a=d.call(c,e)(b);a=await a;0<L?ta=a:Jd(a)},u,N=a=>-9007199254740992>a||9007199254740992<a?NaN:Number(a),fe=globalThis.TextDecoder&&new TextDecoder,ge=(a,b,c,d)=>{c=b+c;if(d)return c;for(;a[b]&&!(b>=c);)++b;return b},he=(a,b=0,c,d)=>{b>>>=0;c=ge(a,b,c,d);if(16<c-b&&a.buffer&&fe)return fe.decode(a.buffer instanceof ArrayBuffer?a.subarray(b,c):a.slice(b,c));for(d=
"";b<c;){var e=a[b++];if(e&128){var g=a[b++]&63;if(192==(e&224))d+=String.fromCharCode((e&31)<<6|g);else{var h=a[b++]&63;e=224==(e&240)?(e&15)<<12|g<<6|h:(e&7)<<18|g<<12|h<<6|a[b++]&63;65536>e?d+=String.fromCharCode(e):(e-=65536,d+=String.fromCharCode(55296|e>>10,56320|e&1023))}}else d+=String.fromCharCode(e)}return d},ie=(a,b,c)=>(a>>>=0)?he((r(),x),a,b,c):"";function je(a,b,c,d){return m?M(2,1,a,b,c,d):Za(a,b,c,d)}
function Za(a,b,c,d){a>>>=0;b>>>=0;c>>>=0;d>>>=0;if(!globalThis.SharedArrayBuffer)return 6;var e=[];if(m&&0===e.length)return je(a,b,c,d);a={O:c,h:a,u:d,D:e};return m?(a.i="spawnThread",postMessage(a,e),0):Zd(a)}function $a(a,b,c){return m?M(3,1,a,b,c):0}function ab(a,b){if(m)return M(4,1,a,b)}function bb(a,b){if(m)return M(5,1,a,b)}function cb(a,b,c){if(m)return M(6,1,a,b,c)}function db(a,b,c){return m?M(7,1,a,b,c):0}function eb(a,b){if(m)return M(8,1,a,b)}
function fb(a,b,c){if(m)return M(9,1,a,b,c)}function gb(a,b,c,d){if(m)return M(10,1,a,b,c,d)}function hb(a,b,c,d){if(m)return M(11,1,a,b,c,d)}function ib(a,b,c,d){if(m)return M(12,1,a,b,c,d)}function jb(a){if(m)return M(13,1,a)}function kb(a,b){if(m)return M(14,1,a,b)}function lb(a,b,c){if(m)return M(15,1,a,b,c)}
var mb=()=>Qa(""),O=a=>{a>>>=0;for(var b="";;){var c=(r(),x)[a++>>>0];if(!c)return b;b+=String.fromCharCode(c)}},ke={},le={},me={},ne=class extends Error{constructor(a){super(a);this.name="BindingError"}};function oe(a,b,c={}){var d=b.name;if(!a)throw new ne(`type "${d}" must have a positive integer typeid pointer`);if(le.hasOwnProperty(a)){if(c.L)return;throw new ne(`Cannot register type '${d}' twice`);}le[a]=b;delete me[a];ke.hasOwnProperty(a)&&(b=ke[a],delete ke[a],b.forEach(e=>e()))}
function P(a,b,c={}){return oe(a,b,c)}var pe=(a,b,c)=>{switch(b){case 1:return c?d=>(r(),w)[d>>>0]:d=>(r(),x)[d>>>0];case 2:return c?d=>(r(),Ka)[d>>>1>>>0]:d=>(r(),La)[d>>>1>>>0];case 4:return c?d=>(r(),B)[d>>>2>>>0]:d=>(r(),C)[d>>>2>>>0];case 8:return c?d=>(r(),E)[d>>>3>>>0]:d=>(r(),Na)[d>>>3>>>0];default:throw new TypeError(`invalid integer width (${b}): ${a}`);}};
function nb(a,b,c,d,e){a>>>=0;c>>>=0;b=O(b>>>0);d=0n===d;let g=h=>h;if(d){const h=8*c;g=l=>BigInt.asUintN(h,l);e=g(e)}P(a,{name:b,g,l:(h,l)=>{"number"==typeof l&&(l=BigInt(l));return l},j:pe(b,c,!d),m:null})}function ob(a,b,c,d){a>>>=0;b=O(b>>>0);P(a,{name:b,g:function(e){return!!e},l:function(e,g){return g?c:d},j:function(e){return this.g((r(),x)[e>>>0])},m:null})}var qe=[],Q=[0,1,,1,null,1,!0,1,!1,1];function Fb(a){a>>>=0;9<a&&0===--Q[a+1]&&(Q[a]=void 0,qe.push(a))}
var R=a=>{if(!a)throw new ne(`Cannot use deleted val. handle = ${a}`);return Q[a]},S=a=>{switch(a){case void 0:return 2;case null:return 4;case !0:return 6;case !1:return 8;default:const b=qe.pop()||Q.length;Q[b]=a;Q[b+1]=1;return b}};function re(a){return this.g((r(),C)[a>>>2>>>0])}var se={name:"emscripten::val",g:a=>{var b=R(a);Fb(a);return b},l:(a,b)=>S(b),j:re,m:null};function qb(a){return P(a>>>0,se)}
var te=(a,b)=>{switch(b){case 4:return function(c){return this.g((r(),Ma)[c>>>2>>>0])};case 8:return function(c){return this.g((r(),D)[c>>>3>>>0])};default:throw new TypeError(`invalid float width (${b}): ${a}`);}};function rb(a,b,c){a>>>=0;c>>>=0;b=O(b>>>0);P(a,{name:b,g:d=>d,l:(d,e)=>e,j:te(b,c),m:null})}function sb(a,b,c,d,e){a>>>=0;c>>>=0;b=O(b>>>0);let g=l=>l;if(0===d){var h=32-8*c;g=l=>l<<h>>>h;e=g(e)}P(a,{name:b,g,l:(l,n)=>n,j:pe(b,c,0!==d),m:null})}
function tb(a,b,c){function d(g){var h=(r(),C)[g>>>2>>>0];g=(r(),C)[g+4>>>2>>>0];return new e((r(),w).buffer,g,h)}a>>>=0;var e=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array,BigInt64Array,BigUint64Array][b];c=O(c>>>0);P(a,{name:c,g:d,j:d},{L:!0})}
var T=(a,b,c)=>{var d=(r(),x);b>>>=0;if(0<c){var e=b;c=b+c-1;for(var g=0;g<a.length;++g){var h=a.codePointAt(g);if(127>=h){if(b>=c)break;d[b++>>>0]=h}else if(2047>=h){if(b+1>=c)break;d[b++>>>0]=192|h>>6;d[b++>>>0]=128|h&63}else if(65535>=h){if(b+2>=c)break;d[b++>>>0]=224|h>>12;d[b++>>>0]=128|h>>6&63;d[b++>>>0]=128|h&63}else{if(b+3>=c)break;d[b++>>>0]=240|h>>18;d[b++>>>0]=128|h>>12&63;d[b++>>>0]=128|h>>6&63;d[b++>>>0]=128|h&63;g++}}d[b>>>0]=0;a=b-e}else a=0;return a},U=a=>{for(var b=0,c=0;c<a.length;++c){var d=
a.charCodeAt(c);127>=d?b++:2047>=d?b+=2:55296<=d&&57343>=d?(b+=4,++c):b+=3}return b};
function ub(a,b){a>>>=0;b=O(b>>>0);P(a,{name:b,g(c){var d=(r(),C)[c>>>2>>>0];d=ie(c+4,d,!0);G(c);return d},l(c,d){d instanceof ArrayBuffer&&(d=new Uint8Array(d));var e="string"==typeof d;if(!(e||ArrayBuffer.isView(d)&&1==d.BYTES_PER_ELEMENT))throw new ne("Cannot pass non-string to std::string");var g=e?U(d):d.length;var h=od(4+g+1),l=h+4;(r(),C)[h>>>2>>>0]=g;e?T(d,l,g+1):(r(),x).set(d,l>>>0);null!==c&&c.push(G,h);return h},j:re,m(c){G(c)}})}
var ue=globalThis.TextDecoder?new TextDecoder("utf-16le"):void 0,ve=(a,b,c)=>{a>>>=1;b=ge((r(),La),a,b/2,c);if(16<b-a&&ue)return ue.decode((r(),La).slice(a,b));for(c="";a<b;++a){var d=(r(),La)[a>>>0];c+=String.fromCharCode(d)}return c},we=(a,b,c)=>{c??=2147483647;if(2>c)return 0;c-=2;var d=b;c=c<2*a.length?c/2:a.length;for(var e=0;e<c;++e){var g=a.charCodeAt(e);(r(),Ka)[b>>>1>>>0]=g;b+=2}(r(),Ka)[b>>>1>>>0]=0;return b-d},xe=a=>2*a.length,ye=(a,b,c)=>{var d="";a>>>=2;for(var e=0;!(e>=b/4);e++){var g=
(r(),C)[a+e>>>0];if(!g&&!c)break;d+=String.fromCodePoint(g)}return d},ze=(a,b,c)=>{b>>>=0;c??=2147483647;if(4>c)return 0;var d=b;c=d+c-4;for(var e=0;e<a.length;++e){var g=a.codePointAt(e);65535<g&&e++;(r(),B)[b>>>2>>>0]=g;b+=4;if(b+4>c)break}(r(),B)[b>>>2>>>0]=0;return b-d},Ae=a=>{for(var b=0,c=0;c<a.length;++c)65535<a.codePointAt(c)&&c++,b+=4;return b};
function vb(a,b,c){a>>>=0;b>>>=0;c>>>=0;c=O(c);if(2===b){var d=ve;var e=we;var g=xe}else d=ye,e=ze,g=Ae;P(a,{name:c,g:h=>{var l=(r(),C)[h>>>2>>>0];l=d(h+4,l*b,!0);G(h);return l},l:(h,l)=>{if("string"!=typeof l)throw new ne(`Cannot pass non-string to C++ string type ${c}`);var n=g(l),t=od(4+n+b);(r(),C)[t>>>2>>>0]=n/b;e(l,t+4,n+b);null!==h&&h.push(G,t);return t},j:re,m(h){G(h)}})}function wb(a,b){a>>>=0;b=O(b>>>0);P(a,{M:!0,name:b,g:()=>{},l:()=>{}})}
function xb(a){Da(a>>>0,!ba,1,!aa,131072,!1);Ea()}var de=a=>{if(!sa)try{if(a(),!(0<L))try{m?nd()&&Jd(ta):Dc(ta)}catch(b){b instanceof Qd||"unwind"==b||ea(1,b)}}catch(b){b instanceof Qd||"unwind"==b||ea(1,b)}},Be=!Atomics.waitAsync||globalThis.navigator?.userAgent&&91>Number((navigator.userAgent.match(/Chrom(e|ium)\/([0-9]+)\./)||[])[2]);function Fa(a){a>>>=0;Be||(Atomics.waitAsync((r(),B),a>>>2,a).value.then(Ia),a+=128,Atomics.store((r(),B),a>>>2,1))}var Ia=()=>de(()=>{var a=nd();a&&(Fa(a),Ld())});
function yb(a,b){a>>>=0;a==b>>>0?setTimeout(Ia):m?postMessage({s:a,i:"checkMailbox"}):(a=K[a])&&a.postMessage({i:"checkMailbox"})}var Ce=[];function zb(a,b,c,d,e){b>>>=0;d/=2;Ce.length=d;c=e>>>0>>>3;for(e=0;e<d;e++)(r(),E)[c+2*e>>>0]?Ce[e]=(r(),E)[c+2*e+1>>>0]:Ce[e]=(r(),D)[c+2*e+1>>>0];return(b?De[b]:Ee[a])(...Ce)}var Ab=()=>{L=0};function Bb(a){a>>>=0;m?postMessage({i:"cleanupThread",R:a}):ce(K[a])}function Cb(a){k&&K[a>>>0].ref()}function hd(a){return(...b)=>a(...b)}
var gd=null,Fe=async a=>{L+=1;try{return await a()}finally{--L}};function Db(a){a>>>=0;return Fe(async()=>{var b=await R(a);return S(b)})}Db.A=!0;
var Ge=[],He=a=>{var b=Ge.length;Ge.push(a);return b},Ie=(a,b)=>{for(var c=Array(a),d=0;d<a;++d){var e=d,g=(r(),C)[b+4*d>>>2>>>0],h=le[g];if(void 0===h)throw a=`parameter ${d}`,g=ld(g),b=O(g),G(g),new ne(`${a} has unknown type ${b}`);c[e]=h}return c},Je=(a,b,c)=>{var d=[];a=a(d,c);d.length&&((r(),C)[b>>>2>>>0]=S(d));return a},Ke={},Le=a=>{var b=Ke[a];return void 0===b?O(a):b};
function Eb(a,b,c){var [d,...e]=Ie(a,b>>>0);b=d.l.bind(d);var g=e.map(n=>n.j.bind(n));a--;var h={toValue:R};a=g.map((n,t)=>{var y=`argFromPtr${t}`;h[y]=n;return`${y}(args${t?"+"+8*t:""})`});switch(c){case 0:var l="toValue(handle)";break;case 2:l="new (toValue(handle))";break;case 3:l="";break;case 1:h.getStringOrSymbol=Le,l="toValue(handle)[getStringOrSymbol(methodName)]"}l+=`(${a})`;d.M||(h.toReturnWire=b,h.emval_returnValue=Je,l=`return emval_returnValue(toReturnWire, destructorsRef, ${l})`);l=
`return function (handle, methodName, destructorsRef, args) {\n  ${l}\n  }`;c=(new Function(Object.keys(h),l))(...Object.values(h));l=`methodCaller<(${e.map(n=>n.name)}) => ${d.name}>`;return He(Object.defineProperty(c,"name",{value:l}))}function Gb(a,b){b>>>=0;a=R(a>>>0);b=R(b);return a==b}function Hb(a){a>>>=0;if(!a)return S(globalThis);a=Le(a);return S(globalThis[a])}function Ib(a){a=Le(a>>>0);return S(f[a])}function Jb(a,b){b>>>=0;a=R(a>>>0);b=R(b);return S(a[b])}
function Kb(a){a>>>=0;9<a&&(Q[a+1]+=1)}function Lb(a,b,c,d,e){return Ge[a>>>0](b>>>0,c>>>0,d>>>0,e>>>0)}function Mb(){return S([])}function Nb(a){a=R(a>>>0);for(var b=Array(a.length),c=0;c<a.length;c++)b[c]=a[c];return S(b)}function Ob(a){return S(Le(a>>>0))}function Pb(){return S({})}function Qb(a){a>>>=0;for(var b=R(a);b.length;){var c=b.pop();b.pop()(c)}Fb(a)}function Rb(a,b,c){b>>>=0;c>>>=0;a=R(a>>>0);b=R(b);c=R(c);a[b]=c}
function Sb(a,b){a=N(a);b>>>=0;a=new Date(1E3*a);(r(),B)[b>>>2>>>0]=a.getUTCSeconds();(r(),B)[b+4>>>2>>>0]=a.getUTCMinutes();(r(),B)[b+8>>>2>>>0]=a.getUTCHours();(r(),B)[b+12>>>2>>>0]=a.getUTCDate();(r(),B)[b+16>>>2>>>0]=a.getUTCMonth();(r(),B)[b+20>>>2>>>0]=a.getUTCFullYear()-1900;(r(),B)[b+24>>>2>>>0]=a.getUTCDay();a=(a.getTime()-Date.UTC(a.getUTCFullYear(),0,1,0,0,0,0))/864E5|0;(r(),B)[b+28>>>2>>>0]=a}
var Me=a=>0===a%4&&(0!==a%100||0===a%400),Ne=[0,31,60,91,121,152,182,213,244,274,305,335],Oe=[0,31,59,90,120,151,181,212,243,273,304,334];
function Tb(a,b){a=N(a);b>>>=0;a=new Date(1E3*a);(r(),B)[b>>>2>>>0]=a.getSeconds();(r(),B)[b+4>>>2>>>0]=a.getMinutes();(r(),B)[b+8>>>2>>>0]=a.getHours();(r(),B)[b+12>>>2>>>0]=a.getDate();(r(),B)[b+16>>>2>>>0]=a.getMonth();(r(),B)[b+20>>>2>>>0]=a.getFullYear()-1900;(r(),B)[b+24>>>2>>>0]=a.getDay();var c=(Me(a.getFullYear())?Ne:Oe)[a.getMonth()]+a.getDate()-1|0;(r(),B)[b+28>>>2>>>0]=c;(r(),B)[b+36>>>2>>>0]=-(60*a.getTimezoneOffset());c=(new Date(a.getFullYear(),6,1)).getTimezoneOffset();var d=(new Date(a.getFullYear(),
0,1)).getTimezoneOffset();a=(c!=d&&a.getTimezoneOffset()==Math.min(d,c))|0;(r(),B)[b+32>>>2>>>0]=a}
function Ub(a){a>>>=0;var b=new Date((r(),B)[a+20>>>2>>>0]+1900,(r(),B)[a+16>>>2>>>0],(r(),B)[a+12>>>2>>>0],(r(),B)[a+8>>>2>>>0],(r(),B)[a+4>>>2>>>0],(r(),B)[a>>>2>>>0],0),c=(r(),B)[a+32>>>2>>>0],d=b.getTimezoneOffset(),e=(new Date(b.getFullYear(),6,1)).getTimezoneOffset(),g=(new Date(b.getFullYear(),0,1)).getTimezoneOffset(),h=Math.min(g,e);0>c?(r(),B)[a+32>>>2>>>0]=Number(e!=g&&h==d):0<c!=(h==d)&&(e=Math.max(g,e),b.setTime(b.getTime()+6E4*((0<c?h:e)-d)));(r(),B)[a+24>>>2>>>0]=b.getDay();c=(Me(b.getFullYear())?
Ne:Oe)[b.getMonth()]+b.getDate()-1|0;(r(),B)[a+28>>>2>>>0]=c;(r(),B)[a>>>2>>>0]=b.getSeconds();(r(),B)[a+4>>>2>>>0]=b.getMinutes();(r(),B)[a+8>>>2>>>0]=b.getHours();(r(),B)[a+12>>>2>>>0]=b.getDate();(r(),B)[a+16>>>2>>>0]=b.getMonth();(r(),B)[a+20>>>2>>>0]=b.getYear();a=b.getTime();return BigInt(isNaN(a)?-1:a/1E3)}function Vb(a,b,c,d,e,g,h){return m?M(16,1,a,b,c,d,e,g,h):-52}function Wb(a,b,c,d,e,g){if(m)return M(17,1,a,b,c,d,e,g)}var Pe={},gc=()=>performance.timeOrigin+performance.now();
function Xb(a,b){if(m)return M(18,1,a,b);Pe[a]&&(clearTimeout(Pe[a].id),delete Pe[a]);if(!b)return 0;var c=setTimeout(()=>{delete Pe[a];de(()=>Kd(a,performance.timeOrigin+performance.now()))},b);Pe[a]={id:c,$:b};return 0}
function Yb(a,b,c,d){a>>>=0;b>>>=0;c>>>=0;d>>>=0;var e=(new Date).getFullYear(),g=(new Date(e,0,1)).getTimezoneOffset();e=(new Date(e,6,1)).getTimezoneOffset();var h=Math.max(g,e);(r(),C)[a>>>2>>>0]=60*h;(r(),B)[b>>>2>>>0]=Number(g!=e);b=l=>{var n=Math.abs(l);return`UTC${0<=l?"-":"+"}${String(Math.floor(n/60)).padStart(2,"0")}${String(n%60).padStart(2,"0")}`};a=b(g);b=b(e);e<g?(T(a,c,17),T(b,d,17)):(T(a,d,17),T(b,c,17))}var cc=()=>Date.now(),Qe=1;
function Zb(a,b,c){c>>>=0;if(!(0<=a&&3>=a))return 28;if(0===a)a=Date.now();else if(Qe)a=performance.timeOrigin+performance.now();else return 52;a=Math.round(1E6*a);(r(),E)[c>>>3>>>0]=BigInt(a);return 0}var Re=[],Se=(a,b)=>{Re.length=0;for(var c;c=(r(),x)[a++>>>0];){var d=105!=c;d&=112!=c;b+=d&&b%8?4:0;Re.push(112==c?(r(),C)[b>>>2>>>0]:106==c?(r(),E)[b>>>3>>>0]:105==c?(r(),B)[b>>>2>>>0]:(r(),D)[b>>>3>>>0]);b+=d?8:4}return Re};function $b(a,b,c){a>>>=0;b=Se(b>>>0,c>>>0);return De[a](...b)}
function ac(a,b,c){a>>>=0;b=Se(b>>>0,c>>>0);return De[a](...b)}var bc=()=>{};function dc(a,b){return q(ie(a>>>0,b>>>0))}var ec=()=>{L+=1;throw"unwind";};function fc(){return 4294901760}var hc=()=>2,ic=()=>k?require("os").cpus().length:navigator.hardwareConcurrency,Te={},Ue=a=>{var b=U(a)+1,c=od(b);c&&T(a,c,b);return c},Ve=a=>{var b;return(b=/\bwasm-function\[\d+\]:(0x[0-9a-f]+)/.exec(a))?+b[1]:(b=/:(\d+):\d+(?:\)|$)/.exec(a))?2147483648|+b[1]:0},We=a=>{for(var b of a)(a=Ve(b))&&(Te[a]=b)};
function lc(){var a=Error().stack.toString().split("\n");"Error"==a[0]&&a.shift();We(a);Te.B=Ve(a[3]);Te.N=a;return Te.B}function jc(a){a=Te[a>>>0];if(!a)return 0;var b;if(b=/^\s+at .*\.wasm\.(.*) \(.*\)$/.exec(a))a=b[1];else if(b=/^\s+at (.*) \(.*\)$/.exec(a))a=b[1];else if(b=/^(.+?)@/.exec(a))a=b[1];else return 0;G(jc.C??0);jc.C=Ue(a);return jc.C}
function kc(a){a>>>=0;var b=(r(),x).length;if(a<=b||4294901760<a)return!1;for(var c=1;4>=c;c*=2){var d=b*(1+.2/c);d=Math.min(d,a+100663296);a:{d=(Math.min(4294901760,65536*Math.ceil(Math.max(a,d)/65536))-u.buffer.byteLength+65535)/65536|0;try{u.grow(d);ua();var e=1;break a}catch(g){}e=void 0}if(e)return!0}return!1}
function mc(a,b,c){a>>>=0;b>>>=0;if(Te.B==a)var d=Te.N;else d=Error().stack.toString().split("\n"),"Error"==d[0]&&d.shift(),We(d);for(var e=3;d[e]&&Ve(d[e])!=a;)++e;for(a=0;a<c&&d[a+e];++a)(r(),B)[b+4*a>>>2>>>0]=Ve(d[a+e]);return a}
var V=a=>{var b=U(a)+1,c=Od(b);T(a,c,b);return c},Xe=[],W=(a,b)=>{Xe[a>>>=0]=b},X=[],Ye=[],Ze=(a,b)=>{Ye[a]=new Promise(c=>b.finally(()=>c(a)))},Y=a=>{if(a)return Xe[a>>>0]},$e=(a,b=0)=>{"pending"!=a.mapState||Qa();b=xd(b,"mapped"==a.mapState?3:1);W(b,a);"mapped"==a.mapState&&(X[b]=[]);return b},af=(a,b=0)=>{var c=zd(b);b=yd(b,c);W(c,a.queue);W(b,a);return b},bf=(a,b,c)=>{(r(),C)[a>>>2>>>0]=b;(r(),C)[a+4>>>2>>>0]=c},cf=a=>{var b=(r(),C)[a>>>2>>>0];a=(r(),C)[a+4>>>2>>>0];return ie(b,a)},Z=a=>{var b=
(r(),C)[a>>>2>>>0];a=(r(),C)[a+4>>>2>>>0];if(b)return ie(b,a);if(0===a)return""},df=a=>{var b=Z(a+4);var c=(c=(r(),C)[a+12>>>2>>>0])?Y(c):"auto";if(a+=16){var d=Y((r(),C)[a+4>>>2>>>0]);var e=(r(),C)[a+16>>>2>>>0];var g=(r(),C)[a+20>>>2>>>0];if(e){for(var h={},l=0;l<e;++l){var n=g+24*l,t=cf(n+4);h[t]=(r(),D)[n+16>>>3>>>0]}e=h}else e=void 0;a={module:d,constants:e,entryPoint:Z(a+8)}}else a=void 0;return{label:b,layout:c,compute:a}},ef=(a,b)=>{function c(e,g){e=a[e];(r(),B)[b+g>>>2>>>0]=e}function d(e,
g){e=a[e];(r(),E)[b+g>>>3>>>0]=BigInt(e)}c("maxTextureDimension1D",4);c("maxTextureDimension2D",8);c("maxTextureDimension3D",12);c("maxTextureArrayLayers",16);c("maxBindGroups",20);c("maxBindGroupsPlusVertexBuffers",24);c("maxBindingsPerBindGroup",28);c("maxDynamicUniformBuffersPerPipelineLayout",32);c("maxDynamicStorageBuffersPerPipelineLayout",36);c("maxSampledTexturesPerShaderStage",40);c("maxSamplersPerShaderStage",44);c("maxStorageBuffersPerShaderStage",48);c("maxStorageTexturesPerShaderStage",
52);c("maxUniformBuffersPerShaderStage",56);c("minUniformBufferOffsetAlignment",80);c("minStorageBufferOffsetAlignment",84);d("maxUniformBufferBindingSize",64);d("maxStorageBufferBindingSize",72);c("maxVertexBuffers",88);d("maxBufferSize",96);c("maxVertexAttributes",104);c("maxVertexBufferArrayStride",108);c("maxInterStageShaderVariables",112);c("maxColorAttachments",116);c("maxColorAttachmentBytesPerSample",120);c("maxComputeWorkgroupStorageSize",124);c("maxComputeInvocationsPerWorkgroup",128);c("maxComputeWorkgroupSizeX",
132);c("maxComputeWorkgroupSizeY",136);c("maxComputeWorkgroupSizeZ",140);c("maxComputeWorkgroupsPerDimension",144);void 0!==a.Y&&c("maxImmediateSize",148)},ff=[,"validation","out-of-memory","internal"],gf=[,"compatibility","core"],hf={1:"core-features-and-limits",2:"depth-clip-control",3:"depth32float-stencil8",4:"texture-compression-bc",5:"texture-compression-bc-sliced-3d",6:"texture-compression-etc2",7:"texture-compression-astc",8:"texture-compression-astc-sliced-3d",9:"timestamp-query",10:"indirect-first-instance",
11:"shader-f16",12:"rg11b10ufloat-renderable",13:"bgra8unorm-storage",14:"float32-filterable",15:"float32-blendable",16:"clip-distances",17:"dual-source-blending",18:"subgroups",19:"texture-formats-tier1",20:"texture-formats-tier2",21:"primitive-index",327692:"chromium-experimental-unorm16-texture-formats",327693:"chromium-experimental-snorm16-texture-formats",327732:"chromium-experimental-multi-draw-indirect"},jf=[,"low-power","high-performance"],kf=[,"occlusion","timestamp"],lf={undefined:1,unknown:1,
destroyed:2};
function nc(a,b,c,d,e,g){b=N(b);c=N(c);d>>>=0;e>>>=0;g>>>=0;var h=Y(a>>>0);a={};if(g){var l=(r(),C)[g+12>>>2>>>0];if(l){var n=(r(),C)[g+16>>>2>>>0];a.requiredFeatures=Array.from((r(),C).subarray(n>>>2>>>0,n+4*l>>>2>>>0),p=>hf[p])}var t=(r(),C)[g+20>>>2>>>0];if(t){var y={};function p(z,A,pb=!1){A=t+A;A=(r(),C)[A>>>2>>>0];4294967295==A||pb&&0==A||(y[z]=A)}function v(z,A){A=t+A;var pb=(r(),C)[A>>>2>>>0],qf=(r(),C)[A+4>>>2>>>0];if(4294967295!=pb||4294967295!=qf)y[z]=4294967296*(r(),C)[A+4>>>2>>>0]+(r(),
C)[A>>>2>>>0]}p("maxTextureDimension1D",4);p("maxTextureDimension2D",8);p("maxTextureDimension3D",12);p("maxTextureArrayLayers",16);p("maxBindGroups",20);p("maxBindGroupsPlusVertexBuffers",24);p("maxDynamicUniformBuffersPerPipelineLayout",32);p("maxDynamicStorageBuffersPerPipelineLayout",36);p("maxSampledTexturesPerShaderStage",40);p("maxSamplersPerShaderStage",44);p("maxStorageBuffersPerShaderStage",48);p("maxStorageTexturesPerShaderStage",52);p("maxUniformBuffersPerShaderStage",56);p("minUniformBufferOffsetAlignment",
80);p("minStorageBufferOffsetAlignment",84);v("maxUniformBufferBindingSize",64);v("maxStorageBufferBindingSize",72);p("maxVertexBuffers",88);v("maxBufferSize",96);p("maxVertexAttributes",104);p("maxVertexBufferArrayStride",108);p("maxInterStageShaderVariables",112);p("maxColorAttachments",116);p("maxColorAttachmentBytesPerSample",120);p("maxComputeWorkgroupStorageSize",124);p("maxComputeInvocationsPerWorkgroup",128);p("maxComputeWorkgroupSizeX",132);p("maxComputeWorkgroupSizeY",136);p("maxComputeWorkgroupSizeZ",
140);p("maxComputeWorkgroupsPerDimension",144);p("maxImmediateSize",148,!0);a.requiredLimits=y}if(l=(r(),C)[g+24>>>2>>>0])l={label:Z(l+4)},a.defaultQueue=l;a.label=Z(g+4)}L+=1;Ze(b,h.requestDevice(a).then(p=>{--L;W(e,p.queue);W(d,p);c&&(L+=1,Ze(c,p.lost.then(v=>{--L;p.onuncapturederror=()=>{};var z=I(),A=V(v.message);Bd(c,lf[v.reason],A);H(z)})));p.onuncapturederror=v=>{var z=5;v.error instanceof GPUValidationError?z=2:v.error instanceof GPUOutOfMemoryError?z=3:v.error instanceof GPUInternalError&&
(z=4);var A=I();v=V(v.error.message);Gd(d,z,v);H(A)};"adapterInfo"in p||(p.adapterInfo=h.info);Fd(b,1,d,0)},p=>{--L;var v=I();p=V(p.message);Fd(b,3,d,p);c&&Bd(c,4,p);H(v)}))}function oc(a){a>>>=0;var b=Y(a),c=X[a];if(c){for(var d=0;d<c.length;++d)c[d]();delete X[a]}b.destroy()}var mf=()=>{var a="getMappedRange size=0 no longer means WGPU_WHOLE_MAP_SIZE";mf.v||(mf.v={});mf.v[a]||(mf.v[a]=1,k&&(a="warning: "+a),q(a))};
function pc(a,b,c){a>>>=0;b>>>=0;c>>>=0;var d=Y(a);0===c&&mf();4294967295==c&&(c=void 0);try{var e=d.getMappedRange(b,c)}catch(h){return 0}var g=Md(16,e.byteLength);(r(),x).set(new Uint8Array(e),g>>>0);X[a].push(()=>G(g));return g}
function qc(a,b,c){a>>>=0;b>>>=0;c>>>=0;var d=Y(a);0===c&&mf();4294967295==c&&(c=void 0);try{var e=d.getMappedRange(b,c)}catch(h){return 0}var g=Md(16,e.byteLength);(r(),x).fill(0,g,e.byteLength);X[a].push(()=>{(new Uint8Array(e)).set((r(),x).subarray(g>>>0,g+e.byteLength>>>0));G(g)});return g}
function rc(a,b,c,d,e){a>>>=0;b=N(b);c=N(c);e>>>=0;var g=Y(a);X[a]=[];4294967295==e&&(e=void 0);L+=1;Ze(b,g.mapAsync(c,d>>>0,e).then(()=>{--L;Cd(b,1,0)},h=>{--L;I();var l=V(h.message);Cd(b,"AbortError"===h.name?4:"OperationError"===h.name?3:0,l);delete X[a]}))}function sc(a){a>>>=0;var b=Y(a),c=X[a];if(c){for(var d=0;d<c.length;++d)c[d]();delete X[a];b.unmap()}}function tc(a){delete Xe[a>>>0]}
function uc(a,b,c){a>>>=0;b>>>=0;c>>>=0;var d=!!(r(),C)[b+32>>>2>>>0];b={label:Z(b+4),usage:(r(),C)[b+16>>>2>>>0],size:4294967296*(r(),C)[b+28>>>2>>>0]+(r(),C)[b+24>>>2>>>0],mappedAtCreation:d};a=Y(a);try{var e=a.createBuffer(b)}catch(g){return!1}W(c,e);d&&(X[c]=[]);return!0}
function vc(a,b,c,d){a>>>=0;b=N(b);d>>>=0;c=df(c>>>0);a=Y(a);L+=1;Ze(b,a.createComputePipelineAsync(c).then(e=>{--L;W(d,e);Ad(b,1,d,0)},e=>{--L;var g=I(),h=V(e.message);Ad(b,"validation"===e.reason?3:"internal"===e.reason?4:0,d,h);H(g)}))}function wc(a,b,c){a>>>=0;b>>>=0;c>>>=0;var d=(r(),C)[b>>>2>>>0],e=(r(),C)[d+4>>>2>>>0];b={label:Z(b+4),code:""};switch(e){case 2:b.code=cf(d+8)}W(c,Y(a).createShaderModule(b))}var xc=a=>{a=Y(a);a.onuncapturederror=null;a.destroy()};
function yc(a,b){b=N(b);a=Y(a>>>0);L+=1;Ze(b,a.popErrorScope().then(c=>{--L;var d=5;c?c instanceof GPUValidationError?d=2:c instanceof GPUOutOfMemoryError?d=3:c instanceof GPUInternalError&&(d=4):d=1;var e=I();c=c?V(c.message):0;Dd(b,1,d,c);H(e)},c=>{--L;var d=I();c=V(c.message);Dd(b,1,5,c);H(d)}))}
function zc(a,b,c,d){b=N(b);c>>>=0;d>>>=0;if(c){var e=(r(),C)[c+4>>>2>>>0];e={featureLevel:gf[e],powerPreference:jf[(r(),C)[c+8>>>2>>>0]],forceFallbackAdapter:!!(r(),C)[c+12>>>2>>>0]};c=(r(),C)[c>>>2>>>0];0!==c&&(r(),e.ba=!!(r(),C)[c+8>>>2>>>0])}"gpu"in navigator?(L+=1,Ze(b,navigator.gpu.requestAdapter(e).then(g=>{--L;if(g)W(d,g),Ed(b,1,d,0);else{g=I();var h=V("WebGPU not available on this browser (requestAdapter returned null)");Ed(b,3,d,h);H(g)}},g=>{--L;var h=I();g=V(g.message);Ed(b,4,d,g);H(h)}))):
(c=I(),e=V("WebGPU not available on this browser (navigator.gpu is not available)"),Ed(b,3,d,e),H(c))}function Ac(a,b,c){a>>>=0;b>>>=0;c>>>=0;return Fe(async()=>{var d=[];if(c){var e=(r(),B)[c>>>2>>>0];d.length=b+1;d[b]=new Promise(l=>setTimeout(l,e,0))}else d.length=b;for(var g=0;g<b;++g){var h=4294967296*(r(),C)[a+8*g+4>>>2>>>0]+(r(),C)[a+8*g>>>2>>>0];if(!(h in Ye))return h;d[g]=Ye[h]}d=await Promise.race(d);delete Ye[d];return d})}Ac.A=!0;
var nf={},pf=()=>{if(!of){var a={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:(globalThis.navigator?.language??"C").replace("-","_")+".UTF-8",_:da||"./this.program"},b;for(b in nf)void 0===nf[b]?delete a[b]:a[b]=nf[b];var c=[];for(b in a)c.push(`${b}=${a[b]}`);of=c}return of},of;function Bc(a,b){if(m)return M(19,1,a,b);a>>>=0;b>>>=0;var c=0,d=0,e;for(e of pf()){var g=b+c;(r(),C)[a+d>>>2>>>0]=g;c+=T(e,g,Infinity)+1;d+=4}return 0}
function Cc(a,b){if(m)return M(20,1,a,b);a>>>=0;b>>>=0;var c=pf();(r(),C)[a>>>2>>>0]=c.length;a=0;for(var d of c)a+=U(d)+1;(r(),C)[b>>>2>>>0]=a;return 0}function Ec(a){return m?M(21,1,a):52}function Fc(a,b,c,d){return m?M(22,1,a,b,c,d):52}function Gc(a,b,c,d){return m?M(23,1,a,b,c,d):70}var rf=[null,[],[]];
function Hc(a,b,c,d){if(m)return M(24,1,a,b,c,d);b>>>=0;c>>>=0;d>>>=0;for(var e=0,g=0;g<c;g++){var h=(r(),C)[b>>>2>>>0],l=(r(),C)[b+4>>>2>>>0];b+=8;for(var n=0;n<l;n++){var t=a,y=(r(),x)[h+n>>>0],p=rf[t];0===y||10===y?((1===t?pa:q)(he(p)),p.length=0):p.push(y)}e+=l}(r(),C)[d>>>2>>>0]=e;return 0}function Jc(a,b){ef(Y(a>>>0).limits,b>>>0);return 1}function Kc(a,b){return Y(a>>>0).features.has(hf[b])}function Lc(a){return BigInt(Y(a>>>0).size)}function Mc(a){return BigInt(Y(a>>>0).usage)}
function Nc(a,b){a>>>=0;b>>>=0;if(b){var c=Z(b+4);b=(r(),C)[b+12>>>2>>>0];b=0!==b?{querySet:Y((r(),C)[b+4>>>2>>>0]),beginningOfPassWriteIndex:(r(),C)[b+8>>>2>>>0],endOfPassWriteIndex:(r(),C)[b+12>>>2>>>0]}:void 0;c={label:c,timestampWrites:b}}a=Y(a);b=vd(0);W(b,a.beginComputePass(c));return b}function Oc(a,b,c,d,e,g){c=N(c);e=N(e);g=N(g);Y(a>>>0).copyBufferToBuffer(Y(b>>>0),c,Y(d>>>0),e,g)}function Pc(a){a=Y(a>>>0);var b=td(0);W(b,a.finish());return b}
function Qc(a,b,c,d,e,g){g=N(g);Y(a>>>0).resolveQuerySet(Y(b>>>0),c,d,Y(e>>>0),g)}function Rc(a,b,c,d){Y(a>>>0).dispatchWorkgroups(b,c,d)}function Sc(a,b,c){c=N(c);Y(a>>>0).dispatchWorkgroupsIndirect(Y(b>>>0),c)}function Tc(a){Y(a>>>0).end()}function Uc(a,b,c,d,e){d>>>=0;e>>>=0;a=Y(a>>>0);c=Y(c>>>0);0==d?a.setBindGroup(b,c):a.setBindGroup(b,c,(r(),C),e>>>2,d)}function Vc(a,b){Y(a>>>0).setPipeline(Y(b>>>0))}function Wc(a,b,c){Y(a>>>0).aa(Y(b>>>0),c)}
function Xc(a,b){a=Y(a>>>0);var c=sd(0);W(c,a.getBindGroupLayout(b));return c}
function Yc(a,b){a>>>=0;b>>>=0;var c=Z(b+4),d=Y((r(),C)[b+12>>>2>>>0]),e=(r(),C)[b+16>>>2>>>0];b=(r(),C)[b+20>>>2>>>0];for(var g=[],h=0;h<e;++h){var l=g,n=l.push;var t=b+40*h;var y=(r(),C)[t+8>>>2>>>0],p=(r(),C)[t+32>>>2>>>0],v=(r(),C)[t+36>>>2>>>0],z=(r(),C)[t+4>>>2>>>0];y?(p=t+24,p=(r(),C)[p>>>2>>>0]+4294967296*(r(),B)[p+4>>>2>>>0],-1==p&&(p=void 0),t={binding:z,resource:{buffer:Y(y),offset:4294967296*(r(),C)[t+4+16>>>2>>>0]+(r(),C)[t+16>>>2>>>0],size:p}}):t=p?{binding:z,resource:Y(p)}:{binding:z,
resource:Y(v)};n.call(l,t)}c={label:c,layout:d,entries:g};a=Y(a);d=rd(0);W(d,a.createBindGroup(c));return d}function Zc(a,b){a>>>=0;b>>>=0;var c;b&&(c={label:Z(b+4)});a=Y(a);b=ud(0);W(b,a.createCommandEncoder(c));return b}function $c(a,b){a>>>=0;b>>>=0;b={type:kf[(r(),C)[b+12>>>2>>>0]],count:(r(),C)[b+16>>>2>>>0]};a=Y(a);var c=wd(0);W(c,a.createQuerySet(b));return c}
function ad(a,b){a=Y(a>>>0).adapterInfo;b>>>=0;(r(),B)[b+52>>>2>>>0]=a.subgroupMinSize;(r(),B)[b+56>>>2>>>0]=a.subgroupMaxSize;var c=Ue(a.vendor+a.architecture+a.device+a.description),d=U(a.vendor);bf(b+4,c,d);c+=d;d=U(a.architecture);bf(b+12,c,d);c+=d;d=U(a.device);bf(b+20,c,d);bf(b+28,c+d,U(a.description));(r(),B)[b+36>>>2>>>0]=2;a=a.isFallbackAdapter?3:4;(r(),B)[b+40>>>2>>>0]=a;(r(),B)[b+44>>>2>>>0]=0;(r(),B)[b+48>>>2>>>0]=0;return 1}
var sf={"core-features-and-limits":1,"depth-clip-control":2,"depth32float-stencil8":3,"texture-compression-bc":4,"texture-compression-bc-sliced-3d":5,"texture-compression-etc2":6,"texture-compression-astc":7,"texture-compression-astc-sliced-3d":8,"timestamp-query":9,"indirect-first-instance":10,"shader-f16":11,"rg11b10ufloat-renderable":12,"bgra8unorm-storage":13,"float32-filterable":14,"float32-blendable":15,"clip-distances":16,"dual-source-blending":17,subgroups:18,"texture-formats-tier1":19,"texture-formats-tier2":20,
"primitive-index":21,"chromium-experimental-unorm16-texture-formats":327692,"chromium-experimental-snorm16-texture-formats":327693,"chromium-experimental-multi-draw-indirect":327732};function bd(a,b){b>>>=0;a=Y(a>>>0);var c=od(4*a.features.size),d=0,e=0;a.features.forEach(g=>{g=sf[g];0<=g&&((r(),B)[c+d>>>2>>>0]=g,d+=4,e++)});(r(),C)[b+4>>>2>>>0]=c;(r(),C)[b>>>2>>>0]=e}function cd(a,b){ef(Y(a>>>0).limits,b>>>0);return 1}function dd(a,b){Y(a>>>0).pushErrorScope(ff[b])}
function ed(a,b,c){b>>>=0;c>>>=0;a=Y(a>>>0);b=Array.from((r(),B).subarray(c>>>2>>>0,c+4*b>>>2>>>0),d=>Y(d));a.submit(b)}function fd(a,b,c,d,e){c=N(c);d>>>=0;e>>>=0;a=Y(a>>>0);b=Y(b>>>0);d=(r(),x).subarray(d>>>0,d+e>>>0);a.writeBuffer(b,c,d,0,e)}m||ae();m||(u=new WebAssembly.Memory({initial:256,maximum:65536,shared:!0}),ua());f.wasmBinary&&(qa=f.wasmBinary);f.stackSave=()=>I();f.stackRestore=a=>H(a);f.stackAlloc=a=>Od(a);
f.setValue=function(a,b,c="i8"){c.endsWith("*")&&(c="*");switch(c){case "i1":(r(),w)[a>>>0]=b;break;case "i8":(r(),w)[a>>>0]=b;break;case "i16":(r(),Ka)[a>>>1>>>0]=b;break;case "i32":(r(),B)[a>>>2>>>0]=b;break;case "i64":(r(),E)[a>>>3>>>0]=BigInt(b);break;case "float":(r(),Ma)[a>>>2>>>0]=b;break;case "double":(r(),D)[a>>>3>>>0]=b;break;case "*":(r(),C)[a>>>2>>>0]=b;break;default:Qa(`invalid type for setValue: ${c}`)}};
f.getValue=function(a,b="i8"){b.endsWith("*")&&(b="*");switch(b){case "i1":return(r(),w)[a>>>0];case "i8":return(r(),w)[a>>>0];case "i16":return(r(),Ka)[a>>>1>>>0];case "i32":return(r(),B)[a>>>2>>>0];case "i64":return(r(),E)[a>>>3>>>0];case "float":return(r(),Ma)[a>>>2>>>0];case "double":return(r(),D)[a>>>3>>>0];case "*":return(r(),C)[a>>>2>>>0];default:Qa(`invalid type for getValue: ${b}`)}};f.UTF8ToString=ie;f.stringToUTF8=T;f.lengthBytesUTF8=U;
var Ee=[Ic,$d,je,$a,ab,bb,cb,db,eb,fb,gb,hb,ib,jb,kb,lb,Vb,Wb,Xb,Bc,Cc,Ec,Fc,Gc,Hc],De={1125648:(a,b,c,d,e)=>{if("undefined"==typeof f||!f.o)return 1;a=ie(Number(a>>>0));a.startsWith("./")&&(a=a.substring(2));a=f.o.get(a);if(!a)return 2;b=Number(b>>>0);c=Number(c>>>0);d=Number(d>>>0);if(b+c>a.byteLength)return 3;try{const g=a.subarray(b,b+c);switch(e){case 0:(r(),x).set(g,d>>>0);break;case 1:f.F?f.F(d,g):f.X(d,g);break;default:return 4}return 0}catch{return 4}},1126472:(a,b,c)=>{f.H(a,(r(),x).subarray(b>>>
0,b+c>>>0))},1126536:()=>f.V(),1126578:a=>{f.G(a)},1126615:()=>"undefined"!==typeof wasmOffsetConverter};function Ya(){return"undefined"!==typeof wasmOffsetConverter}var ld,Ga,md,nd,G,od,pd,qd,rd,sd,td,ud,vd,wd,xd,yd,zd,Ad,Bd,Cd,Dd,Ed,Fd,Gd,Da,Ja,Hd,Id,Jd,Kd,Ld,Md,Ra,Nd,H,Od,I,Pd,Xa;
function jd(){var a=F;a=Object.assign({},a);var b=d=>e=>d(e)>>>0,c=d=>()=>d()>>>0;a.__getTypeName=b(a.__getTypeName);a.pthread_self=c(a.pthread_self);a.malloc=b(a.malloc);a.memalign=(d=>(e,g)=>d(e,g)>>>0)(a.memalign);a._emscripten_stack_alloc=b(a._emscripten_stack_alloc);a.emscripten_stack_get_current=c(a.emscripten_stack_get_current);return a}function Ba(){0<Ud?Vd=Ba:m?(va?.(f),Pa()):(Td(),0<Ud?Vd=Ba:async function(){f.calledRun=!0;sa||(Pa(),va?.(f))}())}var F;m||(F=await (Aa()),Ba());
f.PTR_SIZE=4;
f.webgpuInit=a=>{const b=new WeakMap;let c=1,d=void 0,e=void 0;f.webgpuRegisterDevice=l=>{if(void 0!==e)throw Error("another WebGPU EP inference session is being created.");if(l){var n=b.get(l);if(!n){n=qd(0);const t=af(l,n);n=[c++,n,t];b.set(l,n)}d=l;e=n[0];return n}d=void 0;e=0};const g=new Map;f.webgpuOnCreateSession=l=>{if(void 0!==e){var n=e;e=void 0;if(l){const t=md(n);g.set(l,t);0===n&&a(d??Y(t))}d=void 0}};f.webgpuOnReleaseSession=l=>{g.delete(l)};const h=Symbol("gpuBufferMetadata");f.webgpuRegisterBuffer=
(l,n,t)=>{if(t)return l[h]=[t,NaN],t;if(t=l[h])return t[1]++,t[0];n=g.get(n);if(void 0===n)throw Error("Invalid session handle passed to webgpuRegisterBuffer");n=$e(l,n);l[h]=[n,1];return n};f.webgpuUnregisterBuffer=l=>{const n=l[h];if(!n)throw Error("Buffer is not registered");n[1]--;0===n[1]&&(pd(n[0]),delete l[h])};f.webgpuGetBuffer=l=>Y(l);f.webgpuCreateDownloader=(l,n,t)=>{t=g.get(t);if(void 0===t)throw Error("Invalid session handle passed to webgpuRegisterBuffer");const y=Y(t),p=16*Math.ceil(Number(n)/
16);return async()=>{const v=y.createBuffer({size:p,usage:9});try{const z=y.createCommandEncoder();z.copyBufferToBuffer(l,0,v,0,p);y.queue.submit([z.finish()]);await v.mapAsync(GPUMapMode.READ);return v.getMappedRange().slice(0,n)}finally{v.destroy()}}};f.F=(l,n)=>{var t=n.buffer;const y=n.byteOffset,p=n.byteLength;n=16*Math.ceil(Number(p)/16);l=Y(l);if(!d){var v=md(e);d=Y(v)}v=d.createBuffer({mappedAtCreation:!0,size:n,usage:6});const z=v.getMappedRange();(new Uint8Array(z)).set(new Uint8Array(t,
y,p));v.unmap();t=d.createCommandEncoder();t.copyBufferToBuffer(v,0,l,0,n);d.queue.submit([t.finish()]);v.destroy()}};
f.webnnInit=a=>{const b=a[0];[f.V,f.G,f.webnnEnsureTensor,f.H,f.webnnDownloadTensor,f.U,f.webnnEnableTraceEvent]=a.slice(1);f.webnnReleaseTensorId=f.G;f.webnnUploadTensor=f.H;f.webnnRegisterMLContext=f.U;f.webnnOnRunStart=c=>b.onRunStart(c);f.webnnOnRunEnd=b.onRunEnd.bind(b);f.webnnOnReleaseSession=c=>{b.onReleaseSession(c)};f.webnnCreateMLTensorDownloader=(c,d)=>b.createMLTensorDownloader(c,d);f.webnnRegisterMLTensor=(c,d,e,g)=>b.registerMLTensor(c,d,e,g);f.webnnCreateMLContext=c=>b.createMLContext(c);
f.webnnRegisterMLConstant=(c,d,e,g,h,l)=>b.registerMLConstant(c,d,e,g,h,f.o,l);f.webnnRegisterGraphInput=b.registerGraphInput.bind(b);f.webnnIsGraphInput=b.isGraphInput.bind(b);f.webnnRegisterGraphOutput=b.registerGraphOutput.bind(b);f.webnnIsGraphOutput=b.isGraphOutput.bind(b);f.webnnCreateTemporaryTensor=b.createTemporaryTensor.bind(b);f.webnnIsGraphInputOutputTypeSupported=b.isGraphInputOutputTypeSupported.bind(b)};Oa?moduleRtn=f:moduleRtn=new Promise((a,b)=>{va=a;wa=b});
;return moduleRtn}export default ortWasmThreaded;var isPthread=globalThis.self?.name?.startsWith("em-pthread");var isNode=globalThis.process?.versions?.node&&globalThis.process?.type!="renderer";if(isNode)isPthread=(await import("worker_threads")).workerData==="em-pthread";isPthread&&ortWasmThreaded();
