diff --git a/assets/js/acas-backend-instance.js b/assets/js/acas-backend-instance.js index 5193337..a310389 100644 --- a/assets/js/acas-backend-instance.js +++ b/assets/js/acas-backend-instance.js @@ -1109,6 +1109,29 @@ class BackendInstance { }, 100); break; + case 'stockfish-16-1-wasm': + const stockfish2 = new Worker('assets/libraries/stockfish-16.1.wasm/stockfish-16.1.js'); + let stockfish2_loaded = false; + + stockfish2.onmessage = async e => { + if(!stockfish2_loaded) { + stockfish2_loaded = true; + + this.engines.push({ + 'type': profileChessEngine, + 'engine': (method, a) => stockfish2[method](...a), + 'sendMsg': msg => stockfish2.postMessage(msg), + 'worker': stockfish2, + profile + }); + + this.engineStartNewGame('chess', profile); + } + + msgHandler(e.data); + }; + break; + default: // Fairy Stockfish NNUE WASM const stockfish = new Worker('assets/libraries/fairy-stockfish-nnue.wasm/stockfishWorker.js'); let stockfish_loaded = false; diff --git a/assets/libraries/stockfish-16.1.wasm/stockfish-16.1.js b/assets/libraries/stockfish-16.1.wasm/stockfish-16.1.js new file mode 100644 index 0000000..7dbad16 --- /dev/null +++ b/assets/libraries/stockfish-16.1.wasm/stockfish-16.1.js @@ -0,0 +1,8 @@ +/*! + * Stockfish.js 16.1 (c) 2024, Chess.com, LLC + * https://github.com/nmrugg/stockfish.js + * License: GPLv3 + * + * Based on Stockfish (c) T. Romstad, M. Costalba, J. Kiiski, G. Linscott and other contributors. + * https://github.com/official-stockfish/Stockfish + */!function(){var i,s,u,c,e,n,r;function f(){function e(e){function i(){return _.buffer!=g&&v(_.buffer),Z}function l(){return _.buffer!=g&&v(_.buffer),ee}function h(){return _.buffer!=g&&v(_.buffer),te}function P(){return _.buffer!=g&&v(_.buffer),ne}e=e||{},(c=c||(void 0!==e?e:{})).ready=new Promise(function(e,t){F=e,W=t}),"undefined"!=typeof global&&"[object process]"===Object.prototype.toString.call(global.process)&&"undefined"!=typeof fetch&&("undefined"==typeof XMLHttpRequest&&(global.XMLHttpRequest=function(){var n,r={open:function(e,t){n=t},send:function(){require("fs").readFile(n,function(e,t){r.readyState=4,e?(console.error(e),r.status=404,r.onerror(e)):(r.status=200,r.response=t,r.onreadystatechange(),r.onload())})}};return r}),fetch=null),c.print=function(e){c.listener?c.listener(e):console.log(e)},c.printErr=function(e){c.listener?c.listener(e):console.error(e)},c.terminate=function(){void 0!==E&&E.ra()};var c,F,W,B,t,n,L,U,Y=Object.assign({},c),H=[],s="./this.program",r=(e,t)=>{throw t},N="object"==typeof window,o="function"==typeof importScripts,u="object"==typeof process&&"object"==typeof process.versions&&"string"==typeof process.versions.node,d=c.ENVIRONMENT_IS_PTHREAD||!1,a="";function V(e){return c.locateFile?c.locateFile(e,a):a+e}if(u){a=o?require("path").dirname(a)+"/":__dirname+"/",U=()=>{L||(n=require("fs"),L=require("path"))},B=function(e,t){return U(),e=L.normalize(e),n.readFileSync(e,t?void 0:"utf8")},t=e=>e=(e=B(e,!0)).buffer?e:new Uint8Array(e),1{if(b())throw process.exitCode=e,t;t instanceof q||m("exiting due to exception: "+t),process.exit(e)},c.inspect=function(){return"[Emscripten Module object]"};let e;try{e=require("worker_threads")}catch(e){throw console.error('The "worker_threads" module is not supported in this node.js build - perhaps a newer version is needed?'),e}global.Worker=e.Worker}else(N||o)&&(o?a=self.location.href:"undefined"!=typeof document&&document.currentScript&&(a=document.currentScript.src),a=0!==(a=ht?ht:a).indexOf("blob:")?a.substr(0,a.replace(/[?#].*/,"").lastIndexOf("/")+1):"",u||(B=e=>{var t=new XMLHttpRequest;return t.open("GET",e,!1),t.send(null),t.responseText},o&&(t=e=>{var t=new XMLHttpRequest;return t.open("GET",e,!1),t.responseType="arraybuffer",t.send(null),new Uint8Array(t.response)})));u&&"undefined"==typeof performance&&(global.performance=require("perf_hooks").performance);var G,f,p=console.log.bind(console),$=console.warn.bind(console),X=(u&&(U(),p=e=>n.writeSync(1,e+"\n"),$=e=>n.writeSync(2,e+"\n")),c.print||p),m=c.printErr||$,z=(Object.assign(c,Y),c.arguments&&(H=c.arguments),c.thisProgram&&(s=c.thisProgram),c.quit&&(r=c.quit),c.wasmBinary&&(f=c.wasmBinary),c.noExitRuntime||!0);"object"!=typeof WebAssembly&&A("no native wasm support detected");var _,Q,J=!1;function K(e){var t=new TextDecoder(e);this.decode=e=>(e.buffer instanceof SharedArrayBuffer&&(e=new Uint8Array(e)),t.decode.call(t,e))}var g,Z,ee,te,ne,re="undefined"!=typeof TextDecoder?new K("utf8"):void 0;function ae(e,t,n){var r=t+n;for(n=t;e[n]&&!(r<=n);)++n;if(16>10,56320|1023&i)))):r+=String.fromCharCode(i)}return r}function y(e){return e?ae(l(),e,void 0):""}function w(e,t,n,r){if(0>6}else{if(o<=65535){if(r<=n+2)break;t[n++]=224|o>>12}else{if(r<=n+3)break;t[n++]=240|o>>18,t[n++]=128|o>>12&63}t[n++]=128|o>>6&63}t[n++]=128|63&o}}t[n]=0}}function oe(e){for(var t=0,n=0;n>2]=0,E.wa(t.worker))}var E={ba:[],ha:[],ma:[],Ca:function(){d&&E.Ea()},Xa:function(){},Ea:function(){E.receiveObjectTransfer=E.Ha,E.threadInit=E.xa,E.setExitStatus=E.Ja,z=!1},aa:{},Ja:function(){},ra:function(){for(var e in E.aa){var t=E.aa[e];t&&t.worker&&E.wa(t.worker)}for(e=0;e>2]=0;try{e()}finally{h()[lt>>2]=1}},Ha:function(){},xa:function(){for(var e in E.ma)E.ma.hasOwnProperty(e)&&E.ma[e]()},Fa:function(r,a){r.onmessage=e=>{var t,n=(e=e.data).cmd;r.da&&(E.za=r.da.sa),e.targetThread&&e.targetThread!=it()?(t=E.aa[e.bb])?t.worker.postMessage(e,e.transferList):m('Internal error! Worker sent a message "'+n+'" to target pthread '+e.targetThread+", but that thread no longer exists!"):"processQueuedMainThreadWork"===n?nt():"spawnThread"===n?xe(e):"cleanupThread"===n?we(e.thread):"killThread"===n?(e=e.thread,h()[e>>2]=0,n=E.aa[e],delete E.aa[e],n.worker.terminate(),ot(e),E.ha.splice(E.ha.indexOf(n.worker),1),n.worker.da=void 0):"cancelThread"===n?E.aa[e.thread].worker.postMessage({cmd:"cancel"}):"loaded"===n?(r.loaded=!0,a&&a(r),r.ga&&(r.ga(),delete r.ga)):"print"===n?X("Thread "+e.threadId+": "+e.text):"printErr"===n?m("Thread "+e.threadId+": "+e.text):"alert"===n?alert("Thread "+e.threadId+": "+e.text):"setimmediate"===e.target?r.postMessage(e):"onAbort"===n?c.onAbort&&c.onAbort(e.arg):m("worker sent an unknown command "+n),E.za=void 0},r.onerror=e=>{throw m("worker sent an error! "+e.filename+":"+e.lineno+": "+e.message),e},u&&(r.on("message",function(e){r.onmessage({data:e})}),r.on("error",function(e){r.onerror(e)}),r.on("detachedExit",function(){})),r.postMessage({cmd:"load",urlOrBlob:c.mainScriptUrlOrBlob||ht,wasmMemory:_,wasmModule:Q})},ya:function(){var e=V("stockfish.worker.js");E.ba.push(new Worker(e))},Ba:function(){return 0==E.ba.length&&(E.ya(),E.Fa(E.ba[0])),E.ba.pop()}};function ve(e){if(d)return I(1,0,e);try{pt(e)}catch(e){e instanceof q||"unwind"==e||r(1,e)}}c.establishStackSpace=function(){var e=it(),t=h()[e+44>>2],e=h()[e+48>>2];ut(t,t-e),ft(t)};var D=[];function be(e){var t=D[e];return t||(e>=D.length&&(D.length=e+1),D[e]=t=ue.get(e)),t}function xe(e){var t=E.Ba();if(!t)return 6;E.ha.push(t);var n=E.aa[e.qa]={worker:t,sa:e.qa},r=(t.da=n,{cmd:"run",start_routine:e.Ka,arg:e.fa,threadInfoStruct:e.qa});return t.ga=()=>{r.time=performance.now(),t.postMessage(r,e.Pa)},t.loaded&&(t.ga(),delete t.ga),0}c.invokeEntryPoint=function(e,t){return be(e)(t)};var Se=u?()=>{var e=process.hrtime();return 1e3*e[0]+e[1]/1e6}:d?()=>performance.now()-c.__performance_now_clock_drift:()=>performance.now(),Me=[null,[],[]],Ae={};function ke(e,t,n){return d?I(2,1,e,t,n):0}function Ee(e,t){if(d)return I(3,1,e,t)}function De(e,t,n){return d?I(4,1,e,t,n):0}function Ie(e,t,n){if(d)return I(5,1,e,t,n)}function I(a,o){var i=arguments.length-2,s=arguments;return ye(function(){for(var e=j(8*i),t=e>>3,n=0;n>2]=t,h()[s.la+4>>2]=n),!s.va&&s.Ra?s.la?(s=h()[s.la+8>>2],e=e?y(e):"",r=s,a=e,o=t,i=n,ye(function(){var e,t=j(12),n=0;a&&(n=oe(a)+1,e=st(n),w(a,l(),e,n),n=e),h()[t>>2]=n,h()[t+4>>2]=o,h()[t+8>>2]=i,at(r,657457152,0,n,t)}),1):-4:(e=!1,(s=s.va?s.va:s).ka&&s.ka.ja&&(e=0===(e=s.ka.ja.getParameter(2978))[0]&&0===e[1]&&e[2]===s.width&&e[3]===s.height),s.width=t,s.height=n,e&&s.ka.ja.viewport(0,0,t,n),0)):-4}function je(e,t,n){return d?I(6,1,e,t,n):Ce(e,t,n)}function qe(n,e){n.ta||(n.ta=n.getContext,n.getContext=function(e,t){return"webgl"==e==(t=n.ta(e,t))instanceof WebGLRenderingContext?t:null});var t,r,a,o=n.getContext("webgl",e);{if(o){if(o=o,e=e,r=st(8),h()[r+4>>2]=it(),a={Wa:r,attributes:e,version:e.Ga,ja:o},o.canvas&&(o.canvas.ka=a),(void 0===e.ua||e.ua)&&!(o=(o=a)||Pe).Da){o.Da=!0;var i=t=o.ja,s=i.getExtension("ANGLE_instanced_arrays"),u=(s&&(i.vertexAttribDivisor=function(e,t){s.vertexAttribDivisorANGLE(e,t)},i.drawArraysInstanced=function(e,t,n,r){s.drawArraysInstancedANGLE(e,t,n,r)},i.drawElementsInstanced=function(e,t,n,r,a){s.drawElementsInstancedANGLE(e,t,n,r,a)}),t),c=u.getExtension("OES_vertex_array_object"),f=(c&&(u.createVertexArray=function(){return c.createVertexArrayOES()},u.deleteVertexArray=function(e){c.deleteVertexArrayOES(e)},u.bindVertexArray=function(e){c.bindVertexArrayOES(e)},u.isVertexArray=function(e){return c.isVertexArrayOES(e)}),t),l=f.getExtension("WEBGL_draw_buffers");l&&(f.drawBuffers=function(e,t){l.drawBuffersWEBGL(e,t)}),t.Sa=t.getExtension("EXT_disjoint_timer_query"),t.Za=t.getExtension("WEBGL_multi_draw"),(t.getSupportedExtensions()||[]).forEach(function(e){e.includes("lose_context")||e.includes("debug")||t.getExtension(e)})}return r}return 0}}var Pe,Fe,We=["default","low-power","high-performance"],Be={};function Le(){if(!Fe){var e,t={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:("object"==typeof navigator&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",_:s||"./this.program"};for(e in Be)void 0===Be[e]?delete t[e]:t[e]=Be[e];var n=[];for(e in t)n.push(e+"="+t[e]);Fe=n}return Fe}function Ue(r,a){var o;return d?I(7,1,r,a):(o=0,Le().forEach(function(e,t){var n=a+o;for(t=h()[r+4*t>>2]=n,n=0;n>0]=e.charCodeAt(n);i()[t>>0]=0,o+=e.length+1}),0)}function Ye(e,t){var n,r;return d?I(8,1,e,t):(n=Le(),h()[e>>2]=n.length,r=0,n.forEach(function(e){r+=e.length+1}),h()[t>>2]=r,0)}function He(e){return d?I(9,1,e):0}function Ne(e,t,n,r){return d?I(10,1,e,t,n,r):(e=Ae.Va(e),t=Ae.Ta(e,t,n),h()[r>>2]=t,0)}function Ve(e,t,n,r,a){if(d)return I(11,1,e,t,n,r,a)}function Ge(e,t,n,r){if(d)return I(12,1,e,t,n,r);for(var a=0,o=0;o>2],s=h()[t+4>>2];t+=8;for(var u=0;u>2]=a,0}function R(e){return 0==e%4&&(0!=e%100||0==e%400)}function $e(e,t){for(var n=0,r=0;r<=t;n+=e[r++]);return n}var O=[31,29,31,30,31,30,31,31,30,31,30,31],T=[31,28,31,30,31,30,31,31,30,31,30,31];function C(e,t){for(e=new Date(e.getTime());0r-e.getDate())){e.setDate(e.getDate()+t);break}t-=r-e.getDate()+1,e.setDate(1),n<11?e.setMonth(n+1):(e.setMonth(0),e.setFullYear(e.getFullYear()+1))}return e}function Xe(e,t,n,r){function a(e,t,n){for(e="number"==typeof e?e.toString():e||"";e.length>2];for(c in r={Na:h()[r>>2],Ma:h()[r+4>>2],na:h()[r+8>>2],ia:h()[r+12>>2],ea:h()[r+16>>2],$:h()[r+20>>2],oa:h()[r+24>>2],pa:h()[r+28>>2],cb:h()[r+32>>2],La:h()[r+36>>2],Oa:f?y(f):""},n=y(n),f={"%c":"%a %b %d %H:%M:%S %Y","%D":"%m/%d/%y","%F":"%Y-%m-%d","%h":"%b","%r":"%I:%M:%S %p","%R":"%H:%M","%T":"%H:%M:%S","%x":"%m/%d/%y","%X":"%H:%M:%S","%Ec":"%c","%EC":"%C","%Ex":"%m/%d/%y","%EX":"%H:%M:%S","%Ey":"%y","%EY":"%Y","%Od":"%d","%Oe":"%e","%OH":"%H","%OI":"%I","%Om":"%m","%OM":"%M","%OS":"%S","%Ou":"%u","%OU":"%U","%OV":"%V","%Ow":"%w","%OW":"%W","%Oy":"%y"})n=n.replace(new RegExp(c,"g"),f[c]);var l,d,p="Sunday Monday Tuesday Wednesday Thursday Friday Saturday".split(" "),m="January February March April May June July August September October November December".split(" "),f={"%a":function(e){return p[e.oa].substring(0,3)},"%A":function(e){return p[e.oa]},"%b":function(e){return m[e.ea].substring(0,3)},"%B":function(e){return m[e.ea]},"%C":function(e){return o((e.$+1900)/100|0,2)},"%d":function(e){return o(e.ia,2)},"%e":function(e){return a(e.ia,2," ")},"%g":function(e){return u(e).toString().substring(2)},"%G":u,"%H":function(e){return o(e.na,2)},"%I":function(e){return 0==(e=e.na)?e=12:12t?0:(se(c,e),c.length-1)}E.Ca();var ze,Qe=[null,ve,ke,Ee,De,Ie,je,Ue,Ye,He,Ne,Ve,Ge],Je={p:function(e,t){Ke(e,t)},l:function(e){et(e,!o,1,!N),E.xa()},i:function(e){d?postMessage({cmd:"cleanupThread",thread:e}):we(e)},e:function(e,t,n,r){var a;return"undefined"==typeof SharedArrayBuffer?(m("Current environment does not support SharedArrayBuffer, pthreads are not available!"),6):(a=[],d&&0===a.length?tt(687865856,e,t,n,r):(e={Ka:n,qa:e,fa:r,Pa:a},d?(e.Qa="spawnThread",postMessage(e,a),0):xe(e)))},g:ke,v:Ee,u:De,w:Ie,B:function(){return 2097152},m:function(e,t){if(e==t)postMessage({cmd:"processQueuedMainThreadWork"});else if(d)postMessage({targetThread:e,cmd:"processThreadQueue"});else{if(!(e=(e=E.aa[e])&&e.worker))return;e.postMessage({cmd:"processThreadQueue"})}return 1},b:function(){A("")},x:function(e,t){if(0===e)e=Date.now();else{if(1!==e&&4!==e)return h()[Ze()>>2]=28,-1;e=Se()}return h()[t>>2]=e/1e3|0,h()[t+4>>2]=e%1e3*1e6|0,0},h:function(){u||o||(G=G||{})["Blocking on the main thread is very dangerous, see https://emscripten.org/docs/porting/pthreads.html#blocking-on-the-main-browser-thread"]||(G["Blocking on the main thread is very dangerous, see https://emscripten.org/docs/porting/pthreads.html#blocking-on-the-main-browser-thread"]=1,m("Blocking on the main thread is very dangerous, see https://emscripten.org/docs/porting/pthreads.html#blocking-on-the-main-browser-thread"))},c:Se,A:function(e,t,n){l().copyWithin(e,t,t+n)},C:function(e,t,n){Re.length=t,n>>=3;for(var r=0;r>>=0)<=t||2147483648>>16),v(_.buffer);var o=1;break e}catch(e){}o=void 0}if(o)return!0}return!1},j:function(e,t,n){return(Te(e)?Ce:je)(e,t,n)},n:function(){throw"unwind"},k:function(e,t){t>>=2;var n=h()[t+6];return t={alpha:!!h()[t],depth:!!h()[t+1],stencil:!!h()[t+2],antialias:!!h()[t+3],premultipliedAlpha:!!h()[t+4],preserveDrawingBuffer:!!h()[t+5],powerPreference:We[n],failIfMajorPerformanceCaveat:!!h()[t+7],Ga:h()[t+8],Ya:h()[t+9],ua:h()[t+10],Aa:h()[t+11],$a:h()[t+12],ab:h()[t+13]},!(e=Te(e))||t.Aa?0:qe(e,t)},r:Ue,s:Ye,d:function(e){pt(e)},f:He,t:Ne,o:Ve,y:Ge,a:_||c.wasmMemory,q:Xe},Ke=(!function(){function t(e,t){c.asm=e.exports,E.ma.push(c.asm.I),ue=c.asm.W,fe.unshift(c.asm.D),Q=t,d||(S--,c.monitorRunDependencies&&c.monitorRunDependencies(S),0==S&&(null!==me&&(clearInterval(me),me=null),M)&&(e=M,M=null,e()))}function n(e){t(e.instance,e.module)}function r(e){return(f||!N&&!o||"function"!=typeof fetch?Promise.resolve().then(_e):fetch(x,{credentials:"same-origin"}).then(function(e){if(e.ok)return e.arrayBuffer();throw"failed to load wasm binary file at '"+x+"'"}).catch(_e)).then(function(e){return WebAssembly.instantiate(e,a)}).then(function(e){return e}).then(e,function(e){m("failed to asynchronously prepare wasm: "+e),A(e)})}var a={a:Je};if(d||(S++,c.monitorRunDependencies&&c.monitorRunDependencies(S)),c.instantiateWasm)try{return c.instantiateWasm(a,t)}catch(e){return m("Module.instantiateWasm callback failed with error: "+e)}(f||"function"!=typeof WebAssembly.instantiateStreaming||he()||"function"!=typeof fetch?r(n):fetch(x,{credentials:"same-origin"}).then(function(e){return WebAssembly.instantiateStreaming(e,a).then(n,function(e){return m("wasm streaming compile failed: "+e),m("falling back to ArrayBuffer instantiation"),r(n)})})).catch(W)}(),c.___wasm_call_ctors=function(){return(c.___wasm_call_ctors=c.asm.D).apply(null,arguments)},c._main=function(){return(Ke=c._main=c.asm.E).apply(null,arguments)}),Ze=(c._command=function(){return(c._command=c.asm.F).apply(null,arguments)},c._isReady=function(){return(c._isReady=c.asm.G).apply(null,arguments)},c._free=function(){return(c._free=c.asm.H).apply(null,arguments)},c._emscripten_tls_init=function(){return(c._emscripten_tls_init=c.asm.I).apply(null,arguments)},c.___errno_location=function(){return(Ze=c.___errno_location=c.asm.J).apply(null,arguments)}),et=(c.__emscripten_thread_crashed=function(){return(c.__emscripten_thread_crashed=c.asm.K).apply(null,arguments)},c._emscripten_proxy_main=function(){return(c._emscripten_proxy_main=c.asm.L).apply(null,arguments)},c.__emscripten_thread_init=function(){return(et=c.__emscripten_thread_init=c.asm.M).apply(null,arguments)}),tt=(c._emscripten_current_thread_process_queued_calls=function(){return(c._emscripten_current_thread_process_queued_calls=c.asm.N).apply(null,arguments)},c._emscripten_sync_run_in_main_thread_4=function(){return(tt=c._emscripten_sync_run_in_main_thread_4=c.asm.O).apply(null,arguments)}),nt=c._emscripten_main_thread_process_queued_calls=function(){return(nt=c._emscripten_main_thread_process_queued_calls=c.asm.P).apply(null,arguments)},rt=c._emscripten_run_in_main_runtime_thread_js=function(){return(rt=c._emscripten_run_in_main_runtime_thread_js=c.asm.Q).apply(null,arguments)},at=c._emscripten_dispatch_to_thread_=function(){return(at=c._emscripten_dispatch_to_thread_=c.asm.R).apply(null,arguments)},ot=c.__emscripten_thread_free_data=function(){return(ot=c.__emscripten_thread_free_data=c.asm.S).apply(null,arguments)},it=(c.__emscripten_thread_exit=function(){return(c.__emscripten_thread_exit=c.asm.T).apply(null,arguments)},c._pthread_self=function(){return(it=c._pthread_self=c.asm.U).apply(null,arguments)}),st=c._malloc=function(){return(st=c._malloc=c.asm.V).apply(null,arguments)},ut=c._emscripten_stack_set_limits=function(){return(ut=c._emscripten_stack_set_limits=c.asm.X).apply(null,arguments)},ct=c.stackSave=function(){return(ct=c.stackSave=c.asm.Y).apply(null,arguments)},ft=c.stackRestore=function(){return(ft=c.stackRestore=c.asm.Z).apply(null,arguments)},j=c.stackAlloc=function(){return(j=c.stackAlloc=c.asm._).apply(null,arguments)},lt=c.__emscripten_allow_main_runtime_queued_calls=68944992;function q(e){this.name="ExitStatus",this.message="Program terminated with exit("+e+")",this.status=e}function dt(o){function e(){if(!ze&&(ze=!0,c.calledRun=!0,!J)){if(d||k(fe),d||k(le),F(c),c.onRuntimeInitialized&&c.onRuntimeInitialized(),mt){var e=o,t=c._emscripten_proxy_main,n=(e=e||[]).length+1,r=j(4*(n+1));h()[r>>2]=ie(s);for(var a=1;a>2)+a]=ie(e[a-1]);h()[(r>>2)+n]=0,t(n,r)}if(!d){if(c.postRun)for("function"==typeof c.postRun&&(c.postRun=[c.postRun]);c.postRun.length;)e=c.postRun.shift(),de.unshift(e);k(de)}}}if(o=o||H,!(0>>0)),o=s.slice(0,-t.length);for(e=0;e{e=new WebAssembly.Instance(r.wasmModule,e);return t(e),r.wasmModule=null,e.exports},self.onmessage=e=>{try{var t;if("load"===e.data.cmd)r.wasmModule=e.data.wasmModule,r.wasmMemory=e.data.wasmMemory,r.buffer=r.wasmMemory.buffer,r.ENVIRONMENT_IS_PTHREAD=!0,"string"==typeof e.data.urlOrBlob?importScripts(e.data.urlOrBlob):(t=URL.createObjectURL(e.data.urlOrBlob),importScripts(t),URL.revokeObjectURL(t)),i(r).then(function(e){r=e});else if("run"===e.data.cmd){r.__performance_now_clock_drift=performance.now()-e.data.time,r.__emscripten_thread_init(e.data.threadInfoStruct,0,0,1),r.establishStackSpace(),r.PThread.receiveObjectTransfer(e.data),r.PThread.threadInit();try{var n=r.invokeEntryPoint(e.data.start_routine,e.data.arg);r.keepRuntimeAlive()?r.PThread.setExitStatus(n):r.__emscripten_thread_exit(n)}catch(e){if("unwind"!=e){if(!(e instanceof r.ExitStatus))throw e;r.keepRuntimeAlive()||r.__emscripten_thread_exit(e.status)}}}else"cancel"===e.data.cmd?r._pthread_self()&&r.__emscripten_thread_exit(-1):"setimmediate"!==e.data.target&&("processThreadQueue"===e.data.cmd?r._pthread_self()&&r._emscripten_current_thread_process_queued_calls():"processProxyingQueue"===e.data.cmd?r._pthread_self()&&r._emscripten_proxy_execute_queue(e.data.queue):(o("worker.js received unknown command "+e.data.cmd),o(e.data)))}catch(e){throw o("worker.js onmessage() captured an uncaught exception: "+e),e&&e.stack&&o(e.stack),r.__emscripten_thread_crashed&&r.__emscripten_thread_crashed(),e}},self._origOnmessage=self.onmessage,self.onmessage=function(e){"load"===e.data.cmd?(r.wasmModule=e.data.wasmModule,r.wasmMemory=e.data.wasmMemory,r.buffer=r.wasmMemory.buffer,r.ENVIRONMENT_IS_PTHREAD=!0,e.data.workerID&&(r.workerID=e.data.workerID),e.data.wasmSourceMap&&(r.wasmSourceMapData=e.data.wasmSourceMap),e.data.wasmOffsetConverter&&(r.wasmOffsetData=e.data.wasmOffsetConverter),(i=f())(r).then(function(e){r=e})):self._origOnmessage(e)}}():"undefined"!=typeof onmessage&&("undefined"==typeof window||void 0===window.document)||"undefined"!=typeof global&&"[object process]"===Object.prototype.toString.call(global.process)?(e="undefined"!=typeof global&&"[object process]"===Object.prototype.toString.call(global.process),n={},r=[],e?require.main===module?(c=require("path"),s=c.join(__dirname,c.basename(__filename,c.extname(__filename))+".wasm"),n={locateFile:function(e){return-1