async function ortWasmThreaded(moduleArg={}){var moduleRtn;var g=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}g.mountExternalData=(a,b)=>{a.startsWith("./")&&(a=a.substring(2));(g.o||(g.o=new Map)).set(a,b)};
g.unmountExternalData=()=>{delete g.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=f=>e.push(f);ya=()=>{postMessage({i:"loaded"});for(let f of e)a(f);self.onmessage=a};for(const f of c.K)if(!g[f]||g[f].proxy)g[f]=(...h)=>{postMessage({i:"callHandler",J:f,args:h})},"print"==f&&(pa=g[f]),"printErr"==f&&(q=g[f]);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;g.HEAP8=w=new Int8Array(a);Ka=new Int16Array(a);g.HEAPU8=x=new Uint8Array(a);La=new Uint16Array(a);g.HEAP32=B=new Int32Array(a);g.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:Mb,_emval_new_array:Nb,_emval_new_array_from_memory_view:Ob,_emval_new_cstring:Pb,_emval_new_object:Qb,_emval_run_destructors:Rb,_emval_set_property:Sb,_gmtime_js:Tb,_localtime_js:Ub,_mktime_js:Vb,_mmap_js:Wb,_munmap_js:Xb,_setitimer_js:Yb,_tzset_js:Zb,clock_time_get:$b,emscripten_asm_const_int:ac,emscripten_asm_const_ptr:bc,emscripten_check_blocking_allowed:cc,emscripten_date_now:dc,emscripten_errn:ec,emscripten_exit_with_live_runtime:fc,emscripten_get_heap_max:gc,
emscripten_get_now:hc,emscripten_has_asyncify:ic,emscripten_num_logical_cores:jc,emscripten_pc_get_function:kc,emscripten_resize_heap:lc,emscripten_stack_snapshot:mc,emscripten_stack_unwind_buffer:nc,emwgpuAdapterRequestDevice:oc,emwgpuBufferDestroy:pc,emwgpuBufferGetConstMappedRange:qc,emwgpuBufferGetMappedRange:rc,emwgpuBufferMapAsync:sc,emwgpuBufferUnmap:tc,emwgpuDelete:uc,emwgpuDeviceCreateBuffer:vc,emwgpuDeviceCreateComputePipelineAsync:wc,emwgpuDeviceCreateShaderModule:xc,emwgpuDeviceDestroy:yc,
emwgpuDevicePopErrorScope:zc,emwgpuInstanceRequestAdapter:Ac,emwgpuWaitAny:Bc,environ_get:Cc,environ_sizes_get:Dc,exit:Ec,fd_close:Fc,fd_read:Gc,fd_seek:Hc,fd_write:Ic,memory:u,proc_exit:Jc,wgpuAdapterGetLimits:Kc,wgpuAdapterHasFeature:Lc,wgpuBufferGetSize:Mc,wgpuBufferGetUsage:Nc,wgpuCommandEncoderBeginComputePass:Oc,wgpuCommandEncoderCopyBufferToBuffer:Pc,wgpuCommandEncoderFinish:Qc,wgpuCommandEncoderResolveQuerySet:Rc,wgpuComputePassEncoderDispatchWorkgroups:Sc,wgpuComputePassEncoderDispatchWorkgroupsIndirect:Tc,
wgpuComputePassEncoderEnd:Uc,wgpuComputePassEncoderSetBindGroup:Vc,wgpuComputePassEncoderSetPipeline:Wc,wgpuComputePassEncoderWriteTimestamp:Xc,wgpuComputePipelineGetBindGroupLayout:Yc,wgpuDeviceCreateBindGroup:Zc,wgpuDeviceCreateCommandEncoder:$c,wgpuDeviceCreateQuerySet:ad,wgpuDeviceGetAdapterInfo:bd,wgpuDeviceGetFeatures:cd,wgpuDeviceGetLimits:dd,wgpuDevicePushErrorScope:ed,wgpuQueueSubmit:fd,wgpuQueueWriteBuffer:gd};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 f=/^(OrtAppendExecutionProvider|OrtCreateSession|OrtRun|OrtRunWithBinding|OrtBindInput|main|__main_argc_argv)$/;hd=new Set;var h={};for(let [l,n]of Object.entries(d))"function"==typeof n?(f.test(l)&&(hd.add(n),n=WebAssembly.promising(n)),h[l]=jd(n)):h[l]=n;F=h;F=kd();ld.push(F._emscripten_tls_init);d=F;md=d.__getTypeName;Ga=d._embind_initialize_bindings;g._OrtInit=d.OrtInit;g._OrtGetLastError=d.OrtGetLastError;g._OrtCreateSessionOptions=d.OrtCreateSessionOptions;
g._OrtAppendExecutionProvider=d.OrtAppendExecutionProvider;g._OrtAddFreeDimensionOverride=d.OrtAddFreeDimensionOverride;g._OrtAddSessionConfigEntry=d.OrtAddSessionConfigEntry;g._OrtReleaseSessionOptions=d.OrtReleaseSessionOptions;g._OrtCreateSession=d.OrtCreateSession;g._OrtReleaseSession=d.OrtReleaseSession;g._OrtGetInputOutputCount=d.OrtGetInputOutputCount;g._OrtGetInputOutputMetadata=d.OrtGetInputOutputMetadata;g._OrtFree=d.OrtFree;g._OrtCreateTensor=d.OrtCreateTensor;g._OrtGetTensorData=d.OrtGetTensorData;
g._OrtReleaseTensor=d.OrtReleaseTensor;g._OrtCreateRunOptions=d.OrtCreateRunOptions;g._OrtAddRunConfigEntry=d.OrtAddRunConfigEntry;g._OrtReleaseRunOptions=d.OrtReleaseRunOptions;g._OrtCreateBinding=d.OrtCreateBinding;g._OrtBindInput=d.OrtBindInput;g._OrtBindOutput=d.OrtBindOutput;g._OrtClearBoundOutputs=d.OrtClearBoundOutputs;g._OrtReleaseBinding=d.OrtReleaseBinding;g._OrtRunWithBinding=d.OrtRunWithBinding;g._OrtRun=d.OrtRun;g._OrtEndProfiling=d.OrtEndProfiling;nd=g._OrtGetWebGpuDevice=d.OrtGetWebGpuDevice;
od=d.pthread_self;G=g._free=d.free;pd=g._malloc=d.malloc;qd=g._wgpuBufferRelease=d.wgpuBufferRelease;rd=g._wgpuCreateInstance=d.wgpuCreateInstance;sd=d.emwgpuCreateBindGroup;td=d.emwgpuCreateBindGroupLayout;ud=d.emwgpuCreateCommandBuffer;vd=d.emwgpuCreateCommandEncoder;wd=d.emwgpuCreateComputePassEncoder;xd=d.emwgpuCreateQuerySet;yd=d.emwgpuCreateBuffer;zd=d.emwgpuCreateDevice;Ad=d.emwgpuCreateQueue;Bd=d.emwgpuOnCreateComputePipelineCompleted;Cd=d.emwgpuOnDeviceLostCompleted;Dd=d.emwgpuOnMapAsyncCompleted;
Ed=d.emwgpuOnPopErrorScopeCompleted;Fd=d.emwgpuOnRequestAdapterCompleted;Gd=d.emwgpuOnRequestDeviceCompleted;Hd=d.emwgpuOnUncapturedError;Da=d._emscripten_thread_init;Ja=d._emscripten_thread_crashed;Id=d._emscripten_run_js_on_main_thread;Jd=d._emscripten_thread_free_data;Kd=d._emscripten_thread_exit;Ld=d._emscripten_timeout;Md=d._emscripten_check_mailbox;Nd=d.memalign;Ra=d.__trap;Od=d.emscripten_stack_set_limits;H=d._emscripten_stack_restore;Pd=d._emscripten_stack_alloc;I=d.emscripten_stack_get_current;
Qd=d.__indirect_function_table;ra=e;return F}var b=Wa();if(g.instantiateWasm)return new Promise(d=>{g.instantiateWasm(b,(e,f)=>{d(a(e,f))})});if(m){var c=new WebAssembly.Instance(ra,Wa());return a(c,ra)}Sa??=g.locateFile?g.locateFile?g.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 Rd{name="ExitStatus";constructor(a){this.message=`Program terminated with exit(${a})`;this.status=a}}
var Sd=a=>{a.terminate();a.onmessage=()=>{}},Ud=()=>{for(var a=Td;0<a.length;)a.shift()(g)},Td=[],Vd=0,Wd=null,$d=a=>{0==J.length&&(Xd(),Yd(J[0]));var b=J.pop();if(!b)return 6;Zd.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)=>{var d=16*c.length,e=I(),f=Pd(d),h=f>>>3,l;for(l of c)"bigint"==typeof l?((r(),E)[h++>>>0]=1n,(r(),E)[h++>>>0]=l):((r(),E)[h++>>>0]=0n,(r(),D)[h++>>>0]=l);a=Id(a,0,d,f,b);H(e);return a};
function Jc(a){if(m)return M(0,1,a);ta=a;if(!(0<L)){for(var b of Zd)Sd(b);for(b of J)Sd(b);J=[];Zd=[];K={};sa=!0}ea(a,new Rd(a))}function ae(a){if(m)return M(1,0,a);Ec(a)}var Ec=a=>{ta=a;if(m)throw ae(a),"unwind";Jc(a)},J=[],Zd=[],ld=[],K={};function be(){for(var a=g.numThreads-1;a--;)Xd();Td.push(async()=>{var b=ce();Vd++;await b;Vd--;0==Vd&&Wd&&(b=Wd,Wd=null,b())})}var de=a=>{var b=a.h;delete K[b];J.push(a);Zd.splice(Zd.indexOf(a),1);a.h=0;Jd(b)};function Ea(){ld.forEach(a=>a())}
var Yd=a=>new Promise(b=>{a.onmessage=f=>{var h=f.data;f=h.i;if(h.s&&h.s!=od()){var l=K[h.s];l?l.postMessage(h,h.D):q(`Internal error! Worker sent a message "${f}" to target pthread ${h.s}, but that thread no longer exists!`)}else if("checkMailbox"===f)Ia();else if("spawnThread"===f)$d(h);else if("cleanupThread"===f)ee(()=>{de(K[h.R])});else if("loaded"===f)a.loaded=!0,k&&!a.h&&a.unref(),b(a);else if("setimmediate"===h.target)a.postMessage(h);else if("uncaughtException"===f)a.onerror(h.error);else if("callHandler"===
f)g[h.J](...h.args);else f&&q(`worker sent an unknown command ${f}`)};a.onerror=f=>{q(`${"worker sent an error!"} ${f.filename}:${f.lineno}: ${f.message}`);throw f;};k&&(a.on("message",f=>a.onmessage({data:f})),a.on("error",f=>a.onerror(f)));var c=[],d=[],e;for(e of d)g.propertyIsEnumerable(e)&&c.push(e);a.postMessage({i:"load",K:c,S:u,T:ra})});async function ce(){if(!m)return Promise.all(J.map(Yd))}
function Xd(){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];Od(b,b-a);H(b)}var fe=[],Ha=async(a,b)=>{L=0;var c=WebAssembly,d=c.promising,e=fe[a];e||(fe[a]=e=Qd.get(a),hd?.has(e)&&(fe[a]=e=WebAssembly.promising(e)));a=d.call(c,e)(b);a=await a;0<L?ta=a:Kd(a)},u;function ge(a,b,c,d){return m?M(2,1,a,b,c,d):Za(a,b,c,d)}
var N=a=>-9007199254740992>a||9007199254740992<a?NaN:Number(a);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 ge(a,b,c,d);a={O:c,h:a,u:d,D:e};return m?(a.i="spawnThread",postMessage(a,e),0):$d(a)}
var he=globalThis.TextDecoder&&new TextDecoder,ie=(a,b,c,d)=>{c=b+c;if(d)return c;for(;a[b]&&!(b>=c);)++b;return b},je=(a,b=0,c,d)=>{b>>>=0;c=ie(a,b,c,d);if(16<c-b&&a.buffer&&he)return he.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 f=a[b++]&63;if(192==(e&224))d+=String.fromCharCode((e&31)<<6|f);else{var h=a[b++]&63;e=224==(e&240)?(e&15)<<12|f<<6|h:(e&7)<<18|f<<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},ke=(a,b,c)=>(a>>>=0)?je((r(),x),a,b,c):"";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)}},le={},me={},ne={},oe=class extends Error{constructor(a){super(a);this.name="BindingError"}};
function pe(a,b,c={}){var d=b.name;if(!a)throw new oe(`type "${d}" must have a positive integer typeid pointer`);if(me.hasOwnProperty(a)){if(c.L)return;throw new oe(`Cannot register type '${d}' twice`);}me[a]=b;delete ne[a];le.hasOwnProperty(a)&&(b=le[a],delete le[a],b.forEach(e=>e()))}function P(a,b,c={}){return pe(a,b,c)}
var qe=(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 f=h=>h;if(d){const h=8*c;f=l=>BigInt.asUintN(h,l);e=f(e)}P(a,{name:b,g:f,l:(h,l)=>{"number"==typeof l&&(l=BigInt(l));return l},j:qe(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,f){return f?c:d},j:function(e){return this.g((r(),x)[e>>>0])},m:null})}var re=[],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,re.push(a))}
var R=a=>{if(!a)throw new oe(`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=re.pop()||Q.length;Q[b]=a;Q[b+1]=1;return b}};function se(a){return this.g((r(),C)[a>>>2>>>0])}var te={name:"emscripten::val",g:a=>{var b=R(a);Fb(a);return b},l:(a,b)=>S(b),j:se,m:null};function qb(a){return P(a>>>0,te)}
var ue=(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:ue(b,c),m:null})}function sb(a,b,c,d,e){a>>>=0;c>>>=0;b=O(b>>>0);let f=l=>l;if(0===d){var h=32-8*c;f=l=>l<<h>>>h;e=f(e)}P(a,{name:b,g:f,l:(l,n)=>n,j:qe(b,c,0!==d),m:null})}
function tb(a,b,c){function d(f){var h=(r(),C)[f>>>2>>>0];f=(r(),C)[f+4>>>2>>>0];return new e((r(),w).buffer,f,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 f=0;f<a.length;++f){var h=a.codePointAt(f);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;f++}}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=ke(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 oe("Cannot pass non-string to std::string");var f=e?U(d):d.length;var h=pd(4+f+1),l=h+4;(r(),C)[h>>>2>>>0]=f;e?T(d,l,f+1):(r(),x).set(d,l>>>0);null!==c&&c.push(G,h);return h},j:se,m(c){G(c)}})}
var ve=globalThis.TextDecoder?new TextDecoder("utf-16le"):void 0,we=(a,b,c)=>{a>>>=1;b=ie((r(),La),a,b/2,c);if(16<b-a&&ve)return ve.decode((r(),La).slice(a,b));for(c="";a<b;++a){var d=(r(),La)[a>>>0];c+=String.fromCharCode(d)}return c},xe=(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 f=a.charCodeAt(e);(r(),Ka)[b>>>1>>>0]=f;b+=2}(r(),Ka)[b>>>1>>>0]=0;return b-d},ye=a=>2*a.length,ze=(a,b,c)=>{var d="";a>>>=2;for(var e=0;!(e>=b/4);e++){var f=
(r(),C)[a+e>>>0];if(!f&&!c)break;d+=String.fromCodePoint(f)}return d},Ae=(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 f=a.codePointAt(e);65535<f&&e++;(r(),B)[b>>>2>>>0]=f;b+=4;if(b+4>c)break}(r(),B)[b>>>2>>>0]=0;return b-d},Be=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=we;var e=xe;var f=ye}else d=ze,e=Ae,f=Be;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 oe(`Cannot pass non-string to C++ string type ${c}`);var n=f(l),t=pd(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:se,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 ee=a=>{if(!sa)try{if(a(),!(0<L))try{m?od()&&Kd(ta):Ec(ta)}catch(b){b instanceof Rd||"unwind"==b||ea(1,b)}}catch(b){b instanceof Rd||"unwind"==b||ea(1,b)}},Ce=!Atomics.waitAsync||globalThis.navigator?.userAgent&&91>Number((navigator.userAgent.match(/Chrom(e|ium)\/([0-9]+)\./)||[])[2]);function Fa(a){a>>>=0;Ce||(Atomics.waitAsync((r(),B),a>>>2,a).value.then(Ia),a+=128,Atomics.store((r(),B),a>>>2,1))}var Ia=()=>ee(()=>{var a=od();a&&(Fa(a),Md())});
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 De=[];function zb(a,b,c,d,e){b>>>=0;e>>>=0;De.length=0;c=e>>>3;for(d=e+d>>>3;c<d;){var f;(r(),E)[c++>>>0]?f=(r(),E)[c++>>>0]:f=(r(),D)[c++>>>0];De.push(f)}return(b?Ee[b]:Fe[a])(...De)}var Ab=()=>{L=0};function Bb(a){a>>>=0;m?postMessage({i:"cleanupThread",R:a}):de(K[a])}function Cb(a){k&&K[a>>>0].ref()}function jd(a){return(...b)=>a(...b)}
var hd=null,Ge=async a=>{L+=1;try{return await a()}finally{--L}};function Db(a){a>>>=0;return Ge(async()=>{var b=await R(a);return S(b)})}Db.A=!0;
var He=[],Ie=a=>{var b=He.length;He.push(a);return b},Je=(a,b)=>{for(var c=Array(a),d=0;d<a;++d){var e=d,f=(r(),C)[b+4*d>>>2>>>0],h=me[f];if(void 0===h)throw a=`parameter ${d}`,f=md(f),b=O(f),G(f),new oe(`${a} has unknown type ${b}`);c[e]=h}return c},Ke=(a,b,c)=>{var d=[];a=a(d,c);d.length&&((r(),C)[b>>>2>>>0]=S(d));return a},Le={},Me=a=>{var b=Le[a];return void 0===b?O(a):b};
function Eb(a,b,c){var [d,...e]=Je(a,b>>>0);b=d.l.bind(d);var f=e.map(n=>n.j.bind(n));a--;var h={toValue:R};a=f.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=Me,l="toValue(handle)[getStringOrSymbol(methodName)]"}l+=`(${a})`;d.M||(h.toReturnWire=b,h.emval_returnValue=Ke,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 Ie(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=Me(a);return S(globalThis[a])}function Ib(a){a=Me(a>>>0);return S(g[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 He[a>>>0](b>>>0,c>>>0,d>>>0,e>>>0)}function Mb(a,b,c,d,e){return Lb(a>>>0,b>>>0,c>>>0,d>>>0,e>>>0)}function Nb(){return S([])}function Ob(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 Pb(a){return S(Me(a>>>0))}function Qb(){return S({})}function Rb(a){a>>>=0;for(var b=R(a);b.length;){var c=b.pop();b.pop()(c)}Fb(a)}function Sb(a,b,c){b>>>=0;c>>>=0;a=R(a>>>0);b=R(b);c=R(c);a[b]=c}
function Tb(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 Ne=a=>0===a%4&&(0!==a%100||0===a%400),Oe=[0,31,60,91,121,152,182,213,244,274,305,335],Pe=[0,31,59,90,120,151,181,212,243,273,304,334];
function Ub(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=(Ne(a.getFullYear())?Oe:Pe)[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 Vb(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(),f=(new Date(b.getFullYear(),0,1)).getTimezoneOffset(),h=Math.min(f,e);0>c?(r(),B)[a+32>>>2>>>0]=Number(e!=f&&h==d):0<c!=(h==d)&&(e=Math.max(f,e),b.setTime(b.getTime()+6E4*((0<c?h:e)-d)));(r(),B)[a+24>>>2>>>0]=b.getDay();c=(Ne(b.getFullYear())?
Oe:Pe)[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 Wb(a,b,c,d,e,f,h){return m?M(16,1,a,b,c,d,e,f,h):-52}function Xb(a,b,c,d,e,f){if(m)return M(17,1,a,b,c,d,e,f)}var Qe={},hc=()=>performance.timeOrigin+performance.now();
function Yb(a,b){if(m)return M(18,1,a,b);Qe[a]&&(clearTimeout(Qe[a].id),delete Qe[a]);if(!b)return 0;var c=setTimeout(()=>{delete Qe[a];ee(()=>Ld(a,performance.timeOrigin+performance.now()))},b);Qe[a]={id:c,$:b};return 0}
function Zb(a,b,c,d){a>>>=0;b>>>=0;c>>>=0;d>>>=0;var e=(new Date).getFullYear(),f=(new Date(e,0,1)).getTimezoneOffset();e=(new Date(e,6,1)).getTimezoneOffset();var h=Math.max(f,e);(r(),C)[a>>>2>>>0]=60*h;(r(),B)[b>>>2>>>0]=Number(f!=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(f);b=b(e);e<f?(T(a,c,17),T(b,d,17)):(T(a,d,17),T(b,c,17))}var dc=()=>Date.now(),Re=1;
function $b(a,b,c){c>>>=0;if(!(0<=a&&3>=a))return 28;if(0===a)a=Date.now();else if(Re)a=performance.timeOrigin+performance.now();else return 52;a=Math.round(1E6*a);(r(),E)[c>>>3>>>0]=BigInt(a);return 0}var Se=[],Te=(a,b)=>{Se.length=0;for(var c;c=(r(),x)[a++>>>0];){var d=105!=c;d&=112!=c;b+=d&&b%8?4:0;Se.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 Se};function ac(a,b,c){a>>>=0;b=Te(b>>>0,c>>>0);return Ee[a](...b)}
function bc(a,b,c){a>>>=0;b=Te(b>>>0,c>>>0);return Ee[a](...b)}var cc=()=>{};function ec(a,b){return q(ke(a>>>0,b>>>0))}var fc=()=>{L+=1;throw"unwind";};function gc(){return 4294901760}var ic=()=>2,jc=()=>k?require("os").cpus().length:navigator.hardwareConcurrency,Ue={},Ve=a=>{var b=U(a)+1,c=pd(b);c&&T(a,c,b);return c},We=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},Xe=a=>{for(var b of a)(a=We(b))&&(Ue[a]=b)};
function mc(){var a=Error().stack.toString().split("\n");"Error"==a[0]&&a.shift();Xe(a);Ue.B=We(a[3]);Ue.N=a;return Ue.B}function kc(a){a=Ue[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(kc.C??0);kc.C=Ve(a);return kc.C}
function lc(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(f){}e=void 0}if(e)return!0}return!1}
function nc(a,b,c){a>>>=0;b>>>=0;if(Ue.B==a)var d=Ue.N;else d=Error().stack.toString().split("\n"),"Error"==d[0]&&d.shift(),Xe(d);for(var e=3;d[e]&&We(d[e])!=a;)++e;for(a=0;a<c&&d[a+e];++a)(r(),B)[b+4*a>>>2>>>0]=We(d[a+e]);return a}
var V=a=>{var b=U(a)+1,c=Pd(b);T(a,c,b);return c},Ye=[],W=(a,b)=>{Ye[a>>>=0]=b},X=[],Ze=[],$e=(a,b)=>{Ze[a]=new Promise(c=>b.finally(()=>c(a)))},Y=a=>{if(a)return Ye[a>>>0]},af=(a,b=0)=>{"pending"!=a.mapState||Qa();b=yd(b,"mapped"==a.mapState?3:1);W(b,a);"mapped"==a.mapState&&(X[b]=[]);return b},bf=(a,b=0)=>{var c=Ad(b);b=zd(b,c);W(c,a.queue);W(b,a);return b},cf=(a,b,c)=>{(r(),C)[a>>>2>>>0]=b;(r(),C)[a+4>>>2>>>0]=c},df=a=>{var b=(r(),C)[a>>>2>>>0];a=(r(),C)[a+4>>>2>>>0];return ke(b,a)},Z=a=>{var b=
(r(),C)[a>>>2>>>0];a=(r(),C)[a+4>>>2>>>0];if(b)return ke(b,a);if(0===a)return""},ef=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 f=(r(),C)[a+20>>>2>>>0];if(e){for(var h={},l=0;l<e;++l){var n=f+24*l,t=df(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}},ff=(a,b)=>{function c(e,f){e=a[e];(r(),B)[b+f>>>2>>>0]=e}function d(e,
f){e=a[e];(r(),E)[b+f>>>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)},gf=[,"validation","out-of-memory","internal"],hf=[,"compatibility","core"],jf={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"},kf=[,"low-power","high-performance"],lf=[,"occlusion","timestamp"],mf={undefined:1,unknown:1,
destroyed:2};
function oc(a,b,c,d,e,f){b=N(b);c=N(c);d>>>=0;e>>>=0;f>>>=0;var h=Y(a>>>0);a={};if(f){var l=(r(),C)[f+12>>>2>>>0];if(l){var n=(r(),C)[f+16>>>2>>>0];a.requiredFeatures=Array.from((r(),C).subarray(n>>>2>>>0,n+4*l>>>2>>>0),p=>jf[p])}var t=(r(),C)[f+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],rf=(r(),C)[A+4>>>2>>>0];if(4294967295!=pb||4294967295!=rf)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)[f+24>>>2>>>0])l={label:Z(l+4)},a.defaultQueue=l;a.label=Z(f+4)}L+=1;$e(b,h.requestDevice(a).then(p=>{--L;W(e,p.queue);W(d,p);c&&(L+=1,$e(c,p.lost.then(v=>{--L;p.onuncapturederror=()=>{};var z=I(),A=V(v.message);Cd(c,mf[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);Hd(d,z,v);H(A)};"adapterInfo"in p||(p.adapterInfo=h.info);Gd(b,1,d,0)},p=>{--L;var v=I();p=V(p.message);Gd(b,3,d,p);c&&Cd(c,4,p);H(v)}))}function pc(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 nf=()=>{var a="getMappedRange size=0 no longer means WGPU_WHOLE_MAP_SIZE";nf.v||(nf.v={});nf.v[a]||(nf.v[a]=1,k&&(a="warning: "+a),q(a))};
function qc(a,b,c){a>>>=0;b>>>=0;c>>>=0;var d=Y(a);0===c&&nf();4294967295==c&&(c=void 0);try{var e=d.getMappedRange(b,c)}catch(h){return 0}var f=Nd(16,e.byteLength);(r(),x).set(new Uint8Array(e),f>>>0);X[a].push(()=>G(f));return f}
function rc(a,b,c){a>>>=0;b>>>=0;c>>>=0;var d=Y(a);0===c&&nf();4294967295==c&&(c=void 0);try{var e=d.getMappedRange(b,c)}catch(h){return 0}var f=Nd(16,e.byteLength);(r(),x).fill(0,f,e.byteLength);X[a].push(()=>{(new Uint8Array(e)).set((r(),x).subarray(f>>>0,f+e.byteLength>>>0));G(f)});return f}
function sc(a,b,c,d,e){a>>>=0;b=N(b);c=N(c);e>>>=0;var f=Y(a);X[a]=[];4294967295==e&&(e=void 0);L+=1;$e(b,f.mapAsync(c,d>>>0,e).then(()=>{--L;Dd(b,1,0)},h=>{--L;I();var l=V(h.message);Dd(b,"AbortError"===h.name?4:"OperationError"===h.name?3:0,l);delete X[a]}))}function tc(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 uc(a){delete Ye[a>>>0]}
function vc(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(f){return!1}W(c,e);d&&(X[c]=[]);return!0}
function wc(a,b,c,d){a>>>=0;b=N(b);d>>>=0;c=ef(c>>>0);a=Y(a);L+=1;$e(b,a.createComputePipelineAsync(c).then(e=>{--L;W(d,e);Bd(b,1,d,0)},e=>{--L;var f=I(),h=V(e.message);Bd(b,"validation"===e.reason?3:"internal"===e.reason?4:0,d,h);H(f)}))}function xc(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=df(d+8)}W(c,Y(a).createShaderModule(b))}var yc=a=>{a=Y(a);a.onuncapturederror=null;a.destroy()};
function zc(a,b){b=N(b);a=Y(a>>>0);L+=1;$e(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;Ed(b,1,d,c);H(e)},c=>{--L;var d=I();c=V(c.message);Ed(b,1,5,c);H(d)}))}
function Ac(a,b,c,d){b=N(b);c>>>=0;d>>>=0;if(c){var e=(r(),C)[c+4>>>2>>>0];e={featureLevel:hf[e],powerPreference:kf[(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,$e(b,navigator.gpu.requestAdapter(e).then(f=>{--L;if(f)W(d,f),Fd(b,1,d,0);else{f=I();var h=V("WebGPU not available on this browser (requestAdapter returned null)");Fd(b,3,d,h);H(f)}},f=>{--L;var h=I();f=V(f.message);Fd(b,4,d,f);H(h)}))):
(c=I(),e=V("WebGPU not available on this browser (navigator.gpu is not available)"),Fd(b,3,d,e),H(c))}function Bc(a,b,c){a>>>=0;b>>>=0;c>>>=0;return Ge(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 f=0;f<b;++f){var h=4294967296*(r(),C)[a+8*f+4>>>2>>>0]+(r(),C)[a+8*f>>>2>>>0];if(!(h in Ze))return h;d[f]=Ze[h]}d=await Promise.race(d);delete Ze[d];return d})}Bc.A=!0;
var of={},qf=()=>{if(!pf){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 of)void 0===of[b]?delete a[b]:a[b]=of[b];var c=[];for(b in a)c.push(`${b}=${a[b]}`);pf=c}return pf},pf;function Cc(a,b){if(m)return M(19,1,a,b);a>>>=0;b>>>=0;var c=0,d=0,e;for(e of qf()){var f=b+c;(r(),C)[a+d>>>2>>>0]=f;c+=T(e,f,Infinity)+1;d+=4}return 0}
function Dc(a,b){if(m)return M(20,1,a,b);a>>>=0;b>>>=0;var c=qf();(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 Fc(a){return m?M(21,1,a):52}function Gc(a,b,c,d){return m?M(22,1,a,b,c,d):52}function Hc(a,b,c,d){return m?M(23,1,a,b,c,d):70}var sf=[null,[],[]];
function Ic(a,b,c,d){if(m)return M(24,1,a,b,c,d);b>>>=0;c>>>=0;d>>>=0;for(var e=0,f=0;f<c;f++){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=sf[t];0===y||10===y?((1===t?pa:q)(je(p)),p.length=0):p.push(y)}e+=l}(r(),C)[d>>>2>>>0]=e;return 0}function Kc(a,b){ff(Y(a>>>0).limits,b>>>0);return 1}function Lc(a,b){return Y(a>>>0).features.has(jf[b])}function Mc(a){return BigInt(Y(a>>>0).size)}function Nc(a){return BigInt(Y(a>>>0).usage)}
function Oc(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=wd(0);W(b,a.beginComputePass(c));return b}function Pc(a,b,c,d,e,f){c=N(c);e=N(e);f=N(f);Y(a>>>0).copyBufferToBuffer(Y(b>>>0),c,Y(d>>>0),e,f)}function Qc(a){a=Y(a>>>0);var b=ud(0);W(b,a.finish());return b}
function Rc(a,b,c,d,e,f){f=N(f);Y(a>>>0).resolveQuerySet(Y(b>>>0),c,d,Y(e>>>0),f)}function Sc(a,b,c,d){Y(a>>>0).dispatchWorkgroups(b,c,d)}function Tc(a,b,c){c=N(c);Y(a>>>0).dispatchWorkgroupsIndirect(Y(b>>>0),c)}function Uc(a){Y(a>>>0).end()}function Vc(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 Wc(a,b){Y(a>>>0).setPipeline(Y(b>>>0))}function Xc(a,b,c){Y(a>>>0).aa(Y(b>>>0),c)}
function Yc(a,b){a=Y(a>>>0);var c=td(0);W(c,a.getBindGroupLayout(b));return c}
function Zc(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 f=[],h=0;h<e;++h){var l=f,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:f};a=Y(a);d=sd(0);W(d,a.createBindGroup(c));return d}function $c(a,b){a>>>=0;b>>>=0;var c;b&&(c={label:Z(b+4)});a=Y(a);b=vd(0);W(b,a.createCommandEncoder(c));return b}function ad(a,b){a>>>=0;b>>>=0;b={type:lf[(r(),C)[b+12>>>2>>>0]],count:(r(),C)[b+16>>>2>>>0]};a=Y(a);var c=xd(0);W(c,a.createQuerySet(b));return c}
function bd(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=Ve(a.vendor+a.architecture+a.device+a.description),d=U(a.vendor);cf(b+4,c,d);c+=d;d=U(a.architecture);cf(b+12,c,d);c+=d;d=U(a.device);cf(b+20,c,d);cf(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 tf={"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 cd(a,b){b>>>=0;a=Y(a>>>0);var c=pd(4*a.features.size),d=0,e=0;a.features.forEach(f=>{f=tf[f];0<=f&&((r(),B)[c+d>>>2>>>0]=f,d+=4,e++)});(r(),C)[b+4>>>2>>>0]=c;(r(),C)[b>>>2>>>0]=e}function dd(a,b){ff(Y(a>>>0).limits,b>>>0);return 1}function ed(a,b){Y(a>>>0).pushErrorScope(gf[b])}
function fd(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 gd(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||be();m||(u=new WebAssembly.Memory({initial:256,maximum:65536,shared:!0}),ua());g.wasmBinary&&(qa=g.wasmBinary);g.stackSave=()=>I();g.stackRestore=a=>H(a);g.stackAlloc=a=>Pd(a);
g.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}`)}};
g.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}`)}};g.UTF8ToString=ke;g.stringToUTF8=T;g.lengthBytesUTF8=U;
var Fe=[Jc,ae,ge,$a,ab,bb,cb,db,eb,fb,gb,hb,ib,jb,kb,lb,Wb,Xb,Yb,Cc,Dc,Fc,Gc,Hc,Ic],Ee={1127952:(a,b,c,d,e)=>{if("undefined"==typeof g||!g.o)return 1;a=ke(Number(a>>>0));a.startsWith("./")&&(a=a.substring(2));a=g.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 f=a.subarray(b,b+c);switch(e){case 0:(r(),x).set(f,d>>>0);break;case 1:g.F?g.F(d,f):g.X(d,f);break;default:return 4}return 0}catch{return 4}},1128776:(a,b,c)=>{g.H(a,(r(),x).subarray(b>>>
0,b+c>>>0))},1128840:()=>g.V(),1128882:a=>{g.G(a)},1128919:()=>"undefined"!==typeof wasmOffsetConverter};function Ya(){return"undefined"!==typeof wasmOffsetConverter}var md,Ga,nd,od,G,pd,qd,rd,sd,td,ud,vd,wd,xd,yd,zd,Ad,Bd,Cd,Dd,Ed,Fd,Gd,Hd,Da,Ja,Id,Jd,Kd,Ld,Md,Nd,Ra,Od,H,Pd,I,Qd,Xa;
function kd(){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,f)=>d(e,f)>>>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<Vd?Wd=Ba:m?(va?.(g),Pa()):(Ud(),0<Vd?Wd=Ba:async function(){g.calledRun=!0;sa||(Pa(),va?.(g))}())}var F;m||(F=await (Aa()),Ba());
g.PTR_SIZE=4;
g.webgpuInit=a=>{const b=new WeakMap;let c=1,d=void 0,e=void 0;g.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=rd(0);const t=bf(l,n);n=[c++,n,t];b.set(l,n)}d=l;e=n[0];return n}d=void 0;e=0};const f=new Map;g.webgpuOnCreateSession=l=>{if(void 0!==e){var n=e;e=void 0;if(l){const t=nd(n);f.set(l,t);0===n&&a(d??Y(t))}d=void 0}};g.webgpuOnReleaseSession=l=>{f.delete(l)};const h=Symbol("gpuBufferMetadata");g.webgpuRegisterBuffer=
(l,n,t)=>{if(t)return l[h]=[t,NaN],t;if(t=l[h])return t[1]++,t[0];n=f.get(n);if(void 0===n)throw Error("Invalid session handle passed to webgpuRegisterBuffer");n=af(l,n);l[h]=[n,1];return n};g.webgpuUnregisterBuffer=l=>{const n=l[h];if(!n)throw Error("Buffer is not registered");n[1]--;0===n[1]&&(qd(n[0]),delete l[h])};g.webgpuGetBuffer=l=>Y(l);g.webgpuCreateDownloader=(l,n,t)=>{t=f.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()}}};g.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=nd(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()}};
g.webnnInit=a=>{const b=a[0];[g.V,g.G,g.webnnEnsureTensor,g.H,g.webnnDownloadTensor,g.U,g.webnnEnableTraceEvent]=a.slice(1);g.webnnReleaseTensorId=g.G;g.webnnUploadTensor=g.H;g.webnnRegisterMLContext=g.U;g.webnnOnRunStart=c=>b.onRunStart(c);g.webnnOnRunEnd=b.onRunEnd.bind(b);g.webnnOnReleaseSession=c=>{b.onReleaseSession(c)};g.webnnCreateMLTensorDownloader=(c,d)=>b.createMLTensorDownloader(c,d);g.webnnRegisterMLTensor=(c,d,e,f)=>b.registerMLTensor(c,d,e,f);g.webnnCreateMLContext=c=>b.createMLContext(c);
g.webnnRegisterMLConstant=(c,d,e,f,h,l)=>b.registerMLConstant(c,d,e,f,h,g.o,l);g.webnnRegisterGraphInput=b.registerGraphInput.bind(b);g.webnnIsGraphInput=b.isGraphInput.bind(b);g.webnnRegisterGraphOutput=b.registerGraphOutput.bind(b);g.webnnIsGraphOutput=b.isGraphOutput.bind(b);g.webnnCreateTemporaryTensor=b.createTemporaryTensor.bind(b);g.webnnIsGraphInputOutputTypeSupported=b.isGraphInputOutputTypeSupported.bind(b)};Oa?moduleRtn=g: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();
