async function ortWasmThreaded(moduleArg={}){var moduleRtn;var g=moduleArg,aa=!!globalThis.window,ba=!!globalThis.WorkerGlobalScope,l=globalThis.process?.versions?.node&&"renderer"!=globalThis.process?.type,n=ba&&self.name?.startsWith("em-pthread");if(l){const {createRequire:a}=await import("module");var require=a(import.meta.url),ca=require("worker_threads");global.Worker=ca.Worker;n=(ba=!ca.He)&&"em-pthread"==ca.workerData}g.mountExternalData=(a,b)=>{a.startsWith("./")&&(a=a.substring(2));(g.Yc||(g.Yc=new Map)).set(a,b)};
g.unmountExternalData=()=>{delete g.Yc};var SharedArrayBuffer=globalThis.SharedArrayBuffer??(new WebAssembly.Memory({initial:0,maximum:0,Ke:!0})).buffer.constructor;
let ea=()=>{const a=b=>(...c)=>{const d=r;c=b(...c);return r!=d?da():c};(b=>{for(const c of b)g[c]=a(g[c])})(["_OrtAppendExecutionProvider","_OrtCreateSession","_OrtRun","_OrtRunWithBinding","_OrtBindInput"]);"undefined"!==typeof jsepRunAsync&&(g._OrtRun=jsepRunAsync(g._OrtRun),g._OrtRunWithBinding=jsepRunAsync(g._OrtRunWithBinding));ea=void 0};g.asyncInit=()=>{ea?.()};var fa="./this.program",ha=(a,b)=>{throw b;},ia=import.meta.url,ja="",ka,la;
if(l){var fs=require("fs");ia.startsWith("file:")&&(ja=require("path").dirname(require("url").fileURLToPath(ia))+"/");la=a=>{a=ma(a)?new URL(a):a;return fs.readFileSync(a)};ka=async a=>{a=ma(a)?new URL(a):a;return fs.readFileSync(a,void 0)};1<process.argv.length&&(fa=process.argv[1].replace(/\\/g,"/"));process.argv.slice(2);ha=(a,b)=>{process.exitCode=a;throw b;}}else if(aa||ba){try{ja=(new URL(".",ia)).href}catch{}l||(ba&&(la=a=>{var b=new XMLHttpRequest;b.open("GET",a,!1);b.responseType="arraybuffer";
b.send(null);return new Uint8Array(b.response)}),ka=async a=>{if(ma(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 na=console.log.bind(console),oa=console.error.bind(console);
if(l){var pa=require("util"),qa=a=>"object"==typeof a?pa.inspect(a):a;na=(...a)=>fs.writeSync(1,a.map(qa).join(" ")+"\n");oa=(...a)=>fs.writeSync(2,a.map(qa).join(" ")+"\n")}var ra=na,t=oa,sa,ta,ua=!1,va,ma=a=>a.startsWith("file://");function u(){v.buffer!=w.buffer&&wa()}var xa,ya;
if(l&&n){var Aa=ca.parentPort;Aa.on("message",a=>global.onmessage?.({data:a}));Object.assign(globalThis,{self:global,postMessage:a=>Aa.postMessage(a)});process.on("uncaughtException",a=>{postMessage({Tc:"uncaughtException",error:a});process.exit(1)})}var Ba;
if(n){var Ca=!1;self.onunhandledrejection=b=>{throw b.reason||b;};function a(b){try{var c=b.data,d=c.Tc;if("load"===d){let e=[];self.onmessage=f=>e.push(f);Ba=()=>{postMessage({Tc:"loaded"});for(let f of e)a(f);self.onmessage=a};for(const f of c.ke)if(!g[f]||g[f].proxy)g[f]=(...h)=>{postMessage({Tc:"callHandler",je:f,args:h})},"print"==f&&(ra=g[f]),"printErr"==f&&(t=g[f]);v=c.te;wa();ta=c.ue;Da();Ea()}else if("run"===d){Fa(c.Rc);Ga(c.Rc,0,0,1,0,0);Ha();Ia(c.Rc);Ca||(Ja(),Ca=!0);try{Ka(c.qe,c.$c)}catch(e){if("unwind"!=
e)throw e;}}else"setimmediate"!==c.target&&("checkMailbox"===d?Ca&&La():d&&(t(`worker: received unknown command ${d}`),t(c)))}catch(e){throw Ma(),e;}}self.onmessage=a}var w,x,Na,Oa,B,C,Pa,E,F,Qa,Ra=!1;function wa(){var a=v.buffer;g.HEAP8=w=new Int8Array(a);Na=new Int16Array(a);g.HEAPU8=x=new Uint8Array(a);Oa=new Uint16Array(a);g.HEAP32=B=new Int32Array(a);g.HEAPU32=C=new Uint32Array(a);Pa=new Float32Array(a);E=new Float64Array(a);F=new BigInt64Array(a);Qa=new BigUint64Array(a)}
function Sa(){Ra=!0;n?Ba():G.cc()}function H(a){a="Aborted("+a+")";t(a);ua=!0;a=new WebAssembly.RuntimeError(a+". Build with -sASSERTIONS for more info.");ya?.(a);throw a;}var Ta;async function Ua(a){if(!sa)try{var b=await ka(a);return new Uint8Array(b)}catch{}if(a==Ta&&sa)a=new Uint8Array(sa);else if(la)a=la(a);else throw"both async and sync fetching of the wasm failed";return a}
async function Va(a,b){try{var c=await Ua(a);return await WebAssembly.instantiate(c,b)}catch(d){t(`failed to asynchronously prepare wasm: ${d}`),H(d)}}async function Wa(a){var b=Ta;if(!sa&&!ma(b)&&!l)try{var c=fetch(b,{credentials:"same-origin"});return await WebAssembly.instantiateStreaming(c,a)}catch(d){t(`wasm streaming compile failed: ${d}`),t("falling back to ArrayBuffer instantiation")}return Va(b,a)}
function Xa(){Ya={ra:Za,g:$a,K:ab,f:bb,n:cb,i:db,va:eb,b:fb,da:gb,Ha:hb,o:ib,ea:jb,Xa:kb,_b:lb,ac:mb,Ya:nb,Va:ob,Oa:pb,Ua:qb,pa:rb,$b:sb,Yb:tb,Wa:ub,Zb:vb,bb:wb,Da:xb,Tb:yb,Rb:zb,Ca:Bb,P:Cb,I:Eb,Sb:Fb,la:Gb,Ub:Hb,Ra:Ib,Wb:Jb,Ia:Kb,Ob:Lb,Fa:Mb,Qa:Ia,_a:Nb,V:Ob,r:Pb,c:Qb,rb:Rb,y:Sb,N:Tb,C:Ub,m:Vb,s:Wb,sb:Wb,J:Xb,U:Yb,j:Zb,u:$b,q:ac,k:bc,La:cc,Ma:dc,Na:ec,Ja:fc,Ka:gc,Pb:hc,db:ic,ab:jc,_:kc,qb:lc,ma:mc,$a:nc,X:oc,Za:pc,Xb:qc,G:rc,gb:sc,Z:tc,qa:uc,Vb:vc,fb:wc,eb:xc,nb:yc,E:zc,ua:Ac,ta:Bc,pb:Cc,Y:Dc,w:Ec,
mb:Fc,lb:Gc,kb:Hc,ob:Ic,jb:Jc,ib:Kc,hb:Lc,Sa:Mc,Ta:Nc,Ga:Oc,fa:Pc,oa:Qc,Pa:Rc,na:Sc,Cb:Tc,ya:Uc,Db:Vc,za:Wc,H:Xc,e:Yc,t:Zc,x:$c,A:ad,Hb:bd,L:cd,v:dd,Aa:ed,ba:fd,ia:gd,Eb:hd,Fb:jd,Gb:kd,Ba:ld,Jb:md,O:nd,ca:od,d:pd,B:qd,l:rd,Bb:sd,p:td,z:ud,D:vd,F:wd,M:xd,Kb:yd,T:zd,ja:Ad,aa:Bd,Lb:Cd,Mb:Dd,h:Ed,a:v,cb:Fd,Ib:Gd,ka:Hd,Q:Id,sa:Jd,Nb:Kd,R:Ld,yb:Md,zb:Nd,wa:Od,ga:Pd,S:Qd,Ea:Rd,xa:Sd,$:Td,wb:Ud,bc:Vd,W:Wd,Ab:Xd,tb:Yd,ub:Zd,vb:$d,ha:ae,xb:be,Qb:ce};return{a:Ya}}
async function Da(){function a(d,e){var f=G=d.exports;d={};for(let [h,k]of Object.entries(f))"function"==typeof k?(f=de(k),d[h]=f):d[h]=k;G=d;G=ee();fe.push(G.ld);d=G;ge=d.dc;Ja=d.ec;g._OrtInit=d.fc;g._OrtGetLastError=d.gc;g._OrtCreateSessionOptions=d.hc;g._OrtAppendExecutionProvider=d.ic;g._OrtAddFreeDimensionOverride=d.jc;g._OrtAddSessionConfigEntry=d.kc;g._OrtReleaseSessionOptions=d.lc;g._OrtCreateSession=d.mc;g._OrtReleaseSession=d.nc;g._OrtGetInputOutputCount=d.oc;g._OrtGetInputOutputMetadata=
d.pc;g._OrtFree=d.qc;g._OrtCreateTensor=d.rc;g._OrtGetTensorData=d.sc;g._OrtReleaseTensor=d.tc;g._OrtCreateRunOptions=d.uc;g._OrtAddRunConfigEntry=d.vc;g._OrtReleaseRunOptions=d.wc;g._OrtCreateBinding=d.xc;g._OrtBindInput=d.yc;g._OrtBindOutput=d.zc;g._OrtClearBoundOutputs=d.Ac;g._OrtReleaseBinding=d.Bc;g._OrtRunWithBinding=d.Cc;g._OrtRun=d.Dc;g._OrtEndProfiling=d.Ec;he=g._OrtGetWebGpuDevice=d.Fc;ie=d.Gc;I=g._free=d.Hc;je=g._malloc=d.Ic;ke=g._wgpuBufferRelease=d.Jc;le=g._wgpuCreateInstance=d.Kc;me=
d.Lc;ne=d.Mc;oe=d.Nc;pe=d.Oc;qe=d.Pc;re=d.Sc;se=d.ad;te=d.bd;ue=d.cd;ve=d.ed;we=d.fd;xe=d.gd;ye=d.hd;ze=d.id;Ae=d.jd;Be=d.kd;Ga=d.nd;Ma=d.od;Ce=d.pd;De=d.qd;Ee=d.rd;Fe=d.sd;Ge=d.td;He=d.ud;J=d.vd;Ie=d.wd;Je=d.xd;K=d.yd;Ke=d.zd;L=d.Ad;Le=d.Bd;Me=d.Cd;Ne=d.Dd;Oe=d.Ed;dynCall_vii=d.Fd;Pe=d.Gd;dynCall_v=d.Hd;Qe=d.Id;Re=d.Jd;Se=d.Kd;dynCall_iii=d.Ld;Te=d.Md;Ue=d.Nd;Ve=d.Od;dynCall_vi=d.Pd;We=d.Qd;Xe=d.Rd;Ye=d.Sd;Ze=d.Td;$e=d.Ud;af=d.Vd;bf=d.Xd;cf=d.Yd;df=d.Zd;ef=d._d;ff=d.ae;gf=d.be;hf=d.ce;jf=d.de;kf=
d.ne;lf=d.se;mf=d.ve;nf=d.we;of=d.xe;pf=d.ye;qf=d.ze;rf=d.Ae;sf=d.Be;tf=d.Ce;uf=d.De;vf=d.Ee;wf=d.df;xf=d.ef;yf=d.ff;zf=d.gf;ta=e;return G}var b=Xa();if(g.instantiateWasm)return new Promise(d=>{g.instantiateWasm(b,(e,f)=>{d(a(e,f))})});if(n){var c=new WebAssembly.Instance(ta,Xa());return a(c,ta)}Ta??=g.locateFile?g.locateFile?g.locateFile("ort-wasm-simd-threaded.asyncify.wasm",ja):ja+"ort-wasm-simd-threaded.asyncify.wasm":(new URL("ort-wasm-simd-threaded.asyncify.wasm",import.meta.url)).href;
return function(d){return a(d.instance,d.module)}(await Wa(b))}class Af{name="ExitStatus";constructor(a){this.message=`Program terminated with exit(${a})`;this.status=a}}
var Bf=a=>{a.terminate();a.onmessage=()=>{}},Cf=[],Df=0,Ef=null,Kf=a=>{0==Ff.length&&(Gf(),Hf(Ff[0]));var b=Ff.pop();if(!b)return 6;If.push(b);Jf[a.Rc]=b;b.Rc=a.Rc;var c={Tc:"run",qe:a.pe,$c:a.$c,Rc:a.Rc};l&&b.unref();b.postMessage(c,a.ee);return 0},M=0,N=(a,b,...c)=>{for(var d=2*c.length,e=L(),f=Ke(8*d),h=f>>>3,k=0;k<c.length;k++){var m=c[k];"bigint"==typeof m?((u(),F)[h+2*k>>>0]=1n,(u(),F)[h+2*k+1>>>0]=m):((u(),F)[h+2*k>>>0]=0n,(u(),E)[h+2*k+1>>>0]=m)}a=Ce(a,0,d,f,b);K(e);return a};
function Fd(a){if(n)return N(0,1,a);va=a;if(!(0<M)){for(var b of If)Bf(b);for(b of Ff)Bf(b);Ff=[];If=[];Jf={};ua=!0}ha(a,new Af(a))}function Lf(a){if(n)return N(1,0,a);Oc(a)}var Oc=a=>{va=a;if(n)throw Lf(a),"unwind";Fd(a)},Ff=[],If=[],fe=[],Jf={};function Mf(){for(var a=g.numThreads-1;a--;)Gf();Cf.push(async()=>{var b=Nf();Df++;await b;Df--;0==Df&&Ef&&(b=Ef,Ef=null,b())})}var Of=a=>{var b=a.Rc;delete Jf[b];Ff.push(a);If.splice(If.indexOf(a),1);a.Rc=0;De(b)};function Ha(){fe.forEach(a=>a())}
var Hf=a=>new Promise(b=>{a.onmessage=f=>{var h=f.data;f=h.Tc;if(h.Zc&&h.Zc!=ie()){var k=Jf[h.Zc];k?k.postMessage(h,h.ee):t(`Internal error! Worker sent a message "${f}" to target pthread ${h.Zc}, but that thread no longer exists!`)}else if("checkMailbox"===f)La();else if("spawnThread"===f)Kf(h);else if("cleanupThread"===f)Pf(()=>{Of(Jf[h.re])});else if("loaded"===f)a.loaded=!0,l&&!a.Rc&&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.je](...h.args);else f&&t(`worker sent an unknown command ${f}`)};a.onerror=f=>{t(`${"worker sent an error!"} ${f.filename}:${f.lineno}: ${f.message}`);throw f;};l&&(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({Tc:"load",ke:c,te:v,ue:ta})});async function Nf(){if(!n)return Promise.all(Ff.map(Hf))}
function Gf(){var a=new Worker(new URL(import.meta.url),{type:"module",workerData:"em-pthread",name:"em-pthread"});Ff.push(a)}function Fa(a){var b=(u(),C)[a+52>>>2>>>0];a=(u(),C)[a+56>>>2>>>0];Je(b,b-a);K(b)}
var Ka=(a,b)=>{M=0;a=Pe(a,b);0<M?va=a:Ee(a)},v,O=a=>-9007199254740992>a||9007199254740992<a?NaN:Number(a),Qf=globalThis.TextDecoder&&new TextDecoder,Rf=(a,b,c,d)=>{c=b+c;if(d)return c;for(;a[b]&&!(b>=c);)++b;return b},Sf=(a,b=0,c,d)=>{b>>>=0;c=Rf(a,b,c,d);if(16<c-b&&a.buffer&&Qf)return Qf.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},Tf=(a,b,c)=>(a>>>=0)?Sf((u(),x),a,b,c):"",Uf=[],Vf=0;function $a(a){a>>>=0;var b=new Wf(a);0==(u(),w)[b.Uc+12>>>0]&&(Xf(b,!0),Vf--);Yf(b,!1);Uf.push(b);Me(a);return Oe(a)}var Zf=0,ab=()=>{J(0,0);var a=Uf.pop();Le(a.md);Zf=0};function Xf(a,b){b=b?1:0;(u(),w)[a.Uc+12>>>0]=b}
function Yf(a,b){b=b?1:0;(u(),w)[a.Uc+13>>>0]=b}class Wf{constructor(a){this.md=a;this.Uc=a-24}}var $f=a=>{var b=Zf;if(!b)return Ie(0),0;var c=new Wf(b);(u(),C)[c.Uc+16>>>2>>>0]=b;var d=(u(),C)[c.Uc+4>>>2>>>0];if(!d)return Ie(0),b;for(var e of a){if(0===e||e===d)break;if(Ne(e,d,c.Uc+16))return Ie(e),b}Ie(d);return b};function bb(){return $f([])}function cb(a){return $f([a>>>0])}function db(a,b,c,d){return $f([a>>>0,b>>>0,c>>>0,d>>>0])}
var eb=()=>{var a=Uf.pop();a||H("no exception to throw");var b=a.md;0==(u(),w)[a.Uc+13>>>0]&&(Uf.push(a),Yf(a,!0),Xf(a,!1),Vf++);Zf=b;throw Zf;};function fb(a,b,c){a>>>=0;var d=new Wf(a);b>>>=0;c>>>=0;(u(),C)[d.Uc+16>>>2>>>0]=0;(u(),C)[d.Uc+4>>>2>>>0]=b;(u(),C)[d.Uc+8>>>2>>>0]=c;Zf=a;Vf++;throw Zf;}var gb=()=>Vf;function ag(a,b,c,d){return n?N(2,1,a,b,c,d):hb(a,b,c,d)}
function hb(a,b,c,d){a>>>=0;b>>>=0;c>>>=0;d>>>=0;if(!globalThis.SharedArrayBuffer)return 6;var e=[];if(n&&0===e.length)return ag(a,b,c,d);a={pe:c,Rc:a,$c:d,ee:e};return n?(a.Tc="spawnThread",postMessage(a,e),0):Kf(a)}function ib(a){Zf||=a>>>0;throw Zf;}function jb(a,b,c){return n?N(3,1,a,b,c):0}function kb(a,b){if(n)return N(4,1,a,b)}function lb(a,b){if(n)return N(5,1,a,b)}function mb(a,b,c){if(n)return N(6,1,a,b,c)}function nb(a,b,c){return n?N(7,1,a,b,c):0}
function ob(a,b){if(n)return N(8,1,a,b)}function pb(a,b,c){if(n)return N(9,1,a,b,c)}function qb(a,b,c,d){if(n)return N(10,1,a,b,c,d)}function rb(a,b,c,d){if(n)return N(11,1,a,b,c,d)}function sb(a,b,c,d){if(n)return N(12,1,a,b,c,d)}function tb(a){if(n)return N(13,1,a)}function ub(a,b){if(n)return N(14,1,a,b)}function vb(a,b,c){if(n)return N(15,1,a,b,c)}
var wb=()=>H(""),P=a=>{a>>>=0;for(var b="";;){var c=(u(),x)[a++>>>0];if(!c)return b;b+=String.fromCharCode(c)}},bg={},cg={},dg={},eg=class extends Error{constructor(a){super(a);this.name="BindingError"}};function fg(a,b,c={}){var d=b.name;if(!a)throw new eg(`type "${d}" must have a positive integer typeid pointer`);if(cg.hasOwnProperty(a)){if(c.le)return;throw new eg(`Cannot register type '${d}' twice`);}cg[a]=b;delete dg[a];bg.hasOwnProperty(a)&&(b=bg[a],delete bg[a],b.forEach(e=>e()))}
function Q(a,b,c={}){return fg(a,b,c)}var gg=(a,b,c)=>{switch(b){case 1:return c?d=>(u(),w)[d>>>0]:d=>(u(),x)[d>>>0];case 2:return c?d=>(u(),Na)[d>>>1>>>0]:d=>(u(),Oa)[d>>>1>>>0];case 4:return c?d=>(u(),B)[d>>>2>>>0]:d=>(u(),C)[d>>>2>>>0];case 8:return c?d=>(u(),F)[d>>>3>>>0]:d=>(u(),Qa)[d>>>3>>>0];default:throw new TypeError(`invalid integer width (${b}): ${a}`);}};
function xb(a,b,c,d,e){a>>>=0;c>>>=0;b=P(b>>>0);d=0n===d;let f=h=>h;if(d){const h=8*c;f=k=>BigInt.asUintN(h,k);e=f(e)}Q(a,{name:b,Qc:f,Wc:(h,k)=>{"number"==typeof k&&(k=BigInt(k));return k},Vc:gg(b,c,!d),Xc:null})}function yb(a,b,c,d){a>>>=0;b=P(b>>>0);Q(a,{name:b,Qc:function(e){return!!e},Wc:function(e,f){return f?c:d},Vc:function(e){return this.Qc((u(),x)[e>>>0])},Xc:null})}var hg=[],ig=[0,1,,1,null,1,!0,1,!1,1];function Qb(a){a>>>=0;9<a&&0===--ig[a+1]&&(ig[a]=void 0,hg.push(a))}
var R=a=>{if(!a)throw new eg(`Cannot use deleted val. handle = ${a}`);return ig[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=hg.pop()||ig.length;ig[b]=a;ig[b+1]=1;return b}};function jg(a){return this.Qc((u(),C)[a>>>2>>>0])}var kg={name:"emscripten::val",Qc:a=>{var b=R(a);Qb(a);return b},Wc:(a,b)=>S(b),Vc:jg,Xc:null};function zb(a){return Q(a>>>0,kg)}
var lg=(a,b)=>{switch(b){case 4:return function(c){return this.Qc((u(),Pa)[c>>>2>>>0])};case 8:return function(c){return this.Qc((u(),E)[c>>>3>>>0])};default:throw new TypeError(`invalid float width (${b}): ${a}`);}};function Bb(a,b,c){a>>>=0;c>>>=0;b=P(b>>>0);Q(a,{name:b,Qc:d=>d,Wc:(d,e)=>e,Vc:lg(b,c),Xc:null})}function Cb(a,b,c,d,e){a>>>=0;c>>>=0;b=P(b>>>0);let f=k=>k;if(0===d){var h=32-8*c;f=k=>k<<h>>>h;e=f(e)}Q(a,{name:b,Qc:f,Wc:(k,m)=>m,Vc:gg(b,c,0!==d),Xc:null})}
function Eb(a,b,c){function d(f){var h=(u(),C)[f>>>2>>>0];f=(u(),C)[f+4>>>2>>>0];return new e((u(),w).buffer,f,h)}a>>>=0;var e=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array,BigInt64Array,BigUint64Array][b];c=P(c>>>0);Q(a,{name:c,Qc:d,Vc:d},{le:!0})}
var T=(a,b,c)=>{var d=(u(),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 Fb(a,b){a>>>=0;b=P(b>>>0);Q(a,{name:b,Qc(c){var d=(u(),C)[c>>>2>>>0];d=Tf(c+4,d,!0);I(c);return d},Wc(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 eg("Cannot pass non-string to std::string");var f=e?U(d):d.length;var h=je(4+f+1),k=h+4;(u(),C)[h>>>2>>>0]=f;e?T(d,k,f+1):(u(),x).set(d,k>>>0);null!==c&&c.push(I,h);return h},Vc:jg,Xc(c){I(c)}})}
var mg=globalThis.TextDecoder?new TextDecoder("utf-16le"):void 0,ng=(a,b,c)=>{a>>>=1;b=Rf((u(),Oa),a,b/2,c);if(16<b-a&&mg)return mg.decode((u(),Oa).slice(a,b));for(c="";a<b;++a){var d=(u(),Oa)[a>>>0];c+=String.fromCharCode(d)}return c},og=(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);(u(),Na)[b>>>1>>>0]=f;b+=2}(u(),Na)[b>>>1>>>0]=0;return b-d},pg=a=>2*a.length,qg=(a,b,c)=>{var d="";a>>>=2;for(var e=0;!(e>=b/4);e++){var f=
(u(),C)[a+e>>>0];if(!f&&!c)break;d+=String.fromCodePoint(f)}return d},rg=(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++;(u(),B)[b>>>2>>>0]=f;b+=4;if(b+4>c)break}(u(),B)[b>>>2>>>0]=0;return b-d},sg=a=>{for(var b=0,c=0;c<a.length;++c)65535<a.codePointAt(c)&&c++,b+=4;return b};
function Gb(a,b,c){a>>>=0;b>>>=0;c>>>=0;c=P(c);if(2===b){var d=ng;var e=og;var f=pg}else d=qg,e=rg,f=sg;Q(a,{name:c,Qc:h=>{var k=(u(),C)[h>>>2>>>0];k=d(h+4,k*b,!0);I(h);return k},Wc:(h,k)=>{if("string"!=typeof k)throw new eg(`Cannot pass non-string to C++ string type ${c}`);var m=f(k),p=je(4+m+b);(u(),C)[p>>>2>>>0]=m/b;e(k,p+4,m+b);null!==h&&h.push(I,p);return p},Vc:jg,Xc(h){I(h)}})}function Hb(a,b){a>>>=0;b=P(b>>>0);Q(a,{me:!0,name:b,Qc:()=>{},Wc:()=>{}})}
function Ib(a){Ga(a>>>0,!ba,1,!aa,131072,!1);Ha()}var Pf=a=>{if(!ua)try{if(a(),!(0<M))try{n?ie()&&Ee(va):Oc(va)}catch(b){b instanceof Af||"unwind"==b||ha(1,b)}}catch(b){b instanceof Af||"unwind"==b||ha(1,b)}},tg=!Atomics.waitAsync||globalThis.navigator?.userAgent&&91>Number((navigator.userAgent.match(/Chrom(e|ium)\/([0-9]+)\./)||[])[2]);function Ia(a){a>>>=0;tg||(Atomics.waitAsync((u(),B),a>>>2,a).value.then(La),a+=128,Atomics.store((u(),B),a>>>2,1))}var La=()=>Pf(()=>{var a=ie();a&&(Ia(a),Ge())});
function Jb(a,b){a>>>=0;a==b>>>0?setTimeout(La):n?postMessage({Zc:a,Tc:"checkMailbox"}):(a=Jf[a])&&a.postMessage({Tc:"checkMailbox"})}var ug=[];function Kb(a,b,c,d,e){b>>>=0;d/=2;ug.length=d;c=e>>>0>>>3;for(e=0;e<d;e++)(u(),F)[c+2*e>>>0]?ug[e]=(u(),F)[c+2*e+1>>>0]:ug[e]=(u(),E)[c+2*e+1>>>0];return(b?vg[b]:wg[a])(...ug)}var Lb=()=>{M=0};function Mb(a){a>>>=0;n?postMessage({Tc:"cleanupThread",re:a}):Of(Jf[a])}function Nb(a){l&&Jf[a>>>0].ref()}var xg=a=>{try{a()}catch(b){H(b)}};
function de(a){var b=(...c)=>{yg.push(a);try{return a(...c)}finally{ua||(yg.pop(),r&&1===zg&&0===yg.length&&(zg=0,M+=1,xg(xf),"undefined"!=typeof Fibers&&Fibers.Me()))}};Ag.set(a,b);return b}var zg=0,r=null,Bg=0,yg=[],Cg=new Map,Dg=new Map,Ag=new Map,Eg=0,Fg=null,Gg=[];function da(){return new Promise((a,b)=>{Fg={resolve:a,reject:b}})}
function Hg(){var a=je(65548),b=a+12;(u(),C)[a>>>2>>>0]=b;(u(),C)[a+4>>>2>>>0]=b+65536;b=yg[0];if(!Cg.has(b)){var c=Eg++;Cg.set(b,c);Dg.set(c,b)}b=Cg.get(b);(u(),B)[a+8>>>2>>>0]=b;return a}function Ig(){var a=(u(),B)[r+8>>>2>>>0];a=Dg.get(a);a=Ag.get(a);--M;return a()}
function Jg(a){if(!ua){if(0===zg){var b=!1,c=!1;a((d=0)=>{if(!ua&&(Bg=d,b=!0,c)){zg=2;xg(()=>yf(r));"undefined"!=typeof MainLoop&&MainLoop.ie&&MainLoop.resume();d=!1;try{var e=Ig()}catch(k){e=k,d=!0}var f=!1;if(!r){var h=Fg;h&&(Fg=null,(d?h.reject:h.resolve)(e),f=!0)}if(d&&!f)throw e;}});c=!0;b||(zg=1,r=Hg(),"undefined"!=typeof MainLoop&&MainLoop.ie&&MainLoop.pause(),xg(()=>wf(r)))}else 2===zg?(zg=0,xg(zf),I(r),r=null,Gg.forEach(Pf)):H(`invalid state: ${zg}`);return Bg}}var Kg=a=>Jg(b=>{a().then(b)});
function Ob(a){a>>>=0;return Kg(async()=>{var b=await R(a);return S(b)})}var Lg=[],Mg=a=>{var b=Lg.length;Lg.push(a);return b},Ng=(a,b)=>{for(var c=Array(a),d=0;d<a;++d){var e=d,f=(u(),C)[b+4*d>>>2>>>0],h=cg[f];if(void 0===h)throw a=`parameter ${d}`,f=ge(f),b=P(f),I(f),new eg(`${a} has unknown type ${b}`);c[e]=h}return c},Og=(a,b,c)=>{var d=[];a=a(d,c);d.length&&((u(),C)[b>>>2>>>0]=S(d));return a},Pg={},Qg=a=>{var b=Pg[a];return void 0===b?P(a):b};
function Pb(a,b,c){var [d,...e]=Ng(a,b>>>0);b=d.Wc.bind(d);var f=e.map(m=>m.Vc.bind(m));a--;var h={toValue:R};a=f.map((m,p)=>{var z=`argFromPtr${p}`;h[z]=m;return`${z}(args${p?"+"+8*p:""})`});switch(c){case 0:var k="toValue(handle)";break;case 2:k="new (toValue(handle))";break;case 3:k="";break;case 1:h.getStringOrSymbol=Qg,k="toValue(handle)[getStringOrSymbol(methodName)]"}k+=`(${a})`;d.me||(h.toReturnWire=b,h.emval_returnValue=Og,k=`return emval_returnValue(toReturnWire, destructorsRef, ${k})`);
k=`return function (handle, methodName, destructorsRef, args) {\n  ${k}\n  }`;c=(new Function(Object.keys(h),k))(...Object.values(h));k=`methodCaller<(${e.map(m=>m.name)}) => ${d.name}>`;return Mg(Object.defineProperty(c,"name",{value:k}))}function Rb(a,b){b>>>=0;a=R(a>>>0);b=R(b);return a==b}function Sb(a){a>>>=0;if(!a)return S(globalThis);a=Qg(a);return S(globalThis[a])}function Tb(a){a=Qg(a>>>0);return S(g[a])}function Ub(a,b){b>>>=0;a=R(a>>>0);b=R(b);return S(a[b])}
function Vb(a){a>>>=0;9<a&&(ig[a+1]+=1)}function Wb(a,b,c,d,e){return Lg[a>>>0](b>>>0,c>>>0,d>>>0,e>>>0)}function Xb(){return S([])}function Yb(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 Zb(a){return S(Qg(a>>>0))}function $b(){return S({})}function ac(a){a>>>=0;for(var b=R(a);b.length;){var c=b.pop();b.pop()(c)}Qb(a)}function bc(a,b,c){b>>>=0;c>>>=0;a=R(a>>>0);b=R(b);c=R(c);a[b]=c}
function cc(a,b){a=O(a);b>>>=0;a=new Date(1E3*a);(u(),B)[b>>>2>>>0]=a.getUTCSeconds();(u(),B)[b+4>>>2>>>0]=a.getUTCMinutes();(u(),B)[b+8>>>2>>>0]=a.getUTCHours();(u(),B)[b+12>>>2>>>0]=a.getUTCDate();(u(),B)[b+16>>>2>>>0]=a.getUTCMonth();(u(),B)[b+20>>>2>>>0]=a.getUTCFullYear()-1900;(u(),B)[b+24>>>2>>>0]=a.getUTCDay();a=(a.getTime()-Date.UTC(a.getUTCFullYear(),0,1,0,0,0,0))/864E5|0;(u(),B)[b+28>>>2>>>0]=a}
var Rg=a=>0===a%4&&(0!==a%100||0===a%400),Sg=[0,31,60,91,121,152,182,213,244,274,305,335],Tg=[0,31,59,90,120,151,181,212,243,273,304,334];
function dc(a,b){a=O(a);b>>>=0;a=new Date(1E3*a);(u(),B)[b>>>2>>>0]=a.getSeconds();(u(),B)[b+4>>>2>>>0]=a.getMinutes();(u(),B)[b+8>>>2>>>0]=a.getHours();(u(),B)[b+12>>>2>>>0]=a.getDate();(u(),B)[b+16>>>2>>>0]=a.getMonth();(u(),B)[b+20>>>2>>>0]=a.getFullYear()-1900;(u(),B)[b+24>>>2>>>0]=a.getDay();var c=(Rg(a.getFullYear())?Sg:Tg)[a.getMonth()]+a.getDate()-1|0;(u(),B)[b+28>>>2>>>0]=c;(u(),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;(u(),B)[b+32>>>2>>>0]=a}
function ec(a){a>>>=0;var b=new Date((u(),B)[a+20>>>2>>>0]+1900,(u(),B)[a+16>>>2>>>0],(u(),B)[a+12>>>2>>>0],(u(),B)[a+8>>>2>>>0],(u(),B)[a+4>>>2>>>0],(u(),B)[a>>>2>>>0],0),c=(u(),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?(u(),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)));(u(),B)[a+24>>>2>>>0]=b.getDay();c=(Rg(b.getFullYear())?
Sg:Tg)[b.getMonth()]+b.getDate()-1|0;(u(),B)[a+28>>>2>>>0]=c;(u(),B)[a>>>2>>>0]=b.getSeconds();(u(),B)[a+4>>>2>>>0]=b.getMinutes();(u(),B)[a+8>>>2>>>0]=b.getHours();(u(),B)[a+12>>>2>>>0]=b.getDate();(u(),B)[a+16>>>2>>>0]=b.getMonth();(u(),B)[a+20>>>2>>>0]=b.getYear();a=b.getTime();return BigInt(isNaN(a)?-1:a/1E3)}function fc(a,b,c,d,e,f,h){return n?N(16,1,a,b,c,d,e,f,h):-52}function gc(a,b,c,d,e,f){if(n)return N(17,1,a,b,c,d,e,f)}var Ug={},rc=()=>performance.timeOrigin+performance.now();
function hc(a,b){if(n)return N(18,1,a,b);Ug[a]&&(clearTimeout(Ug[a].id),delete Ug[a]);if(!b)return 0;var c=setTimeout(()=>{delete Ug[a];Pf(()=>Fe(a,performance.timeOrigin+performance.now()))},b);Ug[a]={id:c,Le:b};return 0}
function ic(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);(u(),C)[a>>>2>>>0]=60*h;(u(),B)[b>>>2>>>0]=Number(f!=e);b=k=>{var m=Math.abs(k);return`UTC${0<=k?"-":"+"}${String(Math.floor(m/60)).padStart(2,"0")}${String(m%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 nc=()=>Date.now(),Vg=1;
function jc(a,b,c){c>>>=0;if(!(0<=a&&3>=a))return 28;if(0===a)a=Date.now();else if(Vg)a=performance.timeOrigin+performance.now();else return 52;a=Math.round(1E6*a);(u(),F)[c>>>3>>>0]=BigInt(a);return 0}var Wg=[],Xg=(a,b)=>{Wg.length=0;for(var c;c=(u(),x)[a++>>>0];){var d=105!=c;d&=112!=c;b+=d&&b%8?4:0;Wg.push(112==c?(u(),C)[b>>>2>>>0]:106==c?(u(),F)[b>>>3>>>0]:105==c?(u(),B)[b>>>2>>>0]:(u(),E)[b>>>3>>>0]);b+=d?8:4}return Wg};function kc(a,b,c){a>>>=0;b=Xg(b>>>0,c>>>0);return vg[a](...b)}
function lc(a,b,c){a>>>=0;b=Xg(b>>>0,c>>>0);return vg[a](...b)}var mc=()=>{};function oc(a,b){return t(Tf(a>>>0,b>>>0))}var pc=()=>{M+=1;throw"unwind";};function qc(){return 4294901760}var sc=()=>1,tc=()=>l?require("os").cpus().length:navigator.hardwareConcurrency,Yg={},Zg=a=>{var b=U(a)+1,c=je(b);c&&T(a,c,b);return c},$g=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},ah=a=>{for(var b of a)(a=$g(b))&&(Yg[a]=b)};
function wc(){var a=Error().stack.toString().split("\n");"Error"==a[0]&&a.shift();ah(a);Yg.Wd=$g(a[3]);Yg.oe=a;return Yg.Wd}function uc(a){a=Yg[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;I(uc.$d??0);uc.$d=Zg(a);return uc.$d}
function vc(a){a>>>=0;var b=(u(),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))-v.buffer.byteLength+65535)/65536|0;try{v.grow(d);wa();var e=1;break a}catch(f){}e=void 0}if(e)return!0}return!1}
function xc(a,b,c){a>>>=0;b>>>=0;if(Yg.Wd==a)var d=Yg.oe;else d=Error().stack.toString().split("\n"),"Error"==d[0]&&d.shift(),ah(d);for(var e=3;d[e]&&$g(d[e])!=a;)++e;for(a=0;a<c&&d[a+e];++a)(u(),B)[b+4*a>>>2>>>0]=$g(d[a+e]);return a}
var V=a=>{var b=U(a)+1,c=Ke(b);T(a,c,b);return c},bh=[],W=(a,b)=>{bh[a>>>=0]=b},X=[],ch=[],dh=(a,b)=>{ch[a]=new Promise(c=>b.finally(()=>c(a)))},Y=a=>{if(a)return bh[a>>>0]},eh=(a,b=0)=>{"pending"!=a.mapState||H();b=se(b,"mapped"==a.mapState?3:1);W(b,a);"mapped"==a.mapState&&(X[b]=[]);return b},fh=(a,b=0)=>{var c=ue(b);b=te(b,c);W(c,a.queue);W(b,a);return b},gh=(a,b,c)=>{(u(),C)[a>>>2>>>0]=b;(u(),C)[a+4>>>2>>>0]=c},hh=a=>{var b=(u(),C)[a>>>2>>>0];a=(u(),C)[a+4>>>2>>>0];return Tf(b,a)},Z=a=>{var b=
(u(),C)[a>>>2>>>0];a=(u(),C)[a+4>>>2>>>0];if(b)return Tf(b,a);if(0===a)return""},ih=a=>{var b=Z(a+4);var c=(c=(u(),C)[a+12>>>2>>>0])?Y(c):"auto";if(a+=16){var d=Y((u(),C)[a+4>>>2>>>0]);var e=(u(),C)[a+16>>>2>>>0];var f=(u(),C)[a+20>>>2>>>0];if(e){for(var h={},k=0;k<e;++k){var m=f+24*k,p=hh(m+4);h[p]=(u(),E)[m+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}},jh=(a,b)=>{function c(e,f){e=a[e];(u(),B)[b+f>>>2>>>0]=e}function d(e,
f){e=a[e];(u(),F)[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.Je&&c("maxImmediateSize",148)},kh=[,"validation","out-of-memory","internal"],lh=[,"compatibility","core"],mh={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"},nh=[,"low-power","high-performance"],oh=[,"occlusion","timestamp"],ph={undefined:1,unknown:1,
destroyed:2};
function yc(a,b,c,d,e,f){b=O(b);c=O(c);d>>>=0;e>>>=0;f>>>=0;var h=Y(a>>>0);a={};if(f){var k=(u(),C)[f+12>>>2>>>0];if(k){var m=(u(),C)[f+16>>>2>>>0];a.requiredFeatures=Array.from((u(),C).subarray(m>>>2>>>0,m+4*k>>>2>>>0),q=>mh[q])}var p=(u(),C)[f+20>>>2>>>0];if(p){var z={};function q(A,D,za=!1){D=p+D;D=(u(),C)[D>>>2>>>0];4294967295==D||za&&0==D||(z[A]=D)}function y(A,D){D=p+D;var za=(u(),C)[D>>>2>>>0],Ab=(u(),C)[D+4>>>2>>>0];if(4294967295!=za||4294967295!=Ab)z[A]=4294967296*(u(),C)[D+4>>>2>>>0]+(u(),
C)[D>>>2>>>0]}q("maxTextureDimension1D",4);q("maxTextureDimension2D",8);q("maxTextureDimension3D",12);q("maxTextureArrayLayers",16);q("maxBindGroups",20);q("maxBindGroupsPlusVertexBuffers",24);q("maxDynamicUniformBuffersPerPipelineLayout",32);q("maxDynamicStorageBuffersPerPipelineLayout",36);q("maxSampledTexturesPerShaderStage",40);q("maxSamplersPerShaderStage",44);q("maxStorageBuffersPerShaderStage",48);q("maxStorageTexturesPerShaderStage",52);q("maxUniformBuffersPerShaderStage",56);q("minUniformBufferOffsetAlignment",
80);q("minStorageBufferOffsetAlignment",84);y("maxUniformBufferBindingSize",64);y("maxStorageBufferBindingSize",72);q("maxVertexBuffers",88);y("maxBufferSize",96);q("maxVertexAttributes",104);q("maxVertexBufferArrayStride",108);q("maxInterStageShaderVariables",112);q("maxColorAttachments",116);q("maxColorAttachmentBytesPerSample",120);q("maxComputeWorkgroupStorageSize",124);q("maxComputeInvocationsPerWorkgroup",128);q("maxComputeWorkgroupSizeX",132);q("maxComputeWorkgroupSizeY",136);q("maxComputeWorkgroupSizeZ",
140);q("maxComputeWorkgroupsPerDimension",144);q("maxImmediateSize",148,!0);a.requiredLimits=z}if(k=(u(),C)[f+24>>>2>>>0])k={label:Z(k+4)},a.defaultQueue=k;a.label=Z(f+4)}M+=1;dh(b,h.requestDevice(a).then(q=>{--M;W(e,q.queue);W(d,q);c&&(M+=1,dh(c,q.lost.then(y=>{--M;q.onuncapturederror=()=>{};var A=L(),D=V(y.message);we(c,ph[y.reason],D);K(A)})));q.onuncapturederror=y=>{var A=5;y.error instanceof GPUValidationError?A=2:y.error instanceof GPUOutOfMemoryError?A=3:y.error instanceof GPUInternalError&&
(A=4);var D=L();y=V(y.error.message);Be(d,A,y);K(D)};"adapterInfo"in q||(q.adapterInfo=h.info);Ae(b,1,d,0)},q=>{--M;var y=L();q=V(q.message);Ae(b,3,d,q);c&&we(c,4,q);K(y)}))}function zc(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 qh=()=>{var a="getMappedRange size=0 no longer means WGPU_WHOLE_MAP_SIZE";qh.dd||(qh.dd={});qh.dd[a]||(qh.dd[a]=1,l&&(a="warning: "+a),t(a))};
function Ac(a,b,c){a>>>=0;b>>>=0;c>>>=0;var d=Y(a);0===c&&qh();4294967295==c&&(c=void 0);try{var e=d.getMappedRange(b,c)}catch(h){return 0}var f=He(16,e.byteLength);(u(),x).set(new Uint8Array(e),f>>>0);X[a].push(()=>I(f));return f}
function Bc(a,b,c){a>>>=0;b>>>=0;c>>>=0;var d=Y(a);0===c&&qh();4294967295==c&&(c=void 0);try{var e=d.getMappedRange(b,c)}catch(h){return 0}var f=He(16,e.byteLength);(u(),x).fill(0,f,e.byteLength);X[a].push(()=>{(new Uint8Array(e)).set((u(),x).subarray(f>>>0,f+e.byteLength>>>0));I(f)});return f}
function Cc(a,b,c,d,e){a>>>=0;b=O(b);c=O(c);e>>>=0;var f=Y(a);X[a]=[];4294967295==e&&(e=void 0);M+=1;dh(b,f.mapAsync(c,d>>>0,e).then(()=>{--M;xe(b,1,0)},h=>{--M;L();var k=V(h.message);xe(b,"AbortError"===h.name?4:"OperationError"===h.name?3:0,k);delete X[a]}))}function Dc(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 Ec(a){delete bh[a>>>0]}
function Fc(a,b,c){a>>>=0;b>>>=0;c>>>=0;var d=!!(u(),C)[b+32>>>2>>>0];b={label:Z(b+4),usage:(u(),C)[b+16>>>2>>>0],size:4294967296*(u(),C)[b+28>>>2>>>0]+(u(),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 Gc(a,b,c,d){a>>>=0;b=O(b);d>>>=0;c=ih(c>>>0);a=Y(a);M+=1;dh(b,a.createComputePipelineAsync(c).then(e=>{--M;W(d,e);ve(b,1,d,0)},e=>{--M;var f=L(),h=V(e.message);ve(b,"validation"===e.reason?3:"internal"===e.reason?4:0,d,h);K(f)}))}function Hc(a,b,c){a>>>=0;b>>>=0;c>>>=0;var d=(u(),C)[b>>>2>>>0],e=(u(),C)[d+4>>>2>>>0];b={label:Z(b+4),code:""};switch(e){case 2:b.code=hh(d+8)}W(c,Y(a).createShaderModule(b))}var Ic=a=>{a=Y(a);a.onuncapturederror=null;a.destroy()};
function Jc(a,b){b=O(b);a=Y(a>>>0);M+=1;dh(b,a.popErrorScope().then(c=>{--M;var d=5;c?c instanceof GPUValidationError?d=2:c instanceof GPUOutOfMemoryError?d=3:c instanceof GPUInternalError&&(d=4):d=1;var e=L();c=c?V(c.message):0;ye(b,1,d,c);K(e)},c=>{--M;var d=L();c=V(c.message);ye(b,1,5,c);K(d)}))}
function Kc(a,b,c,d){b=O(b);c>>>=0;d>>>=0;if(c){var e=(u(),C)[c+4>>>2>>>0];e={featureLevel:lh[e],powerPreference:nh[(u(),C)[c+8>>>2>>>0]],forceFallbackAdapter:!!(u(),C)[c+12>>>2>>>0]};c=(u(),C)[c>>>2>>>0];0!==c&&(u(),e.Oe=!!(u(),C)[c+8>>>2>>>0])}"gpu"in navigator?(M+=1,dh(b,navigator.gpu.requestAdapter(e).then(f=>{--M;if(f)W(d,f),ze(b,1,d,0);else{f=L();var h=V("WebGPU not available on this browser (requestAdapter returned null)");ze(b,3,d,h);K(f)}},f=>{--M;var h=L();f=V(f.message);ze(b,4,d,f);K(h)}))):
(c=L(),e=V("WebGPU not available on this browser (navigator.gpu is not available)"),ze(b,3,d,e),K(c))}function Lc(a,b,c){a>>>=0;b>>>=0;c>>>=0;return Kg(async()=>{var d=[];if(c){var e=(u(),B)[c>>>2>>>0];d.length=b+1;d[b]=new Promise(k=>setTimeout(k,e,0))}else d.length=b;for(var f=0;f<b;++f){var h=4294967296*(u(),C)[a+8*f+4>>>2>>>0]+(u(),C)[a+8*f>>>2>>>0];if(!(h in ch))return h;d[f]=ch[h]}d=await Promise.race(d);delete ch[d];return d})}
var rh={},th=()=>{if(!sh){var a={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:(globalThis.navigator?.language??"C").replace("-","_")+".UTF-8",_:fa||"./this.program"},b;for(b in rh)void 0===rh[b]?delete a[b]:a[b]=rh[b];var c=[];for(b in a)c.push(`${b}=${a[b]}`);sh=c}return sh},sh;function Mc(a,b){if(n)return N(19,1,a,b);a>>>=0;b>>>=0;var c=0,d=0,e;for(e of th()){var f=b+c;(u(),C)[a+d>>>2>>>0]=f;c+=T(e,f,Infinity)+1;d+=4}return 0}
function Nc(a,b){if(n)return N(20,1,a,b);a>>>=0;b>>>=0;var c=th();(u(),C)[a>>>2>>>0]=c.length;a=0;for(var d of c)a+=U(d)+1;(u(),C)[b>>>2>>>0]=a;return 0}function Pc(a){return n?N(21,1,a):52}function Qc(a,b,c,d){return n?N(22,1,a,b,c,d):52}function Rc(a,b,c,d){return n?N(23,1,a,b,c,d):70}var uh=[null,[],[]];
function Sc(a,b,c,d){if(n)return N(24,1,a,b,c,d);b>>>=0;c>>>=0;d>>>=0;for(var e=0,f=0;f<c;f++){var h=(u(),C)[b>>>2>>>0],k=(u(),C)[b+4>>>2>>>0];b+=8;for(var m=0;m<k;m++){var p=a,z=(u(),x)[h+m>>>0],q=uh[p];0===z||10===z?((1===p?ra:t)(Sf(q)),q.length=0):q.push(z)}e+=k}(u(),C)[d>>>2>>>0]=e;return 0}function Ed(a){return a>>>0}function Gd(a,b){jh(Y(a>>>0).limits,b>>>0);return 1}function Hd(a,b){return Y(a>>>0).features.has(mh[b])}function Id(a){return BigInt(Y(a>>>0).size)}
function Jd(a){return BigInt(Y(a>>>0).usage)}function Kd(a,b){a>>>=0;b>>>=0;if(b){var c=Z(b+4);b=(u(),C)[b+12>>>2>>>0];b=0!==b?{querySet:Y((u(),C)[b+4>>>2>>>0]),beginningOfPassWriteIndex:(u(),C)[b+8>>>2>>>0],endOfPassWriteIndex:(u(),C)[b+12>>>2>>>0]}:void 0;c={label:c,timestampWrites:b}}a=Y(a);b=qe(0);W(b,a.beginComputePass(c));return b}function Ld(a,b,c,d,e,f){c=O(c);e=O(e);f=O(f);Y(a>>>0).copyBufferToBuffer(Y(b>>>0),c,Y(d>>>0),e,f)}
function Md(a){a=Y(a>>>0);var b=oe(0);W(b,a.finish());return b}function Nd(a,b,c,d,e,f){f=O(f);Y(a>>>0).resolveQuerySet(Y(b>>>0),c,d,Y(e>>>0),f)}function Od(a,b,c,d){Y(a>>>0).dispatchWorkgroups(b,c,d)}function Pd(a,b,c){c=O(c);Y(a>>>0).dispatchWorkgroupsIndirect(Y(b>>>0),c)}function Qd(a){Y(a>>>0).end()}function Rd(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,(u(),C),e>>>2,d)}function Sd(a,b){Y(a>>>0).setPipeline(Y(b>>>0))}
function Td(a,b,c){Y(a>>>0).Ne(Y(b>>>0),c)}function Ud(a,b){a=Y(a>>>0);var c=ne(0);W(c,a.getBindGroupLayout(b));return c}
function Vd(a,b){a>>>=0;b>>>=0;var c=Z(b+4),d=Y((u(),C)[b+12>>>2>>>0]),e=(u(),C)[b+16>>>2>>>0];b=(u(),C)[b+20>>>2>>>0];for(var f=[],h=0;h<e;++h){var k=f,m=k.push;var p=b+40*h;var z=(u(),C)[p+8>>>2>>>0],q=(u(),C)[p+32>>>2>>>0],y=(u(),C)[p+36>>>2>>>0],A=(u(),C)[p+4>>>2>>>0];z?(q=p+24,q=(u(),C)[q>>>2>>>0]+4294967296*(u(),B)[q+4>>>2>>>0],-1==q&&(q=void 0),p={binding:A,resource:{buffer:Y(z),offset:4294967296*(u(),C)[p+4+16>>>2>>>0]+(u(),C)[p+16>>>2>>>0],size:q}}):p=q?{binding:A,resource:Y(q)}:{binding:A,
resource:Y(y)};m.call(k,p)}c={label:c,layout:d,entries:f};a=Y(a);d=me(0);W(d,a.createBindGroup(c));return d}function Wd(a,b){a>>>=0;b>>>=0;var c;b&&(c={label:Z(b+4)});a=Y(a);b=pe(0);W(b,a.createCommandEncoder(c));return b}function Xd(a,b){a>>>=0;b>>>=0;b={type:oh[(u(),C)[b+12>>>2>>>0]],count:(u(),C)[b+16>>>2>>>0]};a=Y(a);var c=re(0);W(c,a.createQuerySet(b));return c}
function Yd(a,b){a=Y(a>>>0).adapterInfo;b>>>=0;(u(),B)[b+52>>>2>>>0]=a.subgroupMinSize;(u(),B)[b+56>>>2>>>0]=a.subgroupMaxSize;var c=Zg(a.vendor+a.architecture+a.device+a.description),d=U(a.vendor);gh(b+4,c,d);c+=d;d=U(a.architecture);gh(b+12,c,d);c+=d;d=U(a.device);gh(b+20,c,d);gh(b+28,c+d,U(a.description));(u(),B)[b+36>>>2>>>0]=2;a=a.isFallbackAdapter?3:4;(u(),B)[b+40>>>2>>>0]=a;(u(),B)[b+44>>>2>>>0]=0;(u(),B)[b+48>>>2>>>0]=0;return 1}
var vh={"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 Zd(a,b){b>>>=0;a=Y(a>>>0);var c=je(4*a.features.size),d=0,e=0;a.features.forEach(f=>{f=vh[f];0<=f&&((u(),B)[c+d>>>2>>>0]=f,d+=4,e++)});(u(),C)[b+4>>>2>>>0]=c;(u(),C)[b>>>2>>>0]=e}function $d(a,b){jh(Y(a>>>0).limits,b>>>0);return 1}function ae(a,b){Y(a>>>0).pushErrorScope(kh[b])}
function be(a,b,c){b>>>=0;c>>>=0;a=Y(a>>>0);b=Array.from((u(),B).subarray(c>>>2>>>0,c+4*b>>>2>>>0),d=>Y(d));a.submit(b)}function ce(a,b,c,d,e){c=O(c);d>>>=0;e>>>=0;a=Y(a>>>0);b=Y(b>>>0);d=(u(),x).subarray(d>>>0,d+e>>>0);a.writeBuffer(b,c,d,0,e)}n||Mf();n||(v=new WebAssembly.Memory({initial:256,maximum:65536,shared:!0}),wa());g.wasmBinary&&(sa=g.wasmBinary);g.stackSave=()=>L();g.stackRestore=a=>K(a);g.stackAlloc=a=>Ke(a);
g.setValue=function(a,b,c="i8"){c.endsWith("*")&&(c="*");switch(c){case "i1":(u(),w)[a>>>0]=b;break;case "i8":(u(),w)[a>>>0]=b;break;case "i16":(u(),Na)[a>>>1>>>0]=b;break;case "i32":(u(),B)[a>>>2>>>0]=b;break;case "i64":(u(),F)[a>>>3>>>0]=BigInt(b);break;case "float":(u(),Pa)[a>>>2>>>0]=b;break;case "double":(u(),E)[a>>>3>>>0]=b;break;case "*":(u(),C)[a>>>2>>>0]=b;break;default:H(`invalid type for setValue: ${c}`)}};
g.getValue=function(a,b="i8"){b.endsWith("*")&&(b="*");switch(b){case "i1":return(u(),w)[a>>>0];case "i8":return(u(),w)[a>>>0];case "i16":return(u(),Na)[a>>>1>>>0];case "i32":return(u(),B)[a>>>2>>>0];case "i64":return(u(),F)[a>>>3>>>0];case "float":return(u(),Pa)[a>>>2>>>0];case "double":return(u(),E)[a>>>3>>>0];case "*":return(u(),C)[a>>>2>>>0];default:H(`invalid type for getValue: ${b}`)}};g.UTF8ToString=Tf;g.stringToUTF8=T;g.lengthBytesUTF8=U;
var wg=[Fd,Lf,ag,jb,kb,lb,mb,nb,ob,pb,qb,rb,sb,tb,ub,vb,fc,gc,hc,Mc,Nc,Pc,Qc,Rc,Sc],vg={1111036:(a,b,c,d,e)=>{if("undefined"==typeof g||!g.Yc)return 1;a=Tf(Number(a>>>0));a.startsWith("./")&&(a=a.substring(2));a=g.Yc.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:(u(),x).set(f,d>>>0);break;case 1:g.fe?g.fe(d,f):g.Ie(d,f);break;default:return 4}return 0}catch{return 4}},1111860:(a,b,c)=>{g.he(a,(u(),
x).subarray(b>>>0,b+c>>>0))},1111924:()=>g.Ge(),1111966:a=>{g.ge(a)},1112003:()=>"undefined"!==typeof wasmOffsetConverter};function Za(){return"undefined"!==typeof wasmOffsetConverter}var ge,Ja,he,ie,I,je,ke,le,me,ne,oe,pe,qe,re,se,te,ue,ve,we,xe,ye,ze,Ae,Be,Ga,Ma,Ce,De,Ee,Fe,Ge,He,J,Ie,Je,K,Ke,L,Le,Me,Ne,Oe,dynCall_vii,Pe,dynCall_v,Qe,Re,Se,dynCall_iii,Te,Ue,Ve,dynCall_vi,We,Xe,Ye,Ze,$e,af,bf,cf,df,ef,ff,gf,hf,jf,kf,lf,mf,nf,of,pf,qf,rf,sf,tf,uf,vf,wf,xf,yf,zf,Ya;
function $c(a,b,c,d){var e=L();try{return Ve(a,b,c,d)}catch(f){K(e);if(f!==f+0)throw f;J(1,0)}}function Zc(a,b,c){var d=L();try{return dynCall_iii(a,b,c)}catch(e){K(d);if(e!==e+0)throw e;J(1,0)}}function rd(a,b,c){var d=L();try{dynCall_vii(a,b,c)}catch(e){K(d);if(e!==e+0)throw e;J(1,0)}}function Yc(a,b){var c=L();try{return Pe(a,b)}catch(d){K(c);if(d!==d+0)throw d;J(1,0)}}function pd(a){var b=L();try{dynCall_v(a)}catch(c){K(b);if(c!==c+0)throw c;J(1,0)}}
function dd(a,b,c,d,e,f,h){var k=L();try{return Se(a,b,c,d,e,f,h)}catch(m){K(k);if(m!==m+0)throw m;J(1,0)}}function qd(a,b){var c=L();try{dynCall_vi(a,b)}catch(d){K(c);if(d!==d+0)throw d;J(1,0)}}function vd(a,b,c,d,e,f){var h=L();try{Qe(a,b,c,d,e,f)}catch(k){K(h);if(k!==k+0)throw k;J(1,0)}}function td(a,b,c,d){var e=L();try{Ue(a,b,c,d)}catch(f){K(e);if(f!==f+0)throw f;J(1,0)}}function wd(a,b,c,d,e,f,h){var k=L();try{Xe(a,b,c,d,e,f,h)}catch(m){K(k);if(m!==m+0)throw m;J(1,0)}}
function Dd(a,b,c,d,e,f,h){var k=L();try{Ye(a,b,c,d,e,f,h)}catch(m){K(k);if(m!==m+0)throw m;J(1,0)}}function Cd(a,b,c,d,e,f,h,k){var m=L();try{hf(a,b,c,d,e,f,h,k)}catch(p){K(m);if(p!==p+0)throw p;J(1,0)}}function ud(a,b,c,d,e){var f=L();try{Re(a,b,c,d,e)}catch(h){K(f);if(h!==h+0)throw h;J(1,0)}}function ad(a,b,c,d,e){var f=L();try{return We(a,b,c,d,e)}catch(h){K(f);if(h!==h+0)throw h;J(1,0)}}function xd(a,b,c,d,e,f,h,k){var m=L();try{jf(a,b,c,d,e,f,h,k)}catch(p){K(m);if(p!==p+0)throw p;J(1,0)}}
function Ad(a,b,c,d,e,f,h,k,m,p,z,q){var y=L();try{Ze(a,b,c,d,e,f,h,k,m,p,z,q)}catch(A){K(y);if(A!==A+0)throw A;J(1,0)}}function cd(a,b,c,d,e,f){var h=L();try{return ff(a,b,c,d,e,f)}catch(k){K(h);if(k!==k+0)throw k;J(1,0)}}function nd(a,b,c){var d=L();try{return cf(a,b,c)}catch(e){K(d);if(e!==e+0)throw e;J(1,0);return 0n}}function yd(a,b,c,d,e,f,h,k,m){var p=L();try{Te(a,b,c,d,e,f,h,k,m)}catch(z){K(p);if(z!==z+0)throw z;J(1,0)}}
function Xc(a){var b=L();try{return af(a)}catch(c){K(b);if(c!==c+0)throw c;J(1,0)}}function md(a,b){var c=L();try{return vf(a,b)}catch(d){K(c);if(d!==d+0)throw d;J(1,0);return 0n}}function ld(a){var b=L();try{return $e(a)}catch(c){K(b);if(c!==c+0)throw c;J(1,0);return 0n}}function gd(a,b,c,d,e,f){var h=L();try{return mf(a,b,c,d,e,f)}catch(k){K(h);if(k!==k+0)throw k;J(1,0)}}function bd(a,b,c,d,e,f){var h=L();try{return nf(a,b,c,d,e,f)}catch(k){K(h);if(k!==k+0)throw k;J(1,0)}}
function kd(a,b,c){var d=L();try{return of(a,b,c)}catch(e){K(d);if(e!==e+0)throw e;J(1,0)}}function ed(a,b,c,d,e,f,h,k){var m=L();try{return gf(a,b,c,d,e,f,h,k)}catch(p){K(m);if(p!==p+0)throw p;J(1,0)}}function od(a,b,c,d,e){var f=L();try{return pf(a,b,c,d,e)}catch(h){K(f);if(h!==h+0)throw h;J(1,0);return 0n}}function Wc(a,b,c,d){var e=L();try{return qf(a,b,c,d)}catch(f){K(e);if(f!==f+0)throw f;J(1,0)}}
function Uc(a,b,c,d){var e=L();try{return rf(a,b,c,d)}catch(f){K(e);if(f!==f+0)throw f;J(1,0)}}function fd(a,b,c,d,e,f,h,k,m,p,z,q){var y=L();try{return sf(a,b,c,d,e,f,h,k,m,p,z,q)}catch(A){K(y);if(A!==A+0)throw A;J(1,0)}}function zd(a,b,c,d,e,f,h,k,m,p,z){var q=L();try{kf(a,b,c,d,e,f,h,k,m,p,z)}catch(y){K(q);if(y!==y+0)throw y;J(1,0)}}function Bd(a,b,c,d,e,f,h,k,m,p,z,q,y,A,D,za){var Ab=L();try{lf(a,b,c,d,e,f,h,k,m,p,z,q,y,A,D,za)}catch(Db){K(Ab);if(Db!==Db+0)throw Db;J(1,0)}}
function jd(a,b,c,d){var e=L();try{return tf(a,b,c,d)}catch(f){K(e);if(f!==f+0)throw f;J(1,0)}}function hd(a,b,c,d,e){var f=L();try{return uf(a,b,c,d,e)}catch(h){K(f);if(h!==h+0)throw h;J(1,0)}}function Vc(a,b,c){var d=L();try{return bf(a,b,c)}catch(e){K(d);if(e!==e+0)throw e;J(1,0)}}function Tc(a,b,c){var d=L();try{return df(a,b,c)}catch(e){K(d);if(e!==e+0)throw e;J(1,0)}}function sd(a,b,c,d){var e=L();try{ef(a,b,c,d)}catch(f){K(e);if(f!==f+0)throw f;J(1,0)}}
function ee(){var a=G;a=Object.assign({},a);var b=d=>e=>d(e)>>>0,c=d=>()=>d()>>>0;a.dc=b(a.dc);a.Gc=c(a.Gc);a.Ic=b(a.Ic);a.ud=(d=>(e,f)=>d(e,f)>>>0)(a.ud);a.zd=b(a.zd);a.Ad=c(a.Ad);a.Ed=b(a.Ed);return a}function Ea(){if(0<Df)Ef=Ea;else if(n)xa?.(g),Sa();else{for(var a=Cf;0<a.length;)a.shift()(g);0<Df?Ef=Ea:(g.calledRun=!0,ua||(Sa(),xa?.(g)))}}var G;n||(G=await (Da()),Ea());g.PTR_SIZE=4;
g.webgpuInit=a=>{const b=new WeakMap;let c=1,d=void 0,e=void 0;g.webgpuRegisterDevice=k=>{if(void 0!==e)throw Error("another WebGPU EP inference session is being created.");if(k){var m=b.get(k);if(!m){m=le(0);const p=fh(k,m);m=[c++,m,p];b.set(k,m)}d=k;e=m[0];return m}d=void 0;e=0};const f=new Map;g.webgpuOnCreateSession=k=>{if(void 0!==e){var m=e;e=void 0;if(k){const p=he(m);f.set(k,p);0===m&&a(d??Y(p))}d=void 0}};g.webgpuOnReleaseSession=k=>{f.delete(k)};const h=Symbol("gpuBufferMetadata");g.webgpuRegisterBuffer=
(k,m,p)=>{if(p)return k[h]=[p,NaN],p;if(p=k[h])return p[1]++,p[0];m=f.get(m);if(void 0===m)throw Error("Invalid session handle passed to webgpuRegisterBuffer");m=eh(k,m);k[h]=[m,1];return m};g.webgpuUnregisterBuffer=k=>{const m=k[h];if(!m)throw Error("Buffer is not registered");m[1]--;0===m[1]&&(ke(m[0]),delete k[h])};g.webgpuGetBuffer=k=>Y(k);g.webgpuCreateDownloader=(k,m,p)=>{p=f.get(p);if(void 0===p)throw Error("Invalid session handle passed to webgpuRegisterBuffer");const z=Y(p),q=16*Math.ceil(Number(m)/
16);return async()=>{const y=z.createBuffer({size:q,usage:9});try{const A=z.createCommandEncoder();A.copyBufferToBuffer(k,0,y,0,q);z.queue.submit([A.finish()]);await y.mapAsync(GPUMapMode.READ);return y.getMappedRange().slice(0,m)}finally{y.destroy()}}};g.fe=(k,m)=>{var p=m.buffer;const z=m.byteOffset,q=m.byteLength;m=16*Math.ceil(Number(q)/16);k=Y(k);if(!d){var y=he(e);d=Y(y)}y=d.createBuffer({mappedAtCreation:!0,size:m,usage:6});const A=y.getMappedRange();(new Uint8Array(A)).set(new Uint8Array(p,
z,q));y.unmap();p=d.createCommandEncoder();p.copyBufferToBuffer(y,0,k,0,m);d.queue.submit([p.finish()]);y.destroy()}};
g.webnnInit=a=>{const b=a[0];[g.Ge,g.ge,g.webnnEnsureTensor,g.he,g.webnnDownloadTensor,g.Fe,g.webnnEnableTraceEvent]=a.slice(1);g.webnnReleaseTensorId=g.ge;g.webnnUploadTensor=g.he;g.webnnRegisterMLContext=g.Fe;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,k)=>b.registerMLConstant(c,d,e,f,h,g.Yc,k);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)};Ra?moduleRtn=g:moduleRtn=new Promise((a,b)=>{xa=a;ya=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();
