all repos — emchess @ main

public/stockfish/stockfish-18-lite-single.js (view raw)

 1
 2
 3
 4
 5
 6
 7
 8
 9
 10
 11
/*!
 * Stockfish.js 18 (c) 2026, 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
 *
 * Nets by Linmiao Xu (linrock)
 * https://tests.stockfishchess.org/nns?network_name=nn-9067e33176e
 */!function(){var u,s,e,c,r,n,l=7295411;function t(){function e(e){e=e||{},(f=f||(void 0!==e?e:{})).ready=new Promise(function(e,n){j=e,a=n}),"undefined"!=typeof global&&"[object process]"===Object.prototype.toString.call(global.process)&&"undefined"!=typeof fetch&&("undefined"==typeof XMLHttpRequest&&(global.XMLHttpRequest=function(){var t,r={open:function(e,n){t=n},send:function(){require("fs").readFile(t,function(e,n){r.readyState=4,e?(console.error(e),r.status=404,r.onerror(e)):(r.status=200,r.response=n,r.onreadystatechange(),r.onload())})}};return r}),fetch=null),f.print=function(e){f.listener?f.listener(e):console.log(e)},f.printErr=function(e){f.listener?f.listener(e):console.error(e)},f.terminate=function(){"undefined"!=typeof PThread&&PThread.Z()};var f,j,a,n,t,H,r,k,i,o=Object.assign({},f),u=[],s="./this.program",c=(e,n)=>{throw n},U="object"==typeof window,l="function"==typeof importScripts,W="object"==typeof process&&"object"==typeof process.versions&&"string"==typeof process.versions.node,p="",L=(W?(p=l?require("path").dirname(p)+"/":__dirname+"/",k=()=>{r||(H=require("fs"),r=require("path"))},n=function(e,n){return k(),e=r.normalize(e),H.readFileSync(e,n?void 0:"utf8")},t=e=>e=(e=n(e,!0)).buffer?e:new Uint8Array(e),1<process.argv.length&&(s=process.argv[1].replace(/\\/g,"/")),u=process.argv.slice(2),process.on("uncaughtException",function(e){if(!(e instanceof Y))throw e}),process.on("unhandledRejection",function(e){throw e}),c=(e,n)=>{if(m||0<_)throw process.exitCode=e,n;n instanceof Y||d("exiting due to exception: "+n),process.exit(e)},f.inspect=function(){return"[Emscripten Module object]"}):(U||l)&&(l?p=self.location.href:"undefined"!=typeof document&&document.currentScript&&(p=document.currentScript.src),p=0!==(p=je?je:p).indexOf("blob:")?p.substr(0,p.replace(/[?#].*/,"").lastIndexOf("/")+1):"",n=e=>{var n=new XMLHttpRequest;return n.open("GET",e,!1),n.send(null),n.responseText},l)&&(t=e=>{var n=new XMLHttpRequest;return n.open("GET",e,!1),n.responseType="arraybuffer",n.send(null),new Uint8Array(n.response)}),f.print||console.log.bind(console)),d=f.printErr||console.warn.bind(console),m=(Object.assign(f,o),f.arguments&&(u=f.arguments),f.thisProgram&&(s=f.thisProgram),f.quit&&(c=f.quit),f.wasmBinary&&(i=f.wasmBinary),f.noExitRuntime||!0);"object"!=typeof WebAssembly&&A("no native wasm support detected");var q,B,h,y,g,N,v=!1,K="undefined"!=typeof TextDecoder?new TextDecoder("utf8"):void 0;function X(e,n,t){var r=n+t;for(t=n;e[t]&&!(r<=t);)++t;if(16<t-n&&e.subarray&&K)return K.decode(e.subarray(n,t));for(r="";n<t;){var o,a,i=e[n++];128&i?(o=63&e[n++],192==(224&i)?r+=String.fromCharCode((31&i)<<6|o):(a=63&e[n++],(i=224==(240&i)?(15&i)<<12|o<<6|a:(7&i)<<18|o<<12|a<<6|63&e[n++])<65536?r+=String.fromCharCode(i):(i-=65536,r+=String.fromCharCode(55296|i>>10,56320|1023&i)))):r+=String.fromCharCode(i)}return r}function z(e){return e?X(y,e,void 0):""}function G(e,n,t,r){if(0<r){r=t+r-1;for(var o=0;o<e.length;++o){var a=e.charCodeAt(o);if((a=55296<=a&&a<=57343?65536+((1023&a)<<10)|1023&e.charCodeAt(++o):a)<=127){if(r<=t)break;n[t++]=a}else{if(a<=2047){if(r<=t+1)break;n[t++]=192|a>>6}else{if(a<=65535){if(r<=t+2)break;n[t++]=224|a>>12}else{if(r<=t+3)break;n[t++]=240|a>>18,n[t++]=128|a>>12&63}n[t++]=128|a>>6&63}n[t++]=128|63&a}}n[t]=0}}function V(e){for(var n=0,t=0;t<e.length;++t){var r=e.charCodeAt(t);(r=55296<=r&&r<=57343?65536+((1023&r)<<10)|1023&e.charCodeAt(++t):r)<=127?++n:n=r<=2047?n+2:r<=65535?n+3:n+4}return n}function J(e){var n=V(e)+1,t=P(n);return G(e,h,t,n),t}function Z(){var e=q.buffer;B=e,f.HEAP8=h=new Int8Array(e),f.HEAP16=new Int16Array(e),f.HEAP32=g=new Int32Array(e),f.HEAPU8=y=new Uint8Array(e),f.HEAPU16=new Uint16Array(e),f.HEAPU32=new Uint32Array(e),f.HEAPF32=new Float32Array(e),f.HEAPF64=N=new Float64Array(e)}var w,$=[],Q=[],ee=[],ne=[],te=!1,_=0,b=0,re=null,S=null;function A(e){throw f.onAbort&&f.onAbort(e),d(e="Aborted("+e+")"),v=!0,e=new WebAssembly.RuntimeError(e+". Build with -s ASSERTIONS=1 for more info."),a(e),e}function oe(){return w.startsWith("data:application/octet-stream;base64,")}function ae(){var e=w;try{if(e==w&&i)return new Uint8Array(i);if(t)return t(e);throw"both async and sync fetching of the wasm failed"}catch(e){A(e)}}f.preloadedImages={},f.preloadedAudios={},w="stockfish.wasm",oe()||(o=w,w=f.locateFile?f.locateFile(o,p):p+o);var ie={6678104:function(){try{f.onDoneSearching()}catch(e){}}};function D(e){for(;0<e.length;){var n,t=e.shift();"function"==typeof t?t(f):"number"==typeof(n=t.S)?void 0===t.P?Te.call(null,n):Oe.apply(null,[n,t.P]):n(void 0===t.P?null:t.P)}}function ue(e){e instanceof Y||"unwind"==e||c(1,e)}var se=[null,[],[]],ce={},le=W?()=>{var e=process.hrtime();return 1e3*e[0]+e[1]/1e6}:()=>performance.now(),fe=[];function pe(e){if(!te&&!v)try{e()}catch(e){ue(e)}}var de,me={};function he(){if(!de){var e,n={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 me)void 0===me[e]?delete n[e]:n[e]=me[e];var t=[];for(e in n)t.push(e+"="+n[e]);de=t}return de}function M(e){return 0==e%4&&(0!=e%100||0==e%400)}function ye(e,n){for(var t=0,r=0;r<=n;t+=e[r++]);return t}var x=[31,29,31,30,31,30,31,31,30,31,30,31],R=[31,28,31,30,31,30,31,31,30,31,30,31];function C(e,n){for(e=new Date(e.getTime());0<n;){var t=e.getMonth(),r=(M(e.getFullYear())?x:R)[t];if(!(n>r-e.getDate())){e.setDate(e.getDate()+n);break}n-=r-e.getDate()+1,e.setDate(1),t<11?e.setMonth(t+1):(e.setMonth(0),e.setFullYear(e.getFullYear()+1))}return e}function ge(e,n,t,r){function o(e,n,t){for(e="number"==typeof e?e.toString():e||"";e.length<n;)e=t[0]+e;return e}function a(e,n){return o(e,n,"0")}function i(e,n){function t(e){return e<0?-1:0<e?1:0}var r;return r=0===(r=t(e.getFullYear()-n.getFullYear()))&&0===(r=t(e.getMonth()-n.getMonth()))?t(e.getDate()-n.getDate()):r}function u(e){switch(e.getDay()){case 0:return new Date(e.getFullYear()-1,11,29);case 1:return e;case 2:return new Date(e.getFullYear(),0,3);case 3:return new Date(e.getFullYear(),0,2);case 4:return new Date(e.getFullYear(),0,1);case 5:return new Date(e.getFullYear()-1,11,31);case 6:return new Date(e.getFullYear()-1,11,30)}}function s(e){e=C(new Date(e.A+1900,0,1),e.O);var n=new Date(e.getFullYear()+1,0,4),t=u(new Date(e.getFullYear(),0,4)),n=u(n);return i(t,e)<=0?i(n,e)<=0?e.getFullYear()+1:e.getFullYear():e.getFullYear()-1}var c,l=g[r+40>>2];for(c in r={V:g[r>>2],U:g[r+4>>2],M:g[r+8>>2],L:g[r+12>>2],K:g[r+16>>2],A:g[r+20>>2],N:g[r+24>>2],O:g[r+28>>2],$:g[r+32>>2],T:g[r+36>>2],W:l?z(l):""},t=z(t),l={"%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"})t=t.replace(new RegExp(c,"g"),l[c]);var f,p,d="Sunday Monday Tuesday Wednesday Thursday Friday Saturday".split(" "),m="January February March April May June July August September October November December".split(" "),l={"%a":function(e){return d[e.N].substring(0,3)},"%A":function(e){return d[e.N]},"%b":function(e){return m[e.K].substring(0,3)},"%B":function(e){return m[e.K]},"%C":function(e){return a((e.A+1900)/100|0,2)},"%d":function(e){return a(e.L,2)},"%e":function(e){return o(e.L,2," ")},"%g":function(e){return s(e).toString().substring(2)},"%G":s,"%H":function(e){return a(e.M,2)},"%I":function(e){return 0==(e=e.M)?e=12:12<e&&(e-=12),a(e,2)},"%j":function(e){return a(e.L+ye(M(e.A+1900)?x:R,e.K-1),3)},"%m":function(e){return a(e.K+1,2)},"%M":function(e){return a(e.U,2)},"%n":function(){return"\n"},"%p":function(e){return 0<=e.M&&e.M<12?"AM":"PM"},"%S":function(e){return a(e.V,2)},"%t":function(){return"\t"},"%u":function(e){return e.N||7},"%U":function(e){var n=new Date(e.A+1900,0,1),t=0===n.getDay()?n:C(n,7-n.getDay());return i(t,e=new Date(e.A+1900,e.K,e.L))<0?a(Math.ceil((31-t.getDate()+(ye(M(e.getFullYear())?x:R,e.getMonth()-1)-31)+e.getDate())/7),2):0===i(t,n)?"01":"00"},"%V":function(e){var n=new Date(e.A+1901,0,4),t=u(new Date(e.A+1900,0,4)),n=u(n),r=C(new Date(e.A+1900,0,1),e.O);return i(r,t)<0?"53":i(n,r)<=0?"01":a(Math.ceil((t.getFullYear()<e.A+1900?e.O+32-t.getDate():e.O+1-t.getDate())/7),2)},"%w":function(e){return e.N},"%W":function(e){var n=new Date(e.A,0,1),t=1===n.getDay()?n:C(n,0===n.getDay()?1:7-n.getDay()+1);return i(t,e=new Date(e.A+1900,e.K,e.L))<0?a(Math.ceil((31-t.getDate()+(ye(M(e.getFullYear())?x:R,e.getMonth()-1)-31)+e.getDate())/7),2):0===i(t,n)?"01":"00"},"%y":function(e){return(e.A+1900).toString().substring(2)},"%Y":function(e){return e.A+1900},"%z":function(e){var n=0<=(e=e.T);return e=Math.abs(e)/60,(n?"+":"-")+String("0000"+(e/60*100+e%60)).slice(-4)},"%Z":function(e){return e.W},"%%":function(){return"%"}};for(c in t=t.replace(/%%/g,"\0\0"),l)t.includes(c)&&(t=t.replace(new RegExp(c,"g"),l[c](r)));return t=t.replace(/\0\0/g,"%"),f=t,p=Array(V(f)+1),G(f,p,0,p.length),(c=p).length>n?0:(h.set(c,e),c.length-1)}function F(e){try{e()}catch(e){A(e)}}var E=0,O=null,T=[],ve={},we={},_e=0,be=null,Se=[];function Ae(t){var e,r={};for(e in t)!function(e){var n=t[e];r[e]="function"==typeof n?function(){T.push(e);try{return n.apply(null,arguments)}finally{v||(T.pop()!==e&&A(void 0),O&&1===E&&0===T.length&&(E=0,F(f._asyncify_stop_unwind),"undefined"!=typeof Fibers)&&Fibers.aa())}}:n}(e);return r}function De(e){var o,a,n,t;v||(0===E?(a=o=!1,e(()=>{if(!v&&(o=!0,a)){E=2,F(()=>f._asyncify_start_rewind(O)),"undefined"!=typeof Browser&&Browser.R.S&&Browser.R.resume();var n=!1;try{var t=(0,f.asm[we[g[O+8>>2]]])()}catch(e){t=e,n=!0}var e,r=!1;if(O||(e=be)&&(be=null,(n?e.reject:e.resolve)(t),r=!0),n&&!r)throw t}}),a=!0,o||(E=1,e=Ce(10485772),n=e+12,g[e>>2]=n,g[e+4>>2]=n+10485760,n=T[0],void 0===(t=ve[n])&&(t=_e++,ve[n]=t,we[t]=n),g[e+8>>2]=t,O=e,F(()=>f._asyncify_start_unwind(O)),"undefined"!=typeof Browser&&Browser.R.S&&Browser.R.pause())):2===E?(E=0,F(f._asyncify_stop_rewind),xe(O),O=null,Se.forEach(e=>pe(e))):A("invalid state: "+E))}var I,Me={d:function(){return 0},i:function(){},r:function(){return 0},f:function(){},a:function(){A("")},g:function(e,n){if(0===e)e=Date.now();else{if(1!==e&&4!==e)return g[Re()>>2]=28,-1;e=le()}return g[n>>2]=e/1e3|0,g[n+4>>2]=e%1e3*1e6|0,0},j:function(e,n,t){var r;for(fe.length=0,t>>=2;r=y[n++];)(r=r<105)&&1&t&&t++,fe.push(r?N[t++>>1]:g[t]),++t;return ie[e].apply(null,fe)},h:function(e,n,t){y.copyWithin(e,n,n+t)},c:function(e){var n=y.length;if(!(2147483648<(e>>>=0)))for(var t=1;t<=4;t*=2){var r=n*(1+.2/t),r=Math.min(r,e+100663296),o=Math;r=Math.max(e,r),o=o.min.call(o,2147483648,r+(65536-r%65536)%65536);e:{try{q.grow(o-B.byteLength+65535>>>16),Z();var a=1;break e}catch(e){}a=void 0}if(a)return!0}return!1},k:function(t){De(e=>{return n=e,setTimeout(function(){pe(n)},t);var n})},n:function(r,o){var a=0;return he().forEach(function(e,n){var t=o+a;for(n=g[r+4*n>>2]=t,t=0;t<e.length;++t)h[n++>>0]=e.charCodeAt(t);h[n>>0]=0,a+=e.length+1}),0},o:function(e,n){var t=he(),r=(g[e>>2]=t.length,0);return t.forEach(function(e){r+=e.length+1}),g[n>>2]=r,0},b:function(e){Pe(e)},e:function(){return 0},q:function(e,n,t,r){return e=ce.Y(e),n=ce.X(e,n,t),g[r>>2]=n,0},l:function(){},p:function(e,n,t,r){for(var o=0,a=0;a<t;a++){var i=g[n>>2],u=g[n+4>>2];n+=8;for(var s=0;s<u;s++){var c=y[i+s],l=se[e];0===c||10===c?((1===e?L:d)(X(l,0)),l.length=0):l.push(c)}o+=u}return g[r>>2]=o,0},m:ge},xe=(!function(){function n(e){e=Ae(e=e.exports),f.asm=e,q=f.asm.s,Z(),Q.unshift(f.asm.t),b--,f.monitorRunDependencies&&f.monitorRunDependencies(b),0==b&&(null!==re&&(clearInterval(re),re=null),S)&&(e=S,S=null,e())}function t(e){n(e.instance)}function r(e){return(i||!U&&!l||"function"!=typeof fetch?Promise.resolve().then(ae):fetch(w,{credentials:"same-origin"}).then(function(e){if(e.ok)return e.arrayBuffer();throw"failed to load wasm binary file at '"+w+"'"}).catch(ae)).then(function(e){return WebAssembly.instantiate(e,o)}).then(function(e){return e}).then(e,function(e){d("failed to asynchronously prepare wasm: "+e),A(e)})}var o={a:Me};if(b++,f.monitorRunDependencies&&f.monitorRunDependencies(b),f.instantiateWasm)try{var e=f.instantiateWasm(o,n);return Ae(e)}catch(e){return d("Module.instantiateWasm callback failed with error: "+e)}(i||"function"!=typeof WebAssembly.instantiateStreaming||oe()||"function"!=typeof fetch?r(t):fetch(w,{credentials:"same-origin"}).then(function(e){return WebAssembly.instantiateStreaming(e,o).then(t,function(e){return d("wasm streaming compile failed: "+e),d("falling back to ArrayBuffer instantiation"),r(t)})})).catch(a)}(),f.___wasm_call_ctors=function(){return(f.___wasm_call_ctors=f.asm.t).apply(null,arguments)},f._main=function(){return(f._main=f.asm.u).apply(null,arguments)},f._command=function(){return(f._command=f.asm.v).apply(null,arguments)},f._isSearching=function(){return(f._isSearching=f.asm.w).apply(null,arguments)},f._free=function(){return(xe=f._free=f.asm.x).apply(null,arguments)}),Re=f.___errno_location=function(){return(Re=f.___errno_location=f.asm.y).apply(null,arguments)},Ce=f._malloc=function(){return(Ce=f._malloc=f.asm.z).apply(null,arguments)},Fe=f.stackSave=function(){return(Fe=f.stackSave=f.asm.B).apply(null,arguments)},Ee=f.stackRestore=function(){return(Ee=f.stackRestore=f.asm.C).apply(null,arguments)},P=f.stackAlloc=function(){return(P=f.stackAlloc=f.asm.D).apply(null,arguments)},Oe=f.dynCall_vi=function(){return(Oe=f.dynCall_vi=f.asm.E).apply(null,arguments)},Te=f.dynCall_v=function(){return(Te=f.dynCall_v=f.asm.F).apply(null,arguments)};function Y(e){this.name="ExitStatus",this.message="Program terminated with exit("+e+")",this.status=e}function Ie(a){function e(){if(!I&&(I=!0,f.calledRun=!0,!v)){if(D(Q),D(ee),j(f),f.onRuntimeInitialized&&f.onRuntimeInitialized(),Ye){var e=a,n=f._main,t=(e=e||[]).length+1,r=P(4*(t+1));g[r>>2]=J(s);for(var o=1;o<t;o++)g[(r>>2)+o]=J(e[o-1]);g[(r>>2)+t]=0;try{Pe(n(t,r))}catch(e){ue(e)}}if(f.postRun)for("function"==typeof f.postRun&&(f.postRun=[f.postRun]);f.postRun.length;)e=f.postRun.shift(),ne.unshift(e);D(ne)}}if(a=a||u,!(0<b)){if(f.preRun)for("function"==typeof f.preRun&&(f.preRun=[f.preRun]);f.preRun.length;)n=void 0,n=f.preRun.shift(),$.unshift(n);D($),0<b||(f.setStatus?(f.setStatus("Running..."),setTimeout(function(){setTimeout(function(){f.setStatus("")},1),e()},1)):e())}var n}function Pe(e){m||0<_||(te=!0),m||0<_||(f.onExit&&f.onExit(e),v=!0),c(e,new Y(e))}if(f._asyncify_start_unwind=function(){return(f._asyncify_start_unwind=f.asm.G).apply(null,arguments)},f._asyncify_stop_unwind=function(){return(f._asyncify_stop_unwind=f.asm.H).apply(null,arguments)},f._asyncify_start_rewind=function(){return(f._asyncify_start_rewind=f.asm.I).apply(null,arguments)},f._asyncify_stop_rewind=function(){return(f._asyncify_stop_rewind=f.asm.J).apply(null,arguments)},f.ccall=function(e,n,t,r,o){function a(e){return--_,0!==s&&Ee(s),"string"===n?z(e):"boolean"===n?!!e:e}var i={string:function(e){var n,t=0;return null!=e&&0!==e&&(n=1+(e.length<<2),t=P(n),G(e,y,t,n)),t},array:function(e){var n=P(e.length);return h.set(e,n),n}},u=(e=f["_"+e],[]),s=0;if(r)for(var c=0;c<r.length;c++){var l=i[t[c]];l?(0===s&&(s=Fe()),u[c]=l(r[c])):u[c]=r[c]}return t=O,r=e.apply(null,u),_+=1,o=o&&o.async,O!=t?new Promise((e,n)=>{be={resolve:e,reject:n}}).then(a):(r=a(r),o?Promise.resolve(r):r)},S=function e(){I||Ie(),I||(S=e)},f.run=Ie,f.preInit)for("function"==typeof f.preInit&&(f.preInit=[f.preInit]);0<f.preInit.length;)f.preInit.pop()();var Ye=!0;return f.noInitialRun&&(Ye=!1),Ie(),e.ready}var je;je="undefined"!=typeof document&&document.currentScript?document.currentScript.src:void 0,"undefined"!=typeof __filename&&(je=je||__filename);return"object"==typeof exports&&"object"==typeof module?module.exports=e:"function"==typeof define&&define.amd?define([],function(){return e}):"object"==typeof exports&&(exports.Stockfish=e),e}function o(e){if(c.ccall("command",null,["string"],[e],{async:"undefined"!=typeof IS_ASYNCIFY&&/^go\b/.test(e)}),"quit"===e){try{c.terminate()}catch(e){}try{self.close()}catch(e){}try{process.exit()}catch(e){}}}function a(){for(;n.length&&(!c._isSearching||!c._isSearching());)o(n.shift())}function i(e){"go"===(e=e.trim()).substring(0,2)||"setoption"===e.substring(0,9)?n.push(e):o(e),a()}function f(){if(c._isReady&&!c._isReady())return setTimeout(f,10);var t;"undefined"==typeof IS_ASYNCIFY?c.onDoneSearching=a:c.onDoneSearching=function(){setTimeout(a,1)},c.processCommand=i,r.length&&(t=0,function e(){for(var n;t<r.length;){if((n=r[t++]).startsWith("sleep "))return setTimeout(e,n.slice(6));i(n)}}())}function p(e,n,t){var t=e/((Date.now()-t||1)/1e3),r=0<t&&e<n?(n-e)/t:0;return{percent:e/n,loaded:e,total:n,speedBytesPerSec:t,speedText:(e=t)<1024?Math.round(e)+" B/s":e<1048576?(e/1024).toFixed(1)+" KB/s":(e/1048576).toFixed(1)+" MB/s",eta:r,etaText:!(n=r)||n<0?"":n<60?Math.ceil(n)+" sec":Math.round(n/60)+" min"}}function d(n){var r,o;function a(e,u){return fetch(e).then(function(e){var o,a,n,t,r,i=Date.now();if(e.ok)return o=l,a=0,n=e.body.getReader(),t=new ReadableStream({start:function(r){!function t(){n.read().then(function(e){var n=e.done,e=e.value;n?(u(i,o,o),r.close()):(a+=e.byteLength,u(i,a,o),r.enqueue(e),t())}).catch(function e(n){r.error(n),e(n)})}()}}),r=new Headers(e.headers),new Response(t,{status:e.status,statusText:e.statusText,headers:r});throw new Error("HTTP "+e.status+": "+e.statusText)})}function i(){return function(e,n,t){s&&(n=p(n,t,e),o=n,r=r||setTimeout(function(){r=null,s.postMessage(o),1<=o.percent&&(s.close(),s=null)},4))}}c={locateFile:function(e){return-1<e.indexOf(".wasm")?-1<e.indexOf(".wasm.map")?u+".map":n||u:self.location.origin+self.location.pathname+"#"+u+",worker"},listener:function(e){postMessage(e)},instantiateWasm:function(n,t){var e=i();return a(u,e).then(function(e){return WebAssembly.instantiateStreaming(e,n)}).then(function(e){return t(e.instance,e.module),e.instance.exports}).catch(function(e){throw console.error("WASM streaming failed:",e),e})}},t()(c).then(f).catch(function(e){setTimeout(function(){throw e},1)})}"undefined"!=typeof self&&"worker"===self.location.hash.split(",")[1]||"undefined"!=typeof global&&"[object process]"===Object.prototype.toString.call(global.process)&&!require("worker_threads").isMainThread||("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),c={},r=[],n=[],e?require.main===module?(e=require("path"),u=e.join(__dirname,e.basename(__filename,e.extname(__filename))+".wasm"),c={locateFile:function(e){return-1<e.indexOf(".wasm")?-1<e.indexOf(".wasm.map")?u+".map":u:__filename},listener:function(e){process.stdout.write(e+"\n")}},r=process.argv.slice(2),t()(c).then(f),require("readline").createInterface({input:process.stdin,output:process.stdout,completer:function(n){var e=["binc ","btime ","confidence ","depth ","infinite ","mate ","maxdepth ","maxtime ","mindepth ","mintime ","moves ","movestogo ","movetime ","ponder ","searchmoves ","shallow ","winc ","wtime "];function t(e){return 0===e.toLowerCase().indexOf(n.toLowerCase())}var r=["compiler","d","eval","flip","go ","isready","ponderhit","position fen ","position startpos","position startpos moves ","quit","setoption name Clear Hash value true","setoption name Hash value ","setoption name Minimum Thinking Time value ","setoption name Move Overhead value ","setoption name MultiPV value ","setoption name Ponder value ","setoption name Skill Level value ","setoption name Slow Mover value ","setoption name Threads value ","setoption name UCI_Chess960 value false","setoption name UCI_Chess960 value true","setoption name UCI_LimitStrength value true","setoption name UCI_LimitStrength value false","setoption name UCI_Elo value ","setoption name UCI_ShowWDL value true","setoption name UCI_ShowWDL value false","setoption name nodestime value ","stop","uci","ucinewgame"].filter(t);return[r=r.length?r:(n=n.replace(/^.*\s/,""))?e.filter(t):e,n]},historySize:100}).on("line",function(e){e&&(c.processCommand?c.processCommand(e):r.push(e),"quit"===e)&&process.exit()}).on("close",function(){process.exit()}).setPrompt("")):module.exports=t:(e=self.location.hash.substr(1).split(","),u=decodeURIComponent(e[0]||location.origin+location.pathname.replace(/\.js$/i,".wasm")),d(),onmessage=onmessage||function(e){if("setoption name CanOutputEngineDownloadProgress"===e.data)postMessage("info WillOutputEngineDownloadProgress");else if(e.data.progressPort)s=e.data.progressPort;else if(c.processCommand?c.processCommand(e.data):r.push(e.data),"quit"===e.data)try{self.close()}catch(e){}})):"object"==typeof document&&document.currentScript?document.currentScript._exports=t():t())}();