@areb0s/scip.js 1.1.3 → 1.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/scip.min.js CHANGED
@@ -1,10 +1,16 @@
1
- (function(pe){"use strict";var _r=function(){if(typeof SCIP_BASE_URL<"u"&&SCIP_BASE_URL)return SCIP_BASE_URL+(SCIP_BASE_URL.endsWith("/")?"":"/");if(typeof document<"u"&&document.currentScript&&document.currentScript.src){var w=document.currentScript.src;return w.substring(0,w.lastIndexOf("/")+1)}return"https://cdn.jsdelivr.net/npm/@areb0s/scip.js@latest/dist/"}(),we=(()=>{var w=_r;return function(F={}){var u=F,L,k;u.ready=new Promise((r,e)=>{L=r,k=e});var C=Object.assign({},u),Q=[],X="./this.program",x=(r,e)=>{throw e},dr=typeof window=="object",tr=typeof importScripts=="function",Br=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string",B="";function Er(r){return u.locateFile?u.locateFile(r,B):B+r}var j,ir,vr;(dr||tr)&&(tr?B=self.location.href:typeof document<"u"&&document.currentScript&&(B=document.currentScript.src),w&&(B=w),B.startsWith("blob:")?B="":B=B.substr(0,B.replace(/[?#].*/,"").lastIndexOf("/")+1),j=r=>{var e=new XMLHttpRequest;return e.open("GET",r,!1),e.send(null),e.responseText},tr&&(vr=r=>{var e=new XMLHttpRequest;return e.open("GET",r,!1),e.responseType="arraybuffer",e.send(null),new Uint8Array(e.response)}),ir=(r,e,t)=>{var o=new XMLHttpRequest;o.open("GET",r,!0),o.responseType="arraybuffer",o.onload=()=>{if(o.status==200||o.status==0&&o.response){e(o.response);return}t()},o.onerror=t,o.send(null)});var mr=u.print||console.log.bind(console),q=u.printErr||console.error.bind(console);Object.assign(u,C),C=null,u.arguments&&(Q=u.arguments),u.thisProgram&&(X=u.thisProgram),u.quit&&(x=u.quit);var Z;u.wasmBinary&&(Z=u.wasmBinary);var sr,lr=!1,nr,R,z,Sr,De,_,D,Me,Ae;function Hr(){var r=sr.buffer;u.HEAP8=R=new Int8Array(r),u.HEAP16=Sr=new Int16Array(r),u.HEAPU8=z=new Uint8Array(r),u.HEAPU16=De=new Uint16Array(r),u.HEAP32=_=new Int32Array(r),u.HEAPU32=D=new Uint32Array(r),u.HEAPF32=Me=new Float32Array(r),u.HEAPF64=Ae=new Float64Array(r)}var Wr=[],Yr=[],Re=[],Xr=[],Te=!1;function Ce(){if(u.preRun)for(typeof u.preRun=="function"&&(u.preRun=[u.preRun]);u.preRun.length;)ze(u.preRun.shift());br(Wr)}function Ie(){Te=!0,!u.noFSInit&&!n.init.initialized&&n.init(),n.ignorePermissions=!1,rr.init(),br(Yr)}function Ne(){br(Re)}function Le(){if(u.postRun)for(typeof u.postRun=="function"&&(u.postRun=[u.postRun]);u.postRun.length;)Ue(u.postRun.shift());br(Xr)}function ze(r){Wr.unshift(r)}function Oe(r){Yr.unshift(r)}function Ue(r){Xr.unshift(r)}var or=0,Cr=null,hr=null;function rn(r){return r}function kr(r){or++,u.monitorRunDependencies?.(or)}function pr(r){if(or--,u.monitorRunDependencies?.(or),or==0&&(Cr!==null&&(clearInterval(Cr),Cr=null),hr)){var e=hr;hr=null,e()}}function Ir(r){u.onAbort?.(r),r="Aborted("+r+")",q(r),lr=!0,nr=1,r+=". Build with -sASSERTIONS for more info.";var e=new WebAssembly.RuntimeError(r);throw k(e),e}var je="data:application/octet-stream;base64,",qr=r=>r.startsWith(je),ar;u.locateFile?(ar="scip.wasm",qr(ar)||(ar=Er(ar))):ar=new URL("scip.wasm",_r).href;function $r(r){if(r==ar&&Z)return new Uint8Array(Z);if(vr)return vr(r);throw"both async and sync fetching of the wasm failed"}function xe(r){return!Z&&(dr||tr)&&typeof fetch=="function"?fetch(r,{credentials:"same-origin"}).then(e=>{if(!e.ok)throw`failed to load wasm binary file at '${r}'`;return e.arrayBuffer()}).catch(()=>$r(r)):Promise.resolve().then(()=>$r(r))}function Vr(r,e,t){return xe(r).then(o=>WebAssembly.instantiate(o,e)).then(t,o=>{q(`failed to asynchronously prepare wasm: ${o}`),Ir(o)})}function Be(r,e,t,o){return!r&&typeof WebAssembly.instantiateStreaming=="function"&&!qr(e)&&typeof fetch=="function"?fetch(e,{credentials:"same-origin"}).then(a=>{var i=WebAssembly.instantiateStreaming(a,t);return i.then(o,function(s){return q(`wasm streaming compile failed: ${s}`),q("falling back to ArrayBuffer instantiation"),Vr(e,t,o)})}):Vr(e,t,o)}function He(){var r={a:Wt};function e(o,a){return H=o.exports,sr=H.O,Hr(),Jr=H.R,Oe(H.P),pr("wasm-instantiate"),H}kr("wasm-instantiate");function t(o){e(o.instance)}if(u.instantiateWasm)try{return u.instantiateWasm(r,e)}catch(o){q(`Module.instantiateWasm callback failed with error: ${o}`),k(o)}return Be(Z,ar,r,t).catch(k),{}}var g,I;function Gr(r){this.name="ExitStatus",this.message=`Program terminated with exit(${r})`,this.status=r}var br=r=>{for(;r.length>0;)r.shift()(u)},Kr=u.noExitRuntime||!0,Fr=[],Jr,$=r=>{var e=Fr[r];return e||(r>=Fr.length&&(Fr.length=r+1),Fr[r]=e=Jr.get(r)),e},We=(r,e)=>$(r)(e);class Ye{constructor(e){this.excPtr=e,this.ptr=e-24}set_type(e){D[this.ptr+4>>2]=e}get_type(){return D[this.ptr+4>>2]}set_destructor(e){D[this.ptr+8>>2]=e}get_destructor(){return D[this.ptr+8>>2]}set_caught(e){e=e?1:0,R[this.ptr+12]=e}get_caught(){return R[this.ptr+12]!=0}set_rethrown(e){e=e?1:0,R[this.ptr+13]=e}get_rethrown(){return R[this.ptr+13]!=0}init(e,t){this.set_adjusted_ptr(0),this.set_type(e),this.set_destructor(t)}set_adjusted_ptr(e){D[this.ptr+16>>2]=e}get_adjusted_ptr(){return D[this.ptr+16>>2]}get_exception_ptr(){var e=de(this.get_type());if(e)return D[this.excPtr>>2];var t=this.get_adjusted_ptr();return t!==0?t:this.excPtr}}var Qr=0,Xe=0,qe=(r,e,t)=>{var o=new Ye(r);throw o.init(e,t),Qr=r,Xe++,Qr},P={isAbs:r=>r.charAt(0)==="/",splitPath:r=>{var e=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/;return e.exec(r).slice(1)},normalizeArray:(r,e)=>{for(var t=0,o=r.length-1;o>=0;o--){var a=r[o];a==="."?r.splice(o,1):a===".."?(r.splice(o,1),t++):t&&(r.splice(o,1),t--)}if(e)for(;t;t--)r.unshift("..");return r},normalize:r=>{var e=P.isAbs(r),t=r.substr(-1)==="/";return r=P.normalizeArray(r.split("/").filter(o=>!!o),!e).join("/"),!r&&!e&&(r="."),r&&t&&(r+="/"),(e?"/":"")+r},dirname:r=>{var e=P.splitPath(r),t=e[0],o=e[1];return!t&&!o?".":(o&&(o=o.substr(0,o.length-1)),t+o)},basename:r=>{if(r==="/")return"/";r=P.normalize(r),r=r.replace(/\/$/,"");var e=r.lastIndexOf("/");return e===-1?r:r.substr(e+1)},join:(...r)=>P.normalize(r.join("/")),join2:(r,e)=>P.normalize(r+"/"+e)},$e=()=>{if(typeof crypto=="object"&&typeof crypto.getRandomValues=="function")return r=>crypto.getRandomValues(r);Ir("initRandomDevice")},Zr=r=>(Zr=$e())(r),J={resolve:(...r)=>{for(var e="",t=!1,o=r.length-1;o>=-1&&!t;o--){var a=o>=0?r[o]:n.cwd();if(typeof a!="string")throw new TypeError("Arguments to path.resolve must be strings");if(!a)return"";e=a+"/"+e,t=P.isAbs(a)}return e=P.normalizeArray(e.split("/").filter(i=>!!i),!t).join("/"),(t?"/":"")+e||"."},relative:(r,e)=>{r=J.resolve(r).substr(1),e=J.resolve(e).substr(1);function t(h){for(var S=0;S<h.length&&h[S]==="";S++);for(var b=h.length-1;b>=0&&h[b]==="";b--);return S>b?[]:h.slice(S,b-S+1)}for(var o=t(r.split("/")),a=t(e.split("/")),i=Math.min(o.length,a.length),s=i,l=0;l<i;l++)if(o[l]!==a[l]){s=l;break}for(var c=[],l=s;l<o.length;l++)c.push("..");return c=c.concat(a.slice(s)),c.join("/")}},re=typeof TextDecoder<"u"?new TextDecoder("utf8"):void 0,ur=(r,e,t)=>{for(var o=e+t,a=e;r[a]&&!(a>=o);)++a;if(a-e>16&&r.buffer&&re)return re.decode(r.subarray(e,a));for(var i="";e<a;){var s=r[e++];if(!(s&128)){i+=String.fromCharCode(s);continue}var l=r[e++]&63;if((s&224)==192){i+=String.fromCharCode((s&31)<<6|l);continue}var c=r[e++]&63;if((s&240)==224?s=(s&15)<<12|l<<6|c:s=(s&7)<<18|l<<12|c<<6|r[e++]&63,s<65536)i+=String.fromCharCode(s);else{var h=s-65536;i+=String.fromCharCode(55296|h>>10,56320|h&1023)}}return i},Nr=[],Pr=r=>{for(var e=0,t=0;t<r.length;++t){var o=r.charCodeAt(t);o<=127?e++:o<=2047?e+=2:o>=55296&&o<=57343?(e+=4,++t):e+=3}return e},Lr=(r,e,t,o)=>{if(!(o>0))return 0;for(var a=t,i=t+o-1,s=0;s<r.length;++s){var l=r.charCodeAt(s);if(l>=55296&&l<=57343){var c=r.charCodeAt(++s);l=65536+((l&1023)<<10)|c&1023}if(l<=127){if(t>=i)break;e[t++]=l}else if(l<=2047){if(t+1>=i)break;e[t++]=192|l>>6,e[t++]=128|l&63}else if(l<=65535){if(t+2>=i)break;e[t++]=224|l>>12,e[t++]=128|l>>6&63,e[t++]=128|l&63}else{if(t+3>=i)break;e[t++]=240|l>>18,e[t++]=128|l>>12&63,e[t++]=128|l>>6&63,e[t++]=128|l&63}}return e[t]=0,t-a};function Dr(r,e,t){var o=t>0?t:Pr(r)+1,a=new Array(o),i=Lr(r,a,0,a.length);return e&&(a.length=i),a}var Ve=()=>{if(!Nr.length){var r=null;if(typeof window<"u"&&typeof window.prompt=="function"?(r=window.prompt("Input: "),r!==null&&(r+=`
1
+ (function(ze){"use strict";var Le=function(){if(typeof SCIP_BASE_URL<"u"&&SCIP_BASE_URL)return SCIP_BASE_URL+(SCIP_BASE_URL.endsWith("/")?"":"/");if(typeof document<"u"&&document.currentScript&&document.currentScript.src){var _=document.currentScript.src;return _.substring(0,_.lastIndexOf("/")+1)}return"https://cdn.jsdelivr.net/npm/@areb0s/scip.js@latest/dist/"}();(function(_){"use strict";var M=function(){if(typeof SCIP_BASE_URL<"u"&&SCIP_BASE_URL)return SCIP_BASE_URL+(SCIP_BASE_URL.endsWith("/")?"":"/");if(typeof document<"u"&&document.currentScript&&document.currentScript.src){var p=document.currentScript.src;return p.substring(0,p.lastIndexOf("/")+1)}return"https://cdn.jsdelivr.net/npm/@areb0s/scip.js@latest/dist/"}(),W=(()=>{var p=M;return function(F={}){var l=F,H,g;l.ready=new Promise((r,e)=>{H=r,g=e});var U=Object.assign({},l),lr=[],er="./this.program",q=(r,e)=>{throw e},fr=typeof window=="object",mr=typeof importScripts=="function",ae=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string",K="";function zr(r){return l.locateFile?l.locateFile(r,K):K+r}var X,gr,Pr;(fr||mr)&&(mr?K=self.location.href:typeof document<"u"&&document.currentScript&&(K=document.currentScript.src),p&&(K=p),K.startsWith("blob:")?K="":K=K.substr(0,K.replace(/[?#].*/,"").lastIndexOf("/")+1),X=r=>{var e=new XMLHttpRequest;return e.open("GET",r,!1),e.send(null),e.responseText},mr&&(Pr=r=>{var e=new XMLHttpRequest;return e.open("GET",r,!1),e.responseType="arraybuffer",e.send(null),new Uint8Array(e.response)}),gr=(r,e,t)=>{var o=new XMLHttpRequest;o.open("GET",r,!0),o.responseType="arraybuffer",o.onload=()=>{if(o.status==200||o.status==0&&o.response){e(o.response);return}t()},o.onerror=t,o.send(null)});var Mr=l.print||console.log.bind(console),Z=l.printErr||console.error.bind(console);Object.assign(l,U),U=null,l.arguments&&(lr=l.arguments),l.thisProgram&&(er=l.thisProgram),l.quit&&(q=l.quit);var hr;l.wasmBinary&&(hr=l.wasmBinary);var pr,Dr=!1,wr,C,B,Lr,qe,y,T,Xe,Ve;function se(){var r=pr.buffer;l.HEAP8=C=new Int8Array(r),l.HEAP16=Lr=new Int16Array(r),l.HEAPU8=B=new Uint8Array(r),l.HEAPU16=qe=new Uint16Array(r),l.HEAP32=y=new Int32Array(r),l.HEAPU32=T=new Uint32Array(r),l.HEAPF32=Xe=new Float32Array(r),l.HEAPF64=Ve=new Float64Array(r)}var ue=[],le=[],Ge=[],fe=[],Ke=!1;function Je(){if(l.preRun)for(typeof l.preRun=="function"&&(l.preRun=[l.preRun]);l.preRun.length;)et(l.preRun.shift());xr(ue)}function Qe(){Ke=!0,!l.noFSInit&&!n.init.initialized&&n.init(),n.ignorePermissions=!1,cr.init(),xr(le)}function Ze(){xr(Ge)}function rt(){if(l.postRun)for(typeof l.postRun=="function"&&(l.postRun=[l.postRun]);l.postRun.length;)nt(l.postRun.shift());xr(fe)}function et(r){ue.unshift(r)}function tt(r){le.unshift(r)}function nt(r){fe.unshift(r)}var yr=0,Jr=null,Rr=null;function gn(r){return r}function Or(r){yr++,l.monitorRunDependencies?.(yr)}function Ar(r){if(yr--,l.monitorRunDependencies?.(yr),yr==0&&(Jr!==null&&(clearInterval(Jr),Jr=null),Rr)){var e=Rr;Rr=null,e()}}function Qr(r){l.onAbort?.(r),r="Aborted("+r+")",Z(r),Dr=!0,wr=1,r+=". Build with -sASSERTIONS for more info.";var e=new WebAssembly.RuntimeError(r);throw g(e),e}var ot="data:application/octet-stream;base64,",ce=r=>r.startsWith(ot),_r;l.locateFile?(_r="scip.wasm",ce(_r)||(_r=zr(_r))):_r=new URL("scip.wasm",M).href;function de(r){if(r==_r&&hr)return new Uint8Array(hr);if(Pr)return Pr(r);throw"both async and sync fetching of the wasm failed"}function it(r){return!hr&&(fr||mr)&&typeof fetch=="function"?fetch(r,{credentials:"same-origin"}).then(e=>{if(!e.ok)throw`failed to load wasm binary file at '${r}'`;return e.arrayBuffer()}).catch(()=>de(r)):Promise.resolve().then(()=>de(r))}function ve(r,e,t){return it(r).then(o=>WebAssembly.instantiate(o,e)).then(t,o=>{Z(`failed to asynchronously prepare wasm: ${o}`),Qr(o)})}function at(r,e,t,o){return!r&&typeof WebAssembly.instantiateStreaming=="function"&&!ce(e)&&typeof fetch=="function"?fetch(e,{credentials:"same-origin"}).then(i=>{var a=WebAssembly.instantiateStreaming(i,t);return a.then(o,function(s){return Z(`wasm streaming compile failed: ${s}`),Z("falling back to ArrayBuffer instantiation"),ve(e,t,o)})}):ve(e,t,o)}function st(){var r={a:ln};function e(o,i){return J=o.exports,pr=J.O,se(),pe=J.R,tt(J.P),Ar("wasm-instantiate"),J}Or("wasm-instantiate");function t(o){e(o.instance)}if(l.instantiateWasm)try{return l.instantiateWasm(r,e)}catch(o){Z(`Module.instantiateWasm callback failed with error: ${o}`),g(o)}return at(hr,_r,r,t).catch(g),{}}var S,O;function me(r){this.name="ExitStatus",this.message=`Program terminated with exit(${r})`,this.status=r}var xr=r=>{for(;r.length>0;)r.shift()(l)},he=l.noExitRuntime||!0,Ur=[],pe,nr=r=>{var e=Ur[r];return e||(r>=Ur.length&&(Ur.length=r+1),Ur[r]=e=pe.get(r)),e},ut=(r,e)=>nr(r)(e);class lt{constructor(e){this.excPtr=e,this.ptr=e-24}set_type(e){T[this.ptr+4>>2]=e}get_type(){return T[this.ptr+4>>2]}set_destructor(e){T[this.ptr+8>>2]=e}get_destructor(){return T[this.ptr+8>>2]}set_caught(e){e=e?1:0,C[this.ptr+12]=e}get_caught(){return C[this.ptr+12]!=0}set_rethrown(e){e=e?1:0,C[this.ptr+13]=e}get_rethrown(){return C[this.ptr+13]!=0}init(e,t){this.set_adjusted_ptr(0),this.set_type(e),this.set_destructor(t)}set_adjusted_ptr(e){T[this.ptr+16>>2]=e}get_adjusted_ptr(){return T[this.ptr+16>>2]}get_exception_ptr(){var e=Te(this.get_type());if(e)return T[this.excPtr>>2];var t=this.get_adjusted_ptr();return t!==0?t:this.excPtr}}var we=0,ft=0,ct=(r,e,t)=>{var o=new lt(r);throw o.init(e,t),we=r,ft++,we},A={isAbs:r=>r.charAt(0)==="/",splitPath:r=>{var e=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/;return e.exec(r).slice(1)},normalizeArray:(r,e)=>{for(var t=0,o=r.length-1;o>=0;o--){var i=r[o];i==="."?r.splice(o,1):i===".."?(r.splice(o,1),t++):t&&(r.splice(o,1),t--)}if(e)for(;t;t--)r.unshift("..");return r},normalize:r=>{var e=A.isAbs(r),t=r.substr(-1)==="/";return r=A.normalizeArray(r.split("/").filter(o=>!!o),!e).join("/"),!r&&!e&&(r="."),r&&t&&(r+="/"),(e?"/":"")+r},dirname:r=>{var e=A.splitPath(r),t=e[0],o=e[1];return!t&&!o?".":(o&&(o=o.substr(0,o.length-1)),t+o)},basename:r=>{if(r==="/")return"/";r=A.normalize(r),r=r.replace(/\/$/,"");var e=r.lastIndexOf("/");return e===-1?r:r.substr(e+1)},join:(...r)=>A.normalize(r.join("/")),join2:(r,e)=>A.normalize(r+"/"+e)},dt=()=>{if(typeof crypto=="object"&&typeof crypto.getRandomValues=="function")return r=>crypto.getRandomValues(r);Qr("initRandomDevice")},ye=r=>(ye=dt())(r),ur={resolve:(...r)=>{for(var e="",t=!1,o=r.length-1;o>=-1&&!t;o--){var i=o>=0?r[o]:n.cwd();if(typeof i!="string")throw new TypeError("Arguments to path.resolve must be strings");if(!i)return"";e=i+"/"+e,t=A.isAbs(i)}return e=A.normalizeArray(e.split("/").filter(a=>!!a),!t).join("/"),(t?"/":"")+e||"."},relative:(r,e)=>{r=ur.resolve(r).substr(1),e=ur.resolve(e).substr(1);function t(h){for(var b=0;b<h.length&&h[b]==="";b++);for(var P=h.length-1;P>=0&&h[P]==="";P--);return b>P?[]:h.slice(b,P-b+1)}for(var o=t(r.split("/")),i=t(e.split("/")),a=Math.min(o.length,i.length),s=a,u=0;u<a;u++)if(o[u]!==i[u]){s=u;break}for(var c=[],u=s;u<o.length;u++)c.push("..");return c=c.concat(i.slice(s)),c.join("/")}},_e=typeof TextDecoder<"u"?new TextDecoder("utf8"):void 0,Er=(r,e,t)=>{for(var o=e+t,i=e;r[i]&&!(i>=o);)++i;if(i-e>16&&r.buffer&&_e)return _e.decode(r.subarray(e,i));for(var a="";e<i;){var s=r[e++];if(!(s&128)){a+=String.fromCharCode(s);continue}var u=r[e++]&63;if((s&224)==192){a+=String.fromCharCode((s&31)<<6|u);continue}var c=r[e++]&63;if((s&240)==224?s=(s&15)<<12|u<<6|c:s=(s&7)<<18|u<<12|c<<6|r[e++]&63,s<65536)a+=String.fromCharCode(s);else{var h=s-65536;a+=String.fromCharCode(55296|h>>10,56320|h&1023)}}return a},Zr=[],Br=r=>{for(var e=0,t=0;t<r.length;++t){var o=r.charCodeAt(t);o<=127?e++:o<=2047?e+=2:o>=55296&&o<=57343?(e+=4,++t):e+=3}return e},re=(r,e,t,o)=>{if(!(o>0))return 0;for(var i=t,a=t+o-1,s=0;s<r.length;++s){var u=r.charCodeAt(s);if(u>=55296&&u<=57343){var c=r.charCodeAt(++s);u=65536+((u&1023)<<10)|c&1023}if(u<=127){if(t>=a)break;e[t++]=u}else if(u<=2047){if(t+1>=a)break;e[t++]=192|u>>6,e[t++]=128|u&63}else if(u<=65535){if(t+2>=a)break;e[t++]=224|u>>12,e[t++]=128|u>>6&63,e[t++]=128|u&63}else{if(t+3>=a)break;e[t++]=240|u>>18,e[t++]=128|u>>12&63,e[t++]=128|u>>6&63,e[t++]=128|u&63}}return e[t]=0,t-i};function jr(r,e,t){var o=t>0?t:Br(r)+1,i=new Array(o),a=re(r,i,0,i.length);return e&&(i.length=a),i}var vt=()=>{if(!Zr.length){var r=null;if(typeof window<"u"&&typeof window.prompt=="function"?(r=window.prompt("Input: "),r!==null&&(r+=`
2
2
  `)):typeof readline=="function"&&(r=readline(),r!==null&&(r+=`
3
- `)),!r)return null;Nr=Dr(r,!0)}return Nr.shift()},rr={ttys:[],init(){},shutdown(){},register(r,e){rr.ttys[r]={input:[],output:[],ops:e},n.registerDevice(r,rr.stream_ops)},stream_ops:{open(r){var e=rr.ttys[r.node.rdev];if(!e)throw new n.ErrnoError(43);r.tty=e,r.seekable=!1},close(r){r.tty.ops.fsync(r.tty)},fsync(r){r.tty.ops.fsync(r.tty)},read(r,e,t,o,a){if(!r.tty||!r.tty.ops.get_char)throw new n.ErrnoError(60);for(var i=0,s=0;s<o;s++){var l;try{l=r.tty.ops.get_char(r.tty)}catch{throw new n.ErrnoError(29)}if(l===void 0&&i===0)throw new n.ErrnoError(6);if(l==null)break;i++,e[t+s]=l}return i&&(r.node.timestamp=Date.now()),i},write(r,e,t,o,a){if(!r.tty||!r.tty.ops.put_char)throw new n.ErrnoError(60);try{for(var i=0;i<o;i++)r.tty.ops.put_char(r.tty,e[t+i])}catch{throw new n.ErrnoError(29)}return o&&(r.node.timestamp=Date.now()),i}},default_tty_ops:{get_char(r){return Ve()},put_char(r,e){e===null||e===10?(mr(ur(r.output,0)),r.output=[]):e!=0&&r.output.push(e)},fsync(r){r.output&&r.output.length>0&&(mr(ur(r.output,0)),r.output=[])},ioctl_tcgets(r){return{c_iflag:25856,c_oflag:5,c_cflag:191,c_lflag:35387,c_cc:[3,28,127,21,4,0,1,0,17,19,26,0,18,15,23,22,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]}},ioctl_tcsets(r,e,t){return 0},ioctl_tiocgwinsz(r){return[24,80]}},default_tty1_ops:{put_char(r,e){e===null||e===10?(q(ur(r.output,0)),r.output=[]):e!=0&&r.output.push(e)},fsync(r){r.output&&r.output.length>0&&(q(ur(r.output,0)),r.output=[])}}},Ge=(r,e)=>(z.fill(0,r,r+e),r),Ke=(r,e)=>Math.ceil(r/e)*e,ee=r=>{r=Ke(r,65536);var e=ce(65536,r);return e?Ge(e,r):0},p={ops_table:null,mount(r){return p.createNode(null,"/",16895,0)},createNode(r,e,t,o){if(n.isBlkdev(t)||n.isFIFO(t))throw new n.ErrnoError(63);p.ops_table||(p.ops_table={dir:{node:{getattr:p.node_ops.getattr,setattr:p.node_ops.setattr,lookup:p.node_ops.lookup,mknod:p.node_ops.mknod,rename:p.node_ops.rename,unlink:p.node_ops.unlink,rmdir:p.node_ops.rmdir,readdir:p.node_ops.readdir,symlink:p.node_ops.symlink},stream:{llseek:p.stream_ops.llseek}},file:{node:{getattr:p.node_ops.getattr,setattr:p.node_ops.setattr},stream:{llseek:p.stream_ops.llseek,read:p.stream_ops.read,write:p.stream_ops.write,allocate:p.stream_ops.allocate,mmap:p.stream_ops.mmap,msync:p.stream_ops.msync}},link:{node:{getattr:p.node_ops.getattr,setattr:p.node_ops.setattr,readlink:p.node_ops.readlink},stream:{}},chrdev:{node:{getattr:p.node_ops.getattr,setattr:p.node_ops.setattr},stream:n.chrdev_stream_ops}});var a=n.createNode(r,e,t,o);return n.isDir(a.mode)?(a.node_ops=p.ops_table.dir.node,a.stream_ops=p.ops_table.dir.stream,a.contents={}):n.isFile(a.mode)?(a.node_ops=p.ops_table.file.node,a.stream_ops=p.ops_table.file.stream,a.usedBytes=0,a.contents=null):n.isLink(a.mode)?(a.node_ops=p.ops_table.link.node,a.stream_ops=p.ops_table.link.stream):n.isChrdev(a.mode)&&(a.node_ops=p.ops_table.chrdev.node,a.stream_ops=p.ops_table.chrdev.stream),a.timestamp=Date.now(),r&&(r.contents[e]=a,r.timestamp=a.timestamp),a},getFileDataAsTypedArray(r){return r.contents?r.contents.subarray?r.contents.subarray(0,r.usedBytes):new Uint8Array(r.contents):new Uint8Array(0)},expandFileStorage(r,e){var t=r.contents?r.contents.length:0;if(!(t>=e)){var o=1024*1024;e=Math.max(e,t*(t<o?2:1.125)>>>0),t!=0&&(e=Math.max(e,256));var a=r.contents;r.contents=new Uint8Array(e),r.usedBytes>0&&r.contents.set(a.subarray(0,r.usedBytes),0)}},resizeFileStorage(r,e){if(r.usedBytes!=e)if(e==0)r.contents=null,r.usedBytes=0;else{var t=r.contents;r.contents=new Uint8Array(e),t&&r.contents.set(t.subarray(0,Math.min(e,r.usedBytes))),r.usedBytes=e}},node_ops:{getattr(r){var e={};return e.dev=n.isChrdev(r.mode)?r.id:1,e.ino=r.id,e.mode=r.mode,e.nlink=1,e.uid=0,e.gid=0,e.rdev=r.rdev,n.isDir(r.mode)?e.size=4096:n.isFile(r.mode)?e.size=r.usedBytes:n.isLink(r.mode)?e.size=r.link.length:e.size=0,e.atime=new Date(r.timestamp),e.mtime=new Date(r.timestamp),e.ctime=new Date(r.timestamp),e.blksize=4096,e.blocks=Math.ceil(e.size/e.blksize),e},setattr(r,e){e.mode!==void 0&&(r.mode=e.mode),e.timestamp!==void 0&&(r.timestamp=e.timestamp),e.size!==void 0&&p.resizeFileStorage(r,e.size)},lookup(r,e){throw n.genericErrors[44]},mknod(r,e,t,o){return p.createNode(r,e,t,o)},rename(r,e,t){if(n.isDir(r.mode)){var o;try{o=n.lookupNode(e,t)}catch{}if(o)for(var a in o.contents)throw new n.ErrnoError(55)}delete r.parent.contents[r.name],r.parent.timestamp=Date.now(),r.name=t,e.contents[t]=r,e.timestamp=r.parent.timestamp,r.parent=e},unlink(r,e){delete r.contents[e],r.timestamp=Date.now()},rmdir(r,e){var t=n.lookupNode(r,e);for(var o in t.contents)throw new n.ErrnoError(55);delete r.contents[e],r.timestamp=Date.now()},readdir(r){var e=[".",".."];for(var t of Object.keys(r.contents))e.push(t);return e},symlink(r,e,t){var o=p.createNode(r,e,41471,0);return o.link=t,o},readlink(r){if(!n.isLink(r.mode))throw new n.ErrnoError(28);return r.link}},stream_ops:{read(r,e,t,o,a){var i=r.node.contents;if(a>=r.node.usedBytes)return 0;var s=Math.min(r.node.usedBytes-a,o);if(s>8&&i.subarray)e.set(i.subarray(a,a+s),t);else for(var l=0;l<s;l++)e[t+l]=i[a+l];return s},write(r,e,t,o,a,i){if(e.buffer===R.buffer&&(i=!1),!o)return 0;var s=r.node;if(s.timestamp=Date.now(),e.subarray&&(!s.contents||s.contents.subarray)){if(i)return s.contents=e.subarray(t,t+o),s.usedBytes=o,o;if(s.usedBytes===0&&a===0)return s.contents=e.slice(t,t+o),s.usedBytes=o,o;if(a+o<=s.usedBytes)return s.contents.set(e.subarray(t,t+o),a),o}if(p.expandFileStorage(s,a+o),s.contents.subarray&&e.subarray)s.contents.set(e.subarray(t,t+o),a);else for(var l=0;l<o;l++)s.contents[a+l]=e[t+l];return s.usedBytes=Math.max(s.usedBytes,a+o),o},llseek(r,e,t){var o=e;if(t===1?o+=r.position:t===2&&n.isFile(r.node.mode)&&(o+=r.node.usedBytes),o<0)throw new n.ErrnoError(28);return o},allocate(r,e,t){p.expandFileStorage(r.node,e+t),r.node.usedBytes=Math.max(r.node.usedBytes,e+t)},mmap(r,e,t,o,a){if(!n.isFile(r.node.mode))throw new n.ErrnoError(43);var i,s,l=r.node.contents;if(!(a&2)&&l.buffer===R.buffer)s=!1,i=l.byteOffset;else{if((t>0||t+e<l.length)&&(l.subarray?l=l.subarray(t,t+e):l=Array.prototype.slice.call(l,t,t+e)),s=!0,i=ee(e),!i)throw new n.ErrnoError(48);R.set(l,i)}return{ptr:i,allocated:s}},msync(r,e,t,o,a){return p.stream_ops.write(r,e,0,o,t,!1),0}}},Je=(r,e,t,o)=>{var a=o?"":`al ${r}`;ir(r,i=>{e(new Uint8Array(i)),a&&pr(a)},i=>{if(t)t();else throw`Loading data file "${r}" failed.`}),a&&kr(a)},Qe=(r,e,t,o,a,i)=>{n.createDataFile(r,e,t,o,a,i)},Ze=u.preloadPlugins||[],rt=(r,e,t,o)=>{typeof Browser<"u"&&Browser.init();var a=!1;return Ze.forEach(i=>{a||i.canHandle(e)&&(i.handle(r,e,t,o),a=!0)}),a},et=(r,e,t,o,a,i,s,l,c,h)=>{var S=e?J.resolve(P.join2(r,e)):r,b=`cp ${S}`;function m(v){function E(O){h?.(),l||Qe(r,e,O,o,a,c),i?.(),pr(b)}rt(v,S,E,()=>{s?.(),pr(b)})||E(v)}kr(b),typeof t=="string"?Je(t,m,s):m(t)},tt=r=>{var e={r:0,"r+":2,w:577,"w+":578,a:1089,"a+":1090},t=e[r];if(typeof t>"u")throw new Error(`Unknown file open mode: ${r}`);return t},zr=(r,e)=>{var t=0;return r&&(t|=365),e&&(t|=146),t},n={root:null,mounts:[],devices:{},streams:[],nextInode:1,nameTable:null,currentPath:"/",initialized:!1,ignorePermissions:!0,ErrnoError:class{constructor(r){this.name="ErrnoError",this.errno=r}},genericErrors:{},filesystems:null,syncFSRequests:0,FSStream:class{constructor(){this.shared={}}get object(){return this.node}set object(r){this.node=r}get isRead(){return(this.flags&2097155)!==1}get isWrite(){return(this.flags&2097155)!==0}get isAppend(){return this.flags&1024}get flags(){return this.shared.flags}set flags(r){this.shared.flags=r}get position(){return this.shared.position}set position(r){this.shared.position=r}},FSNode:class{constructor(r,e,t,o){r||(r=this),this.parent=r,this.mount=r.mount,this.mounted=null,this.id=n.nextInode++,this.name=e,this.mode=t,this.node_ops={},this.stream_ops={},this.rdev=o,this.readMode=365,this.writeMode=146}get read(){return(this.mode&this.readMode)===this.readMode}set read(r){r?this.mode|=this.readMode:this.mode&=~this.readMode}get write(){return(this.mode&this.writeMode)===this.writeMode}set write(r){r?this.mode|=this.writeMode:this.mode&=~this.writeMode}get isFolder(){return n.isDir(this.mode)}get isDevice(){return n.isChrdev(this.mode)}},lookupPath(r,e={}){if(r=J.resolve(r),!r)return{path:"",node:null};var t={follow_mount:!0,recurse_count:0};if(e=Object.assign(t,e),e.recurse_count>8)throw new n.ErrnoError(32);for(var o=r.split("/").filter(b=>!!b),a=n.root,i="/",s=0;s<o.length;s++){var l=s===o.length-1;if(l&&e.parent)break;if(a=n.lookupNode(a,o[s]),i=P.join2(i,o[s]),n.isMountpoint(a)&&(!l||l&&e.follow_mount)&&(a=a.mounted.root),!l||e.follow)for(var c=0;n.isLink(a.mode);){var h=n.readlink(i);i=J.resolve(P.dirname(i),h);var S=n.lookupPath(i,{recurse_count:e.recurse_count+1});if(a=S.node,c++>40)throw new n.ErrnoError(32)}}return{path:i,node:a}},getPath(r){for(var e;;){if(n.isRoot(r)){var t=r.mount.mountpoint;return e?t[t.length-1]!=="/"?`${t}/${e}`:t+e:t}e=e?`${r.name}/${e}`:r.name,r=r.parent}},hashName(r,e){for(var t=0,o=0;o<e.length;o++)t=(t<<5)-t+e.charCodeAt(o)|0;return(r+t>>>0)%n.nameTable.length},hashAddNode(r){var e=n.hashName(r.parent.id,r.name);r.name_next=n.nameTable[e],n.nameTable[e]=r},hashRemoveNode(r){var e=n.hashName(r.parent.id,r.name);if(n.nameTable[e]===r)n.nameTable[e]=r.name_next;else for(var t=n.nameTable[e];t;){if(t.name_next===r){t.name_next=r.name_next;break}t=t.name_next}},lookupNode(r,e){var t=n.mayLookup(r);if(t)throw new n.ErrnoError(t);for(var o=n.hashName(r.id,e),a=n.nameTable[o];a;a=a.name_next){var i=a.name;if(a.parent.id===r.id&&i===e)return a}return n.lookup(r,e)},createNode(r,e,t,o){var a=new n.FSNode(r,e,t,o);return n.hashAddNode(a),a},destroyNode(r){n.hashRemoveNode(r)},isRoot(r){return r===r.parent},isMountpoint(r){return!!r.mounted},isFile(r){return(r&61440)===32768},isDir(r){return(r&61440)===16384},isLink(r){return(r&61440)===40960},isChrdev(r){return(r&61440)===8192},isBlkdev(r){return(r&61440)===24576},isFIFO(r){return(r&61440)===4096},isSocket(r){return(r&49152)===49152},flagsToPermissionString(r){var e=["r","w","rw"][r&3];return r&512&&(e+="w"),e},nodePermissions(r,e){return n.ignorePermissions?0:e.includes("r")&&!(r.mode&292)||e.includes("w")&&!(r.mode&146)||e.includes("x")&&!(r.mode&73)?2:0},mayLookup(r){if(!n.isDir(r.mode))return 54;var e=n.nodePermissions(r,"x");return e||(r.node_ops.lookup?0:2)},mayCreate(r,e){try{var t=n.lookupNode(r,e);return 20}catch{}return n.nodePermissions(r,"wx")},mayDelete(r,e,t){var o;try{o=n.lookupNode(r,e)}catch(i){return i.errno}var a=n.nodePermissions(r,"wx");if(a)return a;if(t){if(!n.isDir(o.mode))return 54;if(n.isRoot(o)||n.getPath(o)===n.cwd())return 10}else if(n.isDir(o.mode))return 31;return 0},mayOpen(r,e){return r?n.isLink(r.mode)?32:n.isDir(r.mode)&&(n.flagsToPermissionString(e)!=="r"||e&512)?31:n.nodePermissions(r,n.flagsToPermissionString(e)):44},MAX_OPEN_FDS:4096,nextfd(){for(var r=0;r<=n.MAX_OPEN_FDS;r++)if(!n.streams[r])return r;throw new n.ErrnoError(33)},getStreamChecked(r){var e=n.getStream(r);if(!e)throw new n.ErrnoError(8);return e},getStream:r=>n.streams[r],createStream(r,e=-1){return r=Object.assign(new n.FSStream,r),e==-1&&(e=n.nextfd()),r.fd=e,n.streams[e]=r,r},closeStream(r){n.streams[r]=null},dupStream(r,e=-1){var t=n.createStream(r,e);return t.stream_ops?.dup?.(t),t},chrdev_stream_ops:{open(r){var e=n.getDevice(r.node.rdev);r.stream_ops=e.stream_ops,r.stream_ops.open?.(r)},llseek(){throw new n.ErrnoError(70)}},major:r=>r>>8,minor:r=>r&255,makedev:(r,e)=>r<<8|e,registerDevice(r,e){n.devices[r]={stream_ops:e}},getDevice:r=>n.devices[r],getMounts(r){for(var e=[],t=[r];t.length;){var o=t.pop();e.push(o),t.push(...o.mounts)}return e},syncfs(r,e){typeof r=="function"&&(e=r,r=!1),n.syncFSRequests++,n.syncFSRequests>1&&q(`warning: ${n.syncFSRequests} FS.syncfs operations in flight at once, probably just doing extra work`);var t=n.getMounts(n.root.mount),o=0;function a(s){return n.syncFSRequests--,e(s)}function i(s){if(s)return i.errored?void 0:(i.errored=!0,a(s));++o>=t.length&&a(null)}t.forEach(s=>{if(!s.type.syncfs)return i(null);s.type.syncfs(s,r,i)})},mount(r,e,t){var o=t==="/",a=!t,i;if(o&&n.root)throw new n.ErrnoError(10);if(!o&&!a){var s=n.lookupPath(t,{follow_mount:!1});if(t=s.path,i=s.node,n.isMountpoint(i))throw new n.ErrnoError(10);if(!n.isDir(i.mode))throw new n.ErrnoError(54)}var l={type:r,opts:e,mountpoint:t,mounts:[]},c=r.mount(l);return c.mount=l,l.root=c,o?n.root=c:i&&(i.mounted=l,i.mount&&i.mount.mounts.push(l)),c},unmount(r){var e=n.lookupPath(r,{follow_mount:!1});if(!n.isMountpoint(e.node))throw new n.ErrnoError(28);var t=e.node,o=t.mounted,a=n.getMounts(o);Object.keys(n.nameTable).forEach(s=>{for(var l=n.nameTable[s];l;){var c=l.name_next;a.includes(l.mount)&&n.destroyNode(l),l=c}}),t.mounted=null;var i=t.mount.mounts.indexOf(o);t.mount.mounts.splice(i,1)},lookup(r,e){return r.node_ops.lookup(r,e)},mknod(r,e,t){var o=n.lookupPath(r,{parent:!0}),a=o.node,i=P.basename(r);if(!i||i==="."||i==="..")throw new n.ErrnoError(28);var s=n.mayCreate(a,i);if(s)throw new n.ErrnoError(s);if(!a.node_ops.mknod)throw new n.ErrnoError(63);return a.node_ops.mknod(a,i,e,t)},create(r,e){return e=e!==void 0?e:438,e&=4095,e|=32768,n.mknod(r,e,0)},mkdir(r,e){return e=e!==void 0?e:511,e&=1023,e|=16384,n.mknod(r,e,0)},mkdirTree(r,e){for(var t=r.split("/"),o="",a=0;a<t.length;++a)if(t[a]){o+="/"+t[a];try{n.mkdir(o,e)}catch(i){if(i.errno!=20)throw i}}},mkdev(r,e,t){return typeof t>"u"&&(t=e,e=438),e|=8192,n.mknod(r,e,t)},symlink(r,e){if(!J.resolve(r))throw new n.ErrnoError(44);var t=n.lookupPath(e,{parent:!0}),o=t.node;if(!o)throw new n.ErrnoError(44);var a=P.basename(e),i=n.mayCreate(o,a);if(i)throw new n.ErrnoError(i);if(!o.node_ops.symlink)throw new n.ErrnoError(63);return o.node_ops.symlink(o,a,r)},rename(r,e){var t=P.dirname(r),o=P.dirname(e),a=P.basename(r),i=P.basename(e),s,l,c;if(s=n.lookupPath(r,{parent:!0}),l=s.node,s=n.lookupPath(e,{parent:!0}),c=s.node,!l||!c)throw new n.ErrnoError(44);if(l.mount!==c.mount)throw new n.ErrnoError(75);var h=n.lookupNode(l,a),S=J.relative(r,o);if(S.charAt(0)!==".")throw new n.ErrnoError(28);if(S=J.relative(e,t),S.charAt(0)!==".")throw new n.ErrnoError(55);var b;try{b=n.lookupNode(c,i)}catch{}if(h!==b){var m=n.isDir(h.mode),v=n.mayDelete(l,a,m);if(v)throw new n.ErrnoError(v);if(v=b?n.mayDelete(c,i,m):n.mayCreate(c,i),v)throw new n.ErrnoError(v);if(!l.node_ops.rename)throw new n.ErrnoError(63);if(n.isMountpoint(h)||b&&n.isMountpoint(b))throw new n.ErrnoError(10);if(c!==l&&(v=n.nodePermissions(l,"w"),v))throw new n.ErrnoError(v);n.hashRemoveNode(h);try{l.node_ops.rename(h,c,i)}catch(E){throw E}finally{n.hashAddNode(h)}}},rmdir(r){var e=n.lookupPath(r,{parent:!0}),t=e.node,o=P.basename(r),a=n.lookupNode(t,o),i=n.mayDelete(t,o,!0);if(i)throw new n.ErrnoError(i);if(!t.node_ops.rmdir)throw new n.ErrnoError(63);if(n.isMountpoint(a))throw new n.ErrnoError(10);t.node_ops.rmdir(t,o),n.destroyNode(a)},readdir(r){var e=n.lookupPath(r,{follow:!0}),t=e.node;if(!t.node_ops.readdir)throw new n.ErrnoError(54);return t.node_ops.readdir(t)},unlink(r){var e=n.lookupPath(r,{parent:!0}),t=e.node;if(!t)throw new n.ErrnoError(44);var o=P.basename(r),a=n.lookupNode(t,o),i=n.mayDelete(t,o,!1);if(i)throw new n.ErrnoError(i);if(!t.node_ops.unlink)throw new n.ErrnoError(63);if(n.isMountpoint(a))throw new n.ErrnoError(10);t.node_ops.unlink(t,o),n.destroyNode(a)},readlink(r){var e=n.lookupPath(r),t=e.node;if(!t)throw new n.ErrnoError(44);if(!t.node_ops.readlink)throw new n.ErrnoError(28);return J.resolve(n.getPath(t.parent),t.node_ops.readlink(t))},stat(r,e){var t=n.lookupPath(r,{follow:!e}),o=t.node;if(!o)throw new n.ErrnoError(44);if(!o.node_ops.getattr)throw new n.ErrnoError(63);return o.node_ops.getattr(o)},lstat(r){return n.stat(r,!0)},chmod(r,e,t){var o;if(typeof r=="string"){var a=n.lookupPath(r,{follow:!t});o=a.node}else o=r;if(!o.node_ops.setattr)throw new n.ErrnoError(63);o.node_ops.setattr(o,{mode:e&4095|o.mode&-4096,timestamp:Date.now()})},lchmod(r,e){n.chmod(r,e,!0)},fchmod(r,e){var t=n.getStreamChecked(r);n.chmod(t.node,e)},chown(r,e,t,o){var a;if(typeof r=="string"){var i=n.lookupPath(r,{follow:!o});a=i.node}else a=r;if(!a.node_ops.setattr)throw new n.ErrnoError(63);a.node_ops.setattr(a,{timestamp:Date.now()})},lchown(r,e,t){n.chown(r,e,t,!0)},fchown(r,e,t){var o=n.getStreamChecked(r);n.chown(o.node,e,t)},truncate(r,e){if(e<0)throw new n.ErrnoError(28);var t;if(typeof r=="string"){var o=n.lookupPath(r,{follow:!0});t=o.node}else t=r;if(!t.node_ops.setattr)throw new n.ErrnoError(63);if(n.isDir(t.mode))throw new n.ErrnoError(31);if(!n.isFile(t.mode))throw new n.ErrnoError(28);var a=n.nodePermissions(t,"w");if(a)throw new n.ErrnoError(a);t.node_ops.setattr(t,{size:e,timestamp:Date.now()})},ftruncate(r,e){var t=n.getStreamChecked(r);if(!(t.flags&2097155))throw new n.ErrnoError(28);n.truncate(t.node,e)},utime(r,e,t){var o=n.lookupPath(r,{follow:!0}),a=o.node;a.node_ops.setattr(a,{timestamp:Math.max(e,t)})},open(r,e,t){if(r==="")throw new n.ErrnoError(44);e=typeof e=="string"?tt(e):e,t=typeof t>"u"?438:t,e&64?t=t&4095|32768:t=0;var o;if(typeof r=="object")o=r;else{r=P.normalize(r);try{var a=n.lookupPath(r,{follow:!(e&131072)});o=a.node}catch{}}var i=!1;if(e&64)if(o){if(e&128)throw new n.ErrnoError(20)}else o=n.mknod(r,t,0),i=!0;if(!o)throw new n.ErrnoError(44);if(n.isChrdev(o.mode)&&(e&=-513),e&65536&&!n.isDir(o.mode))throw new n.ErrnoError(54);if(!i){var s=n.mayOpen(o,e);if(s)throw new n.ErrnoError(s)}e&512&&!i&&n.truncate(o,0),e&=-131713;var l=n.createStream({node:o,path:n.getPath(o),flags:e,seekable:!0,position:0,stream_ops:o.stream_ops,ungotten:[],error:!1});return l.stream_ops.open&&l.stream_ops.open(l),u.logReadFiles&&!(e&1)&&(n.readFiles||(n.readFiles={}),r in n.readFiles||(n.readFiles[r]=1)),l},close(r){if(n.isClosed(r))throw new n.ErrnoError(8);r.getdents&&(r.getdents=null);try{r.stream_ops.close&&r.stream_ops.close(r)}catch(e){throw e}finally{n.closeStream(r.fd)}r.fd=null},isClosed(r){return r.fd===null},llseek(r,e,t){if(n.isClosed(r))throw new n.ErrnoError(8);if(!r.seekable||!r.stream_ops.llseek)throw new n.ErrnoError(70);if(t!=0&&t!=1&&t!=2)throw new n.ErrnoError(28);return r.position=r.stream_ops.llseek(r,e,t),r.ungotten=[],r.position},read(r,e,t,o,a){if(o<0||a<0)throw new n.ErrnoError(28);if(n.isClosed(r))throw new n.ErrnoError(8);if((r.flags&2097155)===1)throw new n.ErrnoError(8);if(n.isDir(r.node.mode))throw new n.ErrnoError(31);if(!r.stream_ops.read)throw new n.ErrnoError(28);var i=typeof a<"u";if(!i)a=r.position;else if(!r.seekable)throw new n.ErrnoError(70);var s=r.stream_ops.read(r,e,t,o,a);return i||(r.position+=s),s},write(r,e,t,o,a,i){if(o<0||a<0)throw new n.ErrnoError(28);if(n.isClosed(r))throw new n.ErrnoError(8);if(!(r.flags&2097155))throw new n.ErrnoError(8);if(n.isDir(r.node.mode))throw new n.ErrnoError(31);if(!r.stream_ops.write)throw new n.ErrnoError(28);r.seekable&&r.flags&1024&&n.llseek(r,0,2);var s=typeof a<"u";if(!s)a=r.position;else if(!r.seekable)throw new n.ErrnoError(70);var l=r.stream_ops.write(r,e,t,o,a,i);return s||(r.position+=l),l},allocate(r,e,t){if(n.isClosed(r))throw new n.ErrnoError(8);if(e<0||t<=0)throw new n.ErrnoError(28);if(!(r.flags&2097155))throw new n.ErrnoError(8);if(!n.isFile(r.node.mode)&&!n.isDir(r.node.mode))throw new n.ErrnoError(43);if(!r.stream_ops.allocate)throw new n.ErrnoError(138);r.stream_ops.allocate(r,e,t)},mmap(r,e,t,o,a){if(o&2&&!(a&2)&&(r.flags&2097155)!==2)throw new n.ErrnoError(2);if((r.flags&2097155)===1)throw new n.ErrnoError(2);if(!r.stream_ops.mmap)throw new n.ErrnoError(43);return r.stream_ops.mmap(r,e,t,o,a)},msync(r,e,t,o,a){return r.stream_ops.msync?r.stream_ops.msync(r,e,t,o,a):0},ioctl(r,e,t){if(!r.stream_ops.ioctl)throw new n.ErrnoError(59);return r.stream_ops.ioctl(r,e,t)},readFile(r,e={}){if(e.flags=e.flags||0,e.encoding=e.encoding||"binary",e.encoding!=="utf8"&&e.encoding!=="binary")throw new Error(`Invalid encoding type "${e.encoding}"`);var t,o=n.open(r,e.flags),a=n.stat(r),i=a.size,s=new Uint8Array(i);return n.read(o,s,0,i,0),e.encoding==="utf8"?t=ur(s,0):e.encoding==="binary"&&(t=s),n.close(o),t},writeFile(r,e,t={}){t.flags=t.flags||577;var o=n.open(r,t.flags,t.mode);if(typeof e=="string"){var a=new Uint8Array(Pr(e)+1),i=Lr(e,a,0,a.length);n.write(o,a,0,i,void 0,t.canOwn)}else if(ArrayBuffer.isView(e))n.write(o,e,0,e.byteLength,void 0,t.canOwn);else throw new Error("Unsupported data type");n.close(o)},cwd:()=>n.currentPath,chdir(r){var e=n.lookupPath(r,{follow:!0});if(e.node===null)throw new n.ErrnoError(44);if(!n.isDir(e.node.mode))throw new n.ErrnoError(54);var t=n.nodePermissions(e.node,"x");if(t)throw new n.ErrnoError(t);n.currentPath=e.path},createDefaultDirectories(){n.mkdir("/tmp"),n.mkdir("/home"),n.mkdir("/home/web_user")},createDefaultDevices(){n.mkdir("/dev"),n.registerDevice(n.makedev(1,3),{read:()=>0,write:(o,a,i,s,l)=>s}),n.mkdev("/dev/null",n.makedev(1,3)),rr.register(n.makedev(5,0),rr.default_tty_ops),rr.register(n.makedev(6,0),rr.default_tty1_ops),n.mkdev("/dev/tty",n.makedev(5,0)),n.mkdev("/dev/tty1",n.makedev(6,0));var r=new Uint8Array(1024),e=0,t=()=>(e===0&&(e=Zr(r).byteLength),r[--e]);n.createDevice("/dev","random",t),n.createDevice("/dev","urandom",t),n.mkdir("/dev/shm"),n.mkdir("/dev/shm/tmp")},createSpecialDirectories(){n.mkdir("/proc");var r=n.mkdir("/proc/self");n.mkdir("/proc/self/fd"),n.mount({mount(){var e=n.createNode(r,"fd",16895,73);return e.node_ops={lookup(t,o){var a=+o,i=n.getStreamChecked(a),s={parent:null,mount:{mountpoint:"fake"},node_ops:{readlink:()=>i.path}};return s.parent=s,s}},e}},{},"/proc/self/fd")},createStandardStreams(){u.stdin?n.createDevice("/dev","stdin",u.stdin):n.symlink("/dev/tty","/dev/stdin"),u.stdout?n.createDevice("/dev","stdout",null,u.stdout):n.symlink("/dev/tty","/dev/stdout"),u.stderr?n.createDevice("/dev","stderr",null,u.stderr):n.symlink("/dev/tty1","/dev/stderr");var r=n.open("/dev/stdin",0),e=n.open("/dev/stdout",1),t=n.open("/dev/stderr",1)},staticInit(){[44].forEach(r=>{n.genericErrors[r]=new n.ErrnoError(r),n.genericErrors[r].stack="<generic error, no stack>"}),n.nameTable=new Array(4096),n.mount(p,{},"/"),n.createDefaultDirectories(),n.createDefaultDevices(),n.createSpecialDirectories(),n.filesystems={MEMFS:p}},init(r,e,t){n.init.initialized=!0,u.stdin=r||u.stdin,u.stdout=e||u.stdout,u.stderr=t||u.stderr,n.createStandardStreams()},quit(){n.init.initialized=!1;for(var r=0;r<n.streams.length;r++){var e=n.streams[r];e&&n.close(e)}},findObject(r,e){var t=n.analyzePath(r,e);return t.exists?t.object:null},analyzePath(r,e){try{var t=n.lookupPath(r,{follow:!e});r=t.path}catch{}var o={isRoot:!1,exists:!1,error:0,name:null,path:null,object:null,parentExists:!1,parentPath:null,parentObject:null};try{var t=n.lookupPath(r,{parent:!0});o.parentExists=!0,o.parentPath=t.path,o.parentObject=t.node,o.name=P.basename(r),t=n.lookupPath(r,{follow:!e}),o.exists=!0,o.path=t.path,o.object=t.node,o.name=t.node.name,o.isRoot=t.path==="/"}catch(a){o.error=a.errno}return o},createPath(r,e,t,o){r=typeof r=="string"?r:n.getPath(r);for(var a=e.split("/").reverse();a.length;){var i=a.pop();if(i){var s=P.join2(r,i);try{n.mkdir(s)}catch{}r=s}}return s},createFile(r,e,t,o,a){var i=P.join2(typeof r=="string"?r:n.getPath(r),e),s=zr(o,a);return n.create(i,s)},createDataFile(r,e,t,o,a,i){var s=e;r&&(r=typeof r=="string"?r:n.getPath(r),s=e?P.join2(r,e):r);var l=zr(o,a),c=n.create(s,l);if(t){if(typeof t=="string"){for(var h=new Array(t.length),S=0,b=t.length;S<b;++S)h[S]=t.charCodeAt(S);t=h}n.chmod(c,l|146);var m=n.open(c,577);n.write(m,t,0,t.length,0,i),n.close(m),n.chmod(c,l)}},createDevice(r,e,t,o){var a=P.join2(typeof r=="string"?r:n.getPath(r),e),i=zr(!!t,!!o);n.createDevice.major||(n.createDevice.major=64);var s=n.makedev(n.createDevice.major++,0);return n.registerDevice(s,{open(l){l.seekable=!1},close(l){o?.buffer?.length&&o(10)},read(l,c,h,S,b){for(var m=0,v=0;v<S;v++){var E;try{E=t()}catch{throw new n.ErrnoError(29)}if(E===void 0&&m===0)throw new n.ErrnoError(6);if(E==null)break;m++,c[h+v]=E}return m&&(l.node.timestamp=Date.now()),m},write(l,c,h,S,b){for(var m=0;m<S;m++)try{o(c[h+m])}catch{throw new n.ErrnoError(29)}return S&&(l.node.timestamp=Date.now()),m}}),n.mkdev(a,i,s)},forceLoadFile(r){if(r.isDevice||r.isFolder||r.link||r.contents)return!0;if(typeof XMLHttpRequest<"u")throw new Error("Lazy loading should have been performed (contents set) in createLazyFile, but it was not. Lazy loading only works in web workers. Use --embed-file or --preload-file in emcc on the main thread.");if(j)try{r.contents=Dr(j(r.url),!0),r.usedBytes=r.contents.length}catch{throw new n.ErrnoError(29)}else throw new Error("Cannot load without read() or XMLHttpRequest.")},createLazyFile(r,e,t,o,a){class i{constructor(){this.lengthKnown=!1,this.chunks=[]}get(v){if(!(v>this.length-1||v<0)){var E=v%this.chunkSize,O=v/this.chunkSize|0;return this.getter(O)[E]}}setDataGetter(v){this.getter=v}cacheLength(){var v=new XMLHttpRequest;if(v.open("HEAD",t,!1),v.send(null),!(v.status>=200&&v.status<300||v.status===304))throw new Error("Couldn't load "+t+". Status: "+v.status);var E=Number(v.getResponseHeader("Content-length")),O,W=(O=v.getResponseHeader("Accept-Ranges"))&&O==="bytes",U=(O=v.getResponseHeader("Content-Encoding"))&&O==="gzip",f=1024*1024;W||(f=E);var d=(M,Y)=>{if(M>Y)throw new Error("invalid range ("+M+", "+Y+") or no bytes requested!");if(Y>E-1)throw new Error("only "+E+" bytes available! programmer error!");var T=new XMLHttpRequest;if(T.open("GET",t,!1),E!==f&&T.setRequestHeader("Range","bytes="+M+"-"+Y),T.responseType="arraybuffer",T.overrideMimeType&&T.overrideMimeType("text/plain; charset=x-user-defined"),T.send(null),!(T.status>=200&&T.status<300||T.status===304))throw new Error("Couldn't load "+t+". Status: "+T.status);return T.response!==void 0?new Uint8Array(T.response||[]):Dr(T.responseText||"",!0)},N=this;N.setDataGetter(M=>{var Y=M*f,T=(M+1)*f-1;if(T=Math.min(T,E-1),typeof N.chunks[M]>"u"&&(N.chunks[M]=d(Y,T)),typeof N.chunks[M]>"u")throw new Error("doXHR failed!");return N.chunks[M]}),(U||!E)&&(f=E=1,E=this.getter(0).length,f=E,mr("LazyFiles on gzip forces download of the whole file when length is accessed")),this._length=E,this._chunkSize=f,this.lengthKnown=!0}get length(){return this.lengthKnown||this.cacheLength(),this._length}get chunkSize(){return this.lengthKnown||this.cacheLength(),this._chunkSize}}if(typeof XMLHttpRequest<"u"){if(!tr)throw"Cannot do synchronous binary XHRs outside webworkers in modern browsers. Use --embed-file or --preload-file in emcc";var s=new i,l={isDevice:!1,contents:s}}else var l={isDevice:!1,url:t};var c=n.createFile(r,e,l,o,a);l.contents?c.contents=l.contents:l.url&&(c.contents=null,c.url=l.url),Object.defineProperties(c,{usedBytes:{get:function(){return this.contents.length}}});var h={},S=Object.keys(c.stream_ops);S.forEach(m=>{var v=c.stream_ops[m];h[m]=(...E)=>(n.forceLoadFile(c),v(...E))});function b(m,v,E,O,W){var U=m.node.contents;if(W>=U.length)return 0;var f=Math.min(U.length-W,O);if(U.slice)for(var d=0;d<f;d++)v[E+d]=U[W+d];else for(var d=0;d<f;d++)v[E+d]=U.get(W+d);return f}return h.read=(m,v,E,O,W)=>(n.forceLoadFile(c),b(m,v,E,O,W)),h.mmap=(m,v,E,O,W)=>{n.forceLoadFile(c);var U=ee(v);if(!U)throw new n.ErrnoError(48);return b(m,R,U,v,E),{ptr:U,allocated:!0}},c.stream_ops=h,c}},Or=(r,e)=>r?ur(z,r,e):"",y={DEFAULT_POLLMASK:5,calculateAt(r,e,t){if(P.isAbs(e))return e;var o;if(r===-100)o=n.cwd();else{var a=y.getStreamFromFD(r);o=a.path}if(e.length==0){if(!t)throw new n.ErrnoError(44);return o}return P.join2(o,e)},doStat(r,e,t){var o=r(e);_[t>>2]=o.dev,_[t+4>>2]=o.mode,D[t+8>>2]=o.nlink,_[t+12>>2]=o.uid,_[t+16>>2]=o.gid,_[t+20>>2]=o.rdev,I=[o.size>>>0,(g=o.size,+Math.abs(g)>=1?g>0?+Math.floor(g/4294967296)>>>0:~~+Math.ceil((g-+(~~g>>>0))/4294967296)>>>0:0)],_[t+24>>2]=I[0],_[t+28>>2]=I[1],_[t+32>>2]=4096,_[t+36>>2]=o.blocks;var a=o.atime.getTime(),i=o.mtime.getTime(),s=o.ctime.getTime();return I=[Math.floor(a/1e3)>>>0,(g=Math.floor(a/1e3),+Math.abs(g)>=1?g>0?+Math.floor(g/4294967296)>>>0:~~+Math.ceil((g-+(~~g>>>0))/4294967296)>>>0:0)],_[t+40>>2]=I[0],_[t+44>>2]=I[1],D[t+48>>2]=a%1e3*1e3,I=[Math.floor(i/1e3)>>>0,(g=Math.floor(i/1e3),+Math.abs(g)>=1?g>0?+Math.floor(g/4294967296)>>>0:~~+Math.ceil((g-+(~~g>>>0))/4294967296)>>>0:0)],_[t+56>>2]=I[0],_[t+60>>2]=I[1],D[t+64>>2]=i%1e3*1e3,I=[Math.floor(s/1e3)>>>0,(g=Math.floor(s/1e3),+Math.abs(g)>=1?g>0?+Math.floor(g/4294967296)>>>0:~~+Math.ceil((g-+(~~g>>>0))/4294967296)>>>0:0)],_[t+72>>2]=I[0],_[t+76>>2]=I[1],D[t+80>>2]=s%1e3*1e3,I=[o.ino>>>0,(g=o.ino,+Math.abs(g)>=1?g>0?+Math.floor(g/4294967296)>>>0:~~+Math.ceil((g-+(~~g>>>0))/4294967296)>>>0:0)],_[t+88>>2]=I[0],_[t+92>>2]=I[1],0},doMsync(r,e,t,o,a){if(!n.isFile(e.node.mode))throw new n.ErrnoError(43);if(o&2)return 0;var i=z.slice(r,r+t);n.msync(e,i,a,t,o)},varargs:void 0,get(){var r=_[+y.varargs>>2];return y.varargs+=4,r},getp(){return y.get()},getStr(r){var e=Or(r);return e},getStreamFromFD(r){var e=n.getStreamChecked(r);return e}};function nt(r){try{return r=y.getStr(r),n.chdir(r),0}catch(e){if(typeof n>"u"||e.name!=="ErrnoError")throw e;return-e.errno}}function ot(r,e,t,o){try{if(e=y.getStr(e),e=y.calculateAt(r,e),t&-8)return-28;var a=n.lookupPath(e,{follow:!0}),i=a.node;if(!i)return-44;var s="";return t&4&&(s+="r"),t&2&&(s+="w"),t&1&&(s+="x"),s&&n.nodePermissions(i,s)?-2:0}catch(l){if(typeof n>"u"||l.name!=="ErrnoError")throw l;return-l.errno}}function at(r,e,t){y.varargs=t;try{var o=y.getStreamFromFD(r);switch(e){case 0:{var a=y.get();if(a<0)return-28;for(;n.streams[a];)a++;var i;return i=n.dupStream(o,a),i.fd}case 1:case 2:return 0;case 3:return o.flags;case 4:{var a=y.get();return o.flags|=a,0}case 12:{var a=y.getp(),s=0;return Sr[a+s>>1]=2,0}case 13:case 14:return 0}return-28}catch(l){if(typeof n>"u"||l.name!=="ErrnoError")throw l;return-l.errno}}function it(r,e){try{var t=y.getStreamFromFD(r);return y.doStat(n.stat,t.path,e)}catch(o){if(typeof n>"u"||o.name!=="ErrnoError")throw o;return-o.errno}}var te=(r,e,t)=>Lr(r,z,e,t);function st(r,e){try{if(e===0)return-28;var t=n.cwd(),o=Pr(t)+1;return e<o?-68:(te(t,r,e),o)}catch(a){if(typeof n>"u"||a.name!=="ErrnoError")throw a;return-a.errno}}function lt(r,e,t){y.varargs=t;try{var o=y.getStreamFromFD(r);switch(e){case 21509:return o.tty?0:-59;case 21505:{if(!o.tty)return-59;if(o.tty.ops.ioctl_tcgets){var a=o.tty.ops.ioctl_tcgets(o),i=y.getp();_[i>>2]=a.c_iflag||0,_[i+4>>2]=a.c_oflag||0,_[i+8>>2]=a.c_cflag||0,_[i+12>>2]=a.c_lflag||0;for(var s=0;s<32;s++)R[i+s+17]=a.c_cc[s]||0;return 0}return 0}case 21510:case 21511:case 21512:return o.tty?0:-59;case 21506:case 21507:case 21508:{if(!o.tty)return-59;if(o.tty.ops.ioctl_tcsets){for(var i=y.getp(),l=_[i>>2],c=_[i+4>>2],h=_[i+8>>2],S=_[i+12>>2],b=[],s=0;s<32;s++)b.push(R[i+s+17]);return o.tty.ops.ioctl_tcsets(o.tty,e,{c_iflag:l,c_oflag:c,c_cflag:h,c_lflag:S,c_cc:b})}return 0}case 21519:{if(!o.tty)return-59;var i=y.getp();return _[i>>2]=0,0}case 21520:return o.tty?-28:-59;case 21531:{var i=y.getp();return n.ioctl(o,e,i)}case 21523:{if(!o.tty)return-59;if(o.tty.ops.ioctl_tiocgwinsz){var m=o.tty.ops.ioctl_tiocgwinsz(o.tty),i=y.getp();Sr[i>>1]=m[0],Sr[i+2>>1]=m[1]}return 0}case 21524:return o.tty?0:-59;case 21515:return o.tty?0:-59;default:return-28}}catch(v){if(typeof n>"u"||v.name!=="ErrnoError")throw v;return-v.errno}}function ut(r,e,t,o){try{e=y.getStr(e);var a=o&256,i=o&4096;return o=o&-6401,e=y.calculateAt(r,e,i),y.doStat(a?n.lstat:n.stat,e,t)}catch(s){if(typeof n>"u"||s.name!=="ErrnoError")throw s;return-s.errno}}function ft(r,e,t,o){y.varargs=o;try{e=y.getStr(e),e=y.calculateAt(r,e);var a=o?y.get():0;return n.open(e,t,a).fd}catch(i){if(typeof n>"u"||i.name!=="ErrnoError")throw i;return-i.errno}}function ct(r,e){try{return r=y.getStr(r),y.doStat(n.stat,r,e)}catch(t){if(typeof n>"u"||t.name!=="ErrnoError")throw t;return-t.errno}}var dt=1,vt=()=>dt,mt=()=>{Kr=!1,ae=0},ht=()=>{throw 1/0},Ur=(r,e)=>e+2097152>>>0<4194305-!!r?(r>>>0)+e*4294967296:NaN;function pt(r,e,t,o,a,i,s,l){var c=Ur(a,i);try{if(isNaN(c))return 61;var h=y.getStreamFromFD(o),S=n.mmap(h,r,c,e,t),b=S.ptr;return _[s>>2]=S.allocated,D[l>>2]=b,0}catch(m){if(typeof n>"u"||m.name!=="ErrnoError")throw m;return-m.errno}}function wt(r,e,t,o,a,i,s){var l=Ur(i,s);try{var c=y.getStreamFromFD(a);t&2&&y.doMsync(r,c,e,o,l)}catch(h){if(typeof n>"u"||h.name!=="ErrnoError")throw h;return-h.errno}}var _t=()=>{Ir("")},yt=()=>Date.now(),ne=()=>2147483648,gt=()=>ne(),oe;oe=()=>performance.now();var Et=(r,e,t)=>z.copyWithin(r,e,e+t),St=r=>{var e=sr.buffer,t=(r-e.byteLength+65535)/65536;try{return sr.grow(t),Hr(),1}catch{}},kt=r=>{var e=z.length;r>>>=0;var t=ne();if(r>t)return!1;for(var o=(c,h)=>c+(h-c%h)%h,a=1;a<=4;a*=2){var i=e*(1+.2/a);i=Math.min(i,r+100663296);var s=Math.min(t,o(Math.max(r,i),65536)),l=St(s);if(l)return!0}return!1},jr={},bt=()=>X||"./this.program",wr=()=>{if(!wr.strings){var r=(typeof navigator=="object"&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",e={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:r,_:bt()};for(var t in jr)jr[t]===void 0?delete e[t]:e[t]=jr[t];var o=[];for(var t in e)o.push(`${t}=${e[t]}`);wr.strings=o}return wr.strings},Ft=(r,e)=>{for(var t=0;t<r.length;++t)R[e++]=r.charCodeAt(t);R[e]=0},Pt=(r,e)=>{var t=0;return wr().forEach((o,a)=>{var i=e+t;D[r+a*4>>2]=i,Ft(o,i),t+=o.length+1}),0},Dt=(r,e)=>{var t=wr();D[r>>2]=t.length;var o=0;return t.forEach(a=>o+=a.length+1),D[e>>2]=o,0},ae=0,Mt=()=>Kr||ae>0,ie=r=>{nr=r,Mt()||(u.onExit?.(r),lr=!0),x(r,new Gr(r))},se=(r,e)=>{nr=r,ie(r)},At=se;function Rt(r){try{var e=y.getStreamFromFD(r);return n.close(e),0}catch(t){if(typeof n>"u"||t.name!=="ErrnoError")throw t;return t.errno}}var Tt=(r,e,t,o)=>{for(var a=0,i=0;i<t;i++){var s=D[e>>2],l=D[e+4>>2];e+=8;var c=n.read(r,R,s,l,o);if(c<0)return-1;if(a+=c,c<l)break;typeof o<"u"&&(o+=c)}return a};function Ct(r,e,t,o){try{var a=y.getStreamFromFD(r),i=Tt(a,e,t);return D[o>>2]=i,0}catch(s){if(typeof n>"u"||s.name!=="ErrnoError")throw s;return s.errno}}function It(r,e,t,o,a){var i=Ur(e,t);try{if(isNaN(i))return 61;var s=y.getStreamFromFD(r);return n.llseek(s,i,o),I=[s.position>>>0,(g=s.position,+Math.abs(g)>=1?g>0?+Math.floor(g/4294967296)>>>0:~~+Math.ceil((g-+(~~g>>>0))/4294967296)>>>0:0)],_[a>>2]=I[0],_[a+4>>2]=I[1],s.getdents&&i===0&&o===0&&(s.getdents=null),0}catch(l){if(typeof n>"u"||l.name!=="ErrnoError")throw l;return l.errno}}var Nt=(r,e,t,o)=>{for(var a=0,i=0;i<t;i++){var s=D[e>>2],l=D[e+4>>2];e+=8;var c=n.write(r,R,s,l,o);if(c<0)return-1;a+=c,typeof o<"u"&&(o+=c)}return a};function Lt(r,e,t,o){try{var a=y.getStreamFromFD(r),i=Nt(a,e,t);return D[o>>2]=i,0}catch(s){if(typeof n>"u"||s.name!=="ErrnoError")throw s;return s.errno}}var Mr=r=>r%4===0&&(r%100!==0||r%400===0),zt=(r,e)=>{for(var t=0,o=0;o<=e;t+=r[o++]);return t},le=[31,29,31,30,31,30,31,31,30,31,30,31],ue=[31,28,31,30,31,30,31,31,30,31,30,31],Ot=(r,e)=>{for(var t=new Date(r.getTime());e>0;){var o=Mr(t.getFullYear()),a=t.getMonth(),i=(o?le:ue)[a];if(e>i-t.getDate())e-=i-t.getDate()+1,t.setDate(1),a<11?t.setMonth(a+1):(t.setMonth(0),t.setFullYear(t.getFullYear()+1));else return t.setDate(t.getDate()+e),t}return t},Ut=(r,e)=>{R.set(r,e)},jt=(r,e,t,o)=>{var a=D[o+40>>2],i={tm_sec:_[o>>2],tm_min:_[o+4>>2],tm_hour:_[o+8>>2],tm_mday:_[o+12>>2],tm_mon:_[o+16>>2],tm_year:_[o+20>>2],tm_wday:_[o+24>>2],tm_yday:_[o+28>>2],tm_isdst:_[o+32>>2],tm_gmtoff:_[o+36>>2],tm_zone:a?Or(a):""},s=Or(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"};for(var c in l)s=s.replace(new RegExp(c,"g"),l[c]);var h=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],S=["January","February","March","April","May","June","July","August","September","October","November","December"];function b(f,d,N){for(var M=typeof f=="number"?f.toString():f||"";M.length<d;)M=N[0]+M;return M}function m(f,d){return b(f,d,"0")}function v(f,d){function N(Y){return Y<0?-1:Y>0?1:0}var M;return(M=N(f.getFullYear()-d.getFullYear()))===0&&(M=N(f.getMonth()-d.getMonth()))===0&&(M=N(f.getDate()-d.getDate())),M}function E(f){switch(f.getDay()){case 0:return new Date(f.getFullYear()-1,11,29);case 1:return f;case 2:return new Date(f.getFullYear(),0,3);case 3:return new Date(f.getFullYear(),0,2);case 4:return new Date(f.getFullYear(),0,1);case 5:return new Date(f.getFullYear()-1,11,31);case 6:return new Date(f.getFullYear()-1,11,30)}}function O(f){var d=Ot(new Date(f.tm_year+1900,0,1),f.tm_yday),N=new Date(d.getFullYear(),0,4),M=new Date(d.getFullYear()+1,0,4),Y=E(N),T=E(M);return v(Y,d)<=0?v(T,d)<=0?d.getFullYear()+1:d.getFullYear():d.getFullYear()-1}var W={"%a":f=>h[f.tm_wday].substring(0,3),"%A":f=>h[f.tm_wday],"%b":f=>S[f.tm_mon].substring(0,3),"%B":f=>S[f.tm_mon],"%C":f=>{var d=f.tm_year+1900;return m(d/100|0,2)},"%d":f=>m(f.tm_mday,2),"%e":f=>b(f.tm_mday,2," "),"%g":f=>O(f).toString().substring(2),"%G":O,"%H":f=>m(f.tm_hour,2),"%I":f=>{var d=f.tm_hour;return d==0?d=12:d>12&&(d-=12),m(d,2)},"%j":f=>m(f.tm_mday+zt(Mr(f.tm_year+1900)?le:ue,f.tm_mon-1),3),"%m":f=>m(f.tm_mon+1,2),"%M":f=>m(f.tm_min,2),"%n":()=>`
4
- `,"%p":f=>f.tm_hour>=0&&f.tm_hour<12?"AM":"PM","%S":f=>m(f.tm_sec,2),"%t":()=>" ","%u":f=>f.tm_wday||7,"%U":f=>{var d=f.tm_yday+7-f.tm_wday;return m(Math.floor(d/7),2)},"%V":f=>{var d=Math.floor((f.tm_yday+7-(f.tm_wday+6)%7)/7);if((f.tm_wday+371-f.tm_yday-2)%7<=2&&d++,d){if(d==53){var M=(f.tm_wday+371-f.tm_yday)%7;M!=4&&(M!=3||!Mr(f.tm_year))&&(d=1)}}else{d=52;var N=(f.tm_wday+7-f.tm_yday-1)%7;(N==4||N==5&&Mr(f.tm_year%400-1))&&d++}return m(d,2)},"%w":f=>f.tm_wday,"%W":f=>{var d=f.tm_yday+7-(f.tm_wday+6)%7;return m(Math.floor(d/7),2)},"%y":f=>(f.tm_year+1900).toString().substring(2),"%Y":f=>f.tm_year+1900,"%z":f=>{var d=f.tm_gmtoff,N=d>=0;return d=Math.abs(d)/60,d=d/60*100+d%60,(N?"+":"-")+("0000"+d).slice(-4)},"%Z":f=>f.tm_zone,"%%":()=>"%"};s=s.replace(/%%/g,"\0\0");for(var c in W)s.includes(c)&&(s=s.replace(new RegExp(c,"g"),W[c](i)));s=s.replace(/\0\0/g,"%");var U=Dr(s,!1);return U.length>e?0:(Ut(U,r),U.length-1)},xt=(r,e,t,o,a)=>jt(r,e,t,o),Bt=r=>{if(r instanceof Gr||r=="unwind")return nr;x(1,r)},Ht=r=>{var e=Pr(r)+1,t=xr(e);return te(r,t,e),t};n.createPreloadedFile=et,n.staticInit(),u.FS_createPath=n.createPath,u.FS_createDataFile=n.createDataFile,u.FS_createPreloadedFile=n.createPreloadedFile,u.FS_unlink=n.unlink,u.FS_createLazyFile=n.createLazyFile,u.FS_createDevice=n.createDevice;var Wt={y:We,a:qe,L:nt,M:ot,q:at,G:it,D:st,N:lt,E:ut,n:ft,F:ct,I:vt,A:mt,v:ht,r:pt,s:wt,b:_t,J:yt,x:gt,H:oe,K:Et,w:kt,B:Pt,C:Dt,j:At,l:Rt,p:Ct,t:It,o:Lt,h:Kt,k:$t,d:Xt,e:qt,m:Jt,c:Vt,f:Gt,i:Zt,g:Qt,z:ie,u:xt},H=He(),Yt=()=>(Yt=H.P)(),fe=u._main=(r,e)=>(fe=u._main=H.Q)(r,e),ce=(r,e)=>(ce=H.S)(r,e),V=(r,e)=>(V=H.T)(r,e),G=()=>(G=H.U)(),K=r=>(K=H.V)(r),xr=r=>(xr=H.W)(r),de=r=>(de=H.X)(r);function Xt(r,e,t,o){var a=G();try{return $(r)(e,t,o)}catch(i){if(K(a),i!==i+0)throw i;V(1,0)}}function qt(r,e,t,o,a){var i=G();try{return $(r)(e,t,o,a)}catch(s){if(K(i),s!==s+0)throw s;V(1,0)}}function $t(r,e,t){var o=G();try{return $(r)(e,t)}catch(a){if(K(o),a!==a+0)throw a;V(1,0)}}function Vt(r){var e=G();try{$(r)()}catch(t){if(K(e),t!==t+0)throw t;V(1,0)}}function Gt(r,e){var t=G();try{$(r)(e)}catch(o){if(K(t),o!==o+0)throw o;V(1,0)}}function Kt(r){var e=G();try{return $(r)()}catch(t){if(K(e),t!==t+0)throw t;V(1,0)}}function Jt(r,e,t,o,a,i){var s=G();try{return $(r)(e,t,o,a,i)}catch(l){if(K(s),l!==l+0)throw l;V(1,0)}}function Qt(r,e,t,o){var a=G();try{$(r)(e,t,o)}catch(i){if(K(a),i!==i+0)throw i;V(1,0)}}function Zt(r,e,t){var o=G();try{$(r)(e,t)}catch(a){if(K(o),a!==a+0)throw a;V(1,0)}}u.addRunDependency=kr,u.removeRunDependency=pr,u.FS_createPath=n.createPath,u.FS_createLazyFile=n.createLazyFile,u.FS_createDevice=n.createDevice,u.callMain=ve,u.FS_createPreloadedFile=n.createPreloadedFile,u.FS=n,u.FS_createDataFile=n.createDataFile,u.FS_unlink=n.unlink;var Ar;hr=function r(){Ar||me(),Ar||(hr=r)};function ve(r=[]){var e=fe;r.unshift(X);var t=r.length,o=xr((t+1)*4),a=o;r.forEach(s=>{D[a>>2]=Ht(s),a+=4}),D[a>>2]=0;try{var i=e(t,o);return se(i,!0),i}catch(s){return Bt(s)}}function me(r=Q){if(or>0||(Ce(),or>0))return;function e(){Ar||(Ar=!0,u.calledRun=!0,!lr&&(Ie(),Ne(),L(u),u.onRuntimeInitialized&&u.onRuntimeInitialized(),he&&ve(r),Le()))}u.setStatus?(u.setStatus("Running..."),setTimeout(function(){setTimeout(function(){u.setStatus("")},1),e()},1)):e()}if(u.preInit)for(typeof u.preInit=="function"&&(u.preInit=[u.preInit]);u.preInit.length>0;)u.preInit.pop()();var he=!1;return u.noInitialRun&&(he=!1),me(),F.ready}})(),A=null,fr=!1,yr=null,Rr=null,cr=null,_e=new Promise(function(w,F){Rr=w,cr=F}),er={OPTIMAL:"optimal",INFEASIBLE:"infeasible",UNBOUNDED:"unbounded",TIME_LIMIT:"timelimit",UNKNOWN:"unknown",ERROR:"error"};function ye(w){return w.includes("optimal solution found")?er.OPTIMAL:w.includes("problem is infeasible")?er.INFEASIBLE:w.includes("problem is unbounded")?er.UNBOUNDED:w.includes("time limit reached")?er.TIME_LIMIT:er.UNKNOWN}function ge(w){var F={},u={value:null},L=w.match(/objective value:\s*([\d.e+-]+)/i);L&&(u.value=parseFloat(L[1]));for(var k=/^(\w+)\s+([\d.e+-]+)/gm,C,Q=w.split("solution:")[1]||w;(C=k.exec(Q))!==null;){var X=C[1],x=parseFloat(C[2]);!isNaN(x)&&X!=="objective"&&(F[X]=x)}return{variables:F,objective:u}}function Ee(w){var F={solvingTime:null,nodes:null,iterations:null,gap:null},u=w.match(/Solving Time \(sec\)\s*:\s*([\d.]+)/);u&&(F.solvingTime=parseFloat(u[1]));var L=w.match(/Nodes\s*:\s*(\d+)/);L&&(F.nodes=parseInt(L[1]));var k=w.match(/LP Iterations\s*:\s*(\d+)/);k&&(F.iterations=parseInt(k[1]));var C=w.match(/Gap\s*:\s*([\d.]+)\s*%/);return C&&(F.gap=parseFloat(C[1])),F}function gr(w){return w=w||{},fr?Promise.resolve():yr||(yr=new Promise(function(F,u){try{var L=w.wasmPath||_r+"scip.wasm";console.log("[SCIP.js] __SCIP_SCRIPT_DIR__:",_r),console.log("[SCIP.js] Loading WASM from:",L),fetch(L,{method:"HEAD"}).then(function(k){console.log("[SCIP.js] WASM file check:",k.ok?"OK":"FAILED",k.status)}).catch(function(k){console.error("[SCIP.js] WASM file check failed:",k)}),we({locateFile:function(k){return k.endsWith(".wasm")?(console.log("[SCIP.js] locateFile called for:",k,"-> returning:",L),L):k},print:function(k){A&&A.onStdout&&A.onStdout(k)},printErr:function(k){A&&A.onStderr&&A.onStderr(k)}}).then(function(k){if(console.log("[SCIP.js] WASM loaded successfully"),A=k,A.FS){try{A.FS.mkdir("/problems")}catch{}try{A.FS.mkdir("/solutions")}catch{}try{A.FS.mkdir("/settings")}catch{}}fr=!0,Rr&&Rr(),F()}).catch(function(k){console.error("[SCIP.js] WASM loading failed:",k),console.error("[SCIP.js] Attempted WASM path:",L),console.error("[SCIP.js] Make sure the WASM file is accessible at this URL."),console.error("[SCIP.js] You can set window.SCIP_BASE_URL before loading this script to specify a custom path.");var C=new Error("SCIP WASM loading failed: "+(k.message||k)+". WASM path: "+L);cr&&cr(C),u(C)})}catch(k){console.error("[SCIP.js] Initialization error:",k),cr&&cr(k),u(k)}}),yr)}function Tr(w,F){F=F||{};var u=function(){var L=F.format||"lp",k=F.timeLimit||3600,C=F.gap||null,Q=F.verbose||!1,X=F.parameters||{},x="",dr="";A.onStdout=function(z){x+=z+`
5
- `,Q&&console.log("[SCIP]",z)},A.onStderr=function(z){dr+=z+`
6
- `,Q&&console.error("[SCIP Error]",z)};try{var tr={mps:"mps",zpl:"zpl",cip:"cip",lp:"lp"},Br=tr[L]||"lp",B="/problems/problem."+Br,Er="/solutions/solution.sol";A.FS.writeFile(B,w);var j=[];j.push("set limits time "+k),C!==null&&j.push("set limits gap "+C);for(var ir in X)X.hasOwnProperty(ir)&&j.push("set "+ir+" "+X[ir]);j.push("read "+B),j.push("optimize"),j.push("display solution"),j.push("write solution "+Er),j.push("display statistics"),j.push("quit");var vr=j.join(`
7
- `);A.FS.writeFile("/settings/commands.txt",vr);var mr=A.callMain(["-b","/settings/commands.txt"]),q=ye(x),Z=ge(x),sr=Ee(x),lr=null;try{lr=A.FS.readFile(Er,{encoding:"utf8"})}catch{}for(var nr=["/problems/problem.lp","/problems/problem.mps","/problems/problem.zpl","/problems/problem.cip","/solutions/solution.sol","/settings/commands.txt"],R=0;R<nr.length;R++)try{A.FS.unlink(nr[R])}catch{}return{status:q,objective:Z.objective.value,variables:Z.variables,statistics:sr,exitCode:mr,output:Q?x:void 0,rawSolution:lr}}catch(z){return{status:er.ERROR,error:z.message,output:x+dr}}};return fr?Promise.resolve(u()):gr(F).then(u)}function Se(w,F){return w.toLowerCase().includes("minimize")||(w=`Minimize
8
- `+w),Tr(w,F)}function ke(w,F){return w.toLowerCase().includes("maximize")||(w=`Maximize
9
- `+w),Tr(w,F)}function be(){var w=function(){var F="";return A.onStdout=function(u){F+=u+`
10
- `},A.callMain(["--version"]),F.trim()};return fr?Promise.resolve(w()):gr().then(w)}function Fe(){return fr}var Pe={init:gr,ready:_e,isReady:Fe,solve:Tr,minimize:Se,maximize:ke,version:be,Status:er};pe.SCIP=Pe,gr().catch(function(w){console.error("[SCIP.js] Auto-initialization failed:",w.message)})})(typeof self<"u"?self:typeof window<"u"?window:globalThis);
3
+ `)),!r)return null;Zr=jr(r,!0)}return Zr.shift()},cr={ttys:[],init(){},shutdown(){},register(r,e){cr.ttys[r]={input:[],output:[],ops:e},n.registerDevice(r,cr.stream_ops)},stream_ops:{open(r){var e=cr.ttys[r.node.rdev];if(!e)throw new n.ErrnoError(43);r.tty=e,r.seekable=!1},close(r){r.tty.ops.fsync(r.tty)},fsync(r){r.tty.ops.fsync(r.tty)},read(r,e,t,o,i){if(!r.tty||!r.tty.ops.get_char)throw new n.ErrnoError(60);for(var a=0,s=0;s<o;s++){var u;try{u=r.tty.ops.get_char(r.tty)}catch{throw new n.ErrnoError(29)}if(u===void 0&&a===0)throw new n.ErrnoError(6);if(u==null)break;a++,e[t+s]=u}return a&&(r.node.timestamp=Date.now()),a},write(r,e,t,o,i){if(!r.tty||!r.tty.ops.put_char)throw new n.ErrnoError(60);try{for(var a=0;a<o;a++)r.tty.ops.put_char(r.tty,e[t+a])}catch{throw new n.ErrnoError(29)}return o&&(r.node.timestamp=Date.now()),a}},default_tty_ops:{get_char(r){return vt()},put_char(r,e){e===null||e===10?(Mr(Er(r.output,0)),r.output=[]):e!=0&&r.output.push(e)},fsync(r){r.output&&r.output.length>0&&(Mr(Er(r.output,0)),r.output=[])},ioctl_tcgets(r){return{c_iflag:25856,c_oflag:5,c_cflag:191,c_lflag:35387,c_cc:[3,28,127,21,4,0,1,0,17,19,26,0,18,15,23,22,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]}},ioctl_tcsets(r,e,t){return 0},ioctl_tiocgwinsz(r){return[24,80]}},default_tty1_ops:{put_char(r,e){e===null||e===10?(Z(Er(r.output,0)),r.output=[]):e!=0&&r.output.push(e)},fsync(r){r.output&&r.output.length>0&&(Z(Er(r.output,0)),r.output=[])}}},mt=(r,e)=>(B.fill(0,r,r+e),r),ht=(r,e)=>Math.ceil(r/e)*e,ge=r=>{r=ht(r,65536);var e=Ae(65536,r);return e?mt(e,r):0},w={ops_table:null,mount(r){return w.createNode(null,"/",16895,0)},createNode(r,e,t,o){if(n.isBlkdev(t)||n.isFIFO(t))throw new n.ErrnoError(63);w.ops_table||(w.ops_table={dir:{node:{getattr:w.node_ops.getattr,setattr:w.node_ops.setattr,lookup:w.node_ops.lookup,mknod:w.node_ops.mknod,rename:w.node_ops.rename,unlink:w.node_ops.unlink,rmdir:w.node_ops.rmdir,readdir:w.node_ops.readdir,symlink:w.node_ops.symlink},stream:{llseek:w.stream_ops.llseek}},file:{node:{getattr:w.node_ops.getattr,setattr:w.node_ops.setattr},stream:{llseek:w.stream_ops.llseek,read:w.stream_ops.read,write:w.stream_ops.write,allocate:w.stream_ops.allocate,mmap:w.stream_ops.mmap,msync:w.stream_ops.msync}},link:{node:{getattr:w.node_ops.getattr,setattr:w.node_ops.setattr,readlink:w.node_ops.readlink},stream:{}},chrdev:{node:{getattr:w.node_ops.getattr,setattr:w.node_ops.setattr},stream:n.chrdev_stream_ops}});var i=n.createNode(r,e,t,o);return n.isDir(i.mode)?(i.node_ops=w.ops_table.dir.node,i.stream_ops=w.ops_table.dir.stream,i.contents={}):n.isFile(i.mode)?(i.node_ops=w.ops_table.file.node,i.stream_ops=w.ops_table.file.stream,i.usedBytes=0,i.contents=null):n.isLink(i.mode)?(i.node_ops=w.ops_table.link.node,i.stream_ops=w.ops_table.link.stream):n.isChrdev(i.mode)&&(i.node_ops=w.ops_table.chrdev.node,i.stream_ops=w.ops_table.chrdev.stream),i.timestamp=Date.now(),r&&(r.contents[e]=i,r.timestamp=i.timestamp),i},getFileDataAsTypedArray(r){return r.contents?r.contents.subarray?r.contents.subarray(0,r.usedBytes):new Uint8Array(r.contents):new Uint8Array(0)},expandFileStorage(r,e){var t=r.contents?r.contents.length:0;if(!(t>=e)){var o=1024*1024;e=Math.max(e,t*(t<o?2:1.125)>>>0),t!=0&&(e=Math.max(e,256));var i=r.contents;r.contents=new Uint8Array(e),r.usedBytes>0&&r.contents.set(i.subarray(0,r.usedBytes),0)}},resizeFileStorage(r,e){if(r.usedBytes!=e)if(e==0)r.contents=null,r.usedBytes=0;else{var t=r.contents;r.contents=new Uint8Array(e),t&&r.contents.set(t.subarray(0,Math.min(e,r.usedBytes))),r.usedBytes=e}},node_ops:{getattr(r){var e={};return e.dev=n.isChrdev(r.mode)?r.id:1,e.ino=r.id,e.mode=r.mode,e.nlink=1,e.uid=0,e.gid=0,e.rdev=r.rdev,n.isDir(r.mode)?e.size=4096:n.isFile(r.mode)?e.size=r.usedBytes:n.isLink(r.mode)?e.size=r.link.length:e.size=0,e.atime=new Date(r.timestamp),e.mtime=new Date(r.timestamp),e.ctime=new Date(r.timestamp),e.blksize=4096,e.blocks=Math.ceil(e.size/e.blksize),e},setattr(r,e){e.mode!==void 0&&(r.mode=e.mode),e.timestamp!==void 0&&(r.timestamp=e.timestamp),e.size!==void 0&&w.resizeFileStorage(r,e.size)},lookup(r,e){throw n.genericErrors[44]},mknod(r,e,t,o){return w.createNode(r,e,t,o)},rename(r,e,t){if(n.isDir(r.mode)){var o;try{o=n.lookupNode(e,t)}catch{}if(o)for(var i in o.contents)throw new n.ErrnoError(55)}delete r.parent.contents[r.name],r.parent.timestamp=Date.now(),r.name=t,e.contents[t]=r,e.timestamp=r.parent.timestamp,r.parent=e},unlink(r,e){delete r.contents[e],r.timestamp=Date.now()},rmdir(r,e){var t=n.lookupNode(r,e);for(var o in t.contents)throw new n.ErrnoError(55);delete r.contents[e],r.timestamp=Date.now()},readdir(r){var e=[".",".."];for(var t of Object.keys(r.contents))e.push(t);return e},symlink(r,e,t){var o=w.createNode(r,e,41471,0);return o.link=t,o},readlink(r){if(!n.isLink(r.mode))throw new n.ErrnoError(28);return r.link}},stream_ops:{read(r,e,t,o,i){var a=r.node.contents;if(i>=r.node.usedBytes)return 0;var s=Math.min(r.node.usedBytes-i,o);if(s>8&&a.subarray)e.set(a.subarray(i,i+s),t);else for(var u=0;u<s;u++)e[t+u]=a[i+u];return s},write(r,e,t,o,i,a){if(e.buffer===C.buffer&&(a=!1),!o)return 0;var s=r.node;if(s.timestamp=Date.now(),e.subarray&&(!s.contents||s.contents.subarray)){if(a)return s.contents=e.subarray(t,t+o),s.usedBytes=o,o;if(s.usedBytes===0&&i===0)return s.contents=e.slice(t,t+o),s.usedBytes=o,o;if(i+o<=s.usedBytes)return s.contents.set(e.subarray(t,t+o),i),o}if(w.expandFileStorage(s,i+o),s.contents.subarray&&e.subarray)s.contents.set(e.subarray(t,t+o),i);else for(var u=0;u<o;u++)s.contents[i+u]=e[t+u];return s.usedBytes=Math.max(s.usedBytes,i+o),o},llseek(r,e,t){var o=e;if(t===1?o+=r.position:t===2&&n.isFile(r.node.mode)&&(o+=r.node.usedBytes),o<0)throw new n.ErrnoError(28);return o},allocate(r,e,t){w.expandFileStorage(r.node,e+t),r.node.usedBytes=Math.max(r.node.usedBytes,e+t)},mmap(r,e,t,o,i){if(!n.isFile(r.node.mode))throw new n.ErrnoError(43);var a,s,u=r.node.contents;if(!(i&2)&&u.buffer===C.buffer)s=!1,a=u.byteOffset;else{if((t>0||t+e<u.length)&&(u.subarray?u=u.subarray(t,t+e):u=Array.prototype.slice.call(u,t,t+e)),s=!0,a=ge(e),!a)throw new n.ErrnoError(48);C.set(u,a)}return{ptr:a,allocated:s}},msync(r,e,t,o,i){return w.stream_ops.write(r,e,0,o,t,!1),0}}},pt=(r,e,t,o)=>{var i=o?"":`al ${r}`;gr(r,a=>{e(new Uint8Array(a)),i&&Ar(i)},a=>{if(t)t();else throw`Loading data file "${r}" failed.`}),i&&Or(i)},wt=(r,e,t,o,i,a)=>{n.createDataFile(r,e,t,o,i,a)},yt=l.preloadPlugins||[],_t=(r,e,t,o)=>{typeof Browser<"u"&&Browser.init();var i=!1;return yt.forEach(a=>{i||a.canHandle(e)&&(a.handle(r,e,t,o),i=!0)}),i},gt=(r,e,t,o,i,a,s,u,c,h)=>{var b=e?ur.resolve(A.join2(r,e)):r,P=`cp ${b}`;function m(v){function k(j){h?.(),u||wt(r,e,j,o,i,c),a?.(),Ar(P)}_t(v,b,k,()=>{s?.(),Ar(P)})||k(v)}Or(P),typeof t=="string"?pt(t,m,s):m(t)},Et=r=>{var e={r:0,"r+":2,w:577,"w+":578,a:1089,"a+":1090},t=e[r];if(typeof t>"u")throw new Error(`Unknown file open mode: ${r}`);return t},ee=(r,e)=>{var t=0;return r&&(t|=365),e&&(t|=146),t},n={root:null,mounts:[],devices:{},streams:[],nextInode:1,nameTable:null,currentPath:"/",initialized:!1,ignorePermissions:!0,ErrnoError:class{constructor(r){this.name="ErrnoError",this.errno=r}},genericErrors:{},filesystems:null,syncFSRequests:0,FSStream:class{constructor(){this.shared={}}get object(){return this.node}set object(r){this.node=r}get isRead(){return(this.flags&2097155)!==1}get isWrite(){return(this.flags&2097155)!==0}get isAppend(){return this.flags&1024}get flags(){return this.shared.flags}set flags(r){this.shared.flags=r}get position(){return this.shared.position}set position(r){this.shared.position=r}},FSNode:class{constructor(r,e,t,o){r||(r=this),this.parent=r,this.mount=r.mount,this.mounted=null,this.id=n.nextInode++,this.name=e,this.mode=t,this.node_ops={},this.stream_ops={},this.rdev=o,this.readMode=365,this.writeMode=146}get read(){return(this.mode&this.readMode)===this.readMode}set read(r){r?this.mode|=this.readMode:this.mode&=~this.readMode}get write(){return(this.mode&this.writeMode)===this.writeMode}set write(r){r?this.mode|=this.writeMode:this.mode&=~this.writeMode}get isFolder(){return n.isDir(this.mode)}get isDevice(){return n.isChrdev(this.mode)}},lookupPath(r,e={}){if(r=ur.resolve(r),!r)return{path:"",node:null};var t={follow_mount:!0,recurse_count:0};if(e=Object.assign(t,e),e.recurse_count>8)throw new n.ErrnoError(32);for(var o=r.split("/").filter(P=>!!P),i=n.root,a="/",s=0;s<o.length;s++){var u=s===o.length-1;if(u&&e.parent)break;if(i=n.lookupNode(i,o[s]),a=A.join2(a,o[s]),n.isMountpoint(i)&&(!u||u&&e.follow_mount)&&(i=i.mounted.root),!u||e.follow)for(var c=0;n.isLink(i.mode);){var h=n.readlink(a);a=ur.resolve(A.dirname(a),h);var b=n.lookupPath(a,{recurse_count:e.recurse_count+1});if(i=b.node,c++>40)throw new n.ErrnoError(32)}}return{path:a,node:i}},getPath(r){for(var e;;){if(n.isRoot(r)){var t=r.mount.mountpoint;return e?t[t.length-1]!=="/"?`${t}/${e}`:t+e:t}e=e?`${r.name}/${e}`:r.name,r=r.parent}},hashName(r,e){for(var t=0,o=0;o<e.length;o++)t=(t<<5)-t+e.charCodeAt(o)|0;return(r+t>>>0)%n.nameTable.length},hashAddNode(r){var e=n.hashName(r.parent.id,r.name);r.name_next=n.nameTable[e],n.nameTable[e]=r},hashRemoveNode(r){var e=n.hashName(r.parent.id,r.name);if(n.nameTable[e]===r)n.nameTable[e]=r.name_next;else for(var t=n.nameTable[e];t;){if(t.name_next===r){t.name_next=r.name_next;break}t=t.name_next}},lookupNode(r,e){var t=n.mayLookup(r);if(t)throw new n.ErrnoError(t);for(var o=n.hashName(r.id,e),i=n.nameTable[o];i;i=i.name_next){var a=i.name;if(i.parent.id===r.id&&a===e)return i}return n.lookup(r,e)},createNode(r,e,t,o){var i=new n.FSNode(r,e,t,o);return n.hashAddNode(i),i},destroyNode(r){n.hashRemoveNode(r)},isRoot(r){return r===r.parent},isMountpoint(r){return!!r.mounted},isFile(r){return(r&61440)===32768},isDir(r){return(r&61440)===16384},isLink(r){return(r&61440)===40960},isChrdev(r){return(r&61440)===8192},isBlkdev(r){return(r&61440)===24576},isFIFO(r){return(r&61440)===4096},isSocket(r){return(r&49152)===49152},flagsToPermissionString(r){var e=["r","w","rw"][r&3];return r&512&&(e+="w"),e},nodePermissions(r,e){return n.ignorePermissions?0:e.includes("r")&&!(r.mode&292)||e.includes("w")&&!(r.mode&146)||e.includes("x")&&!(r.mode&73)?2:0},mayLookup(r){if(!n.isDir(r.mode))return 54;var e=n.nodePermissions(r,"x");return e||(r.node_ops.lookup?0:2)},mayCreate(r,e){try{var t=n.lookupNode(r,e);return 20}catch{}return n.nodePermissions(r,"wx")},mayDelete(r,e,t){var o;try{o=n.lookupNode(r,e)}catch(a){return a.errno}var i=n.nodePermissions(r,"wx");if(i)return i;if(t){if(!n.isDir(o.mode))return 54;if(n.isRoot(o)||n.getPath(o)===n.cwd())return 10}else if(n.isDir(o.mode))return 31;return 0},mayOpen(r,e){return r?n.isLink(r.mode)?32:n.isDir(r.mode)&&(n.flagsToPermissionString(e)!=="r"||e&512)?31:n.nodePermissions(r,n.flagsToPermissionString(e)):44},MAX_OPEN_FDS:4096,nextfd(){for(var r=0;r<=n.MAX_OPEN_FDS;r++)if(!n.streams[r])return r;throw new n.ErrnoError(33)},getStreamChecked(r){var e=n.getStream(r);if(!e)throw new n.ErrnoError(8);return e},getStream:r=>n.streams[r],createStream(r,e=-1){return r=Object.assign(new n.FSStream,r),e==-1&&(e=n.nextfd()),r.fd=e,n.streams[e]=r,r},closeStream(r){n.streams[r]=null},dupStream(r,e=-1){var t=n.createStream(r,e);return t.stream_ops?.dup?.(t),t},chrdev_stream_ops:{open(r){var e=n.getDevice(r.node.rdev);r.stream_ops=e.stream_ops,r.stream_ops.open?.(r)},llseek(){throw new n.ErrnoError(70)}},major:r=>r>>8,minor:r=>r&255,makedev:(r,e)=>r<<8|e,registerDevice(r,e){n.devices[r]={stream_ops:e}},getDevice:r=>n.devices[r],getMounts(r){for(var e=[],t=[r];t.length;){var o=t.pop();e.push(o),t.push(...o.mounts)}return e},syncfs(r,e){typeof r=="function"&&(e=r,r=!1),n.syncFSRequests++,n.syncFSRequests>1&&Z(`warning: ${n.syncFSRequests} FS.syncfs operations in flight at once, probably just doing extra work`);var t=n.getMounts(n.root.mount),o=0;function i(s){return n.syncFSRequests--,e(s)}function a(s){if(s)return a.errored?void 0:(a.errored=!0,i(s));++o>=t.length&&i(null)}t.forEach(s=>{if(!s.type.syncfs)return a(null);s.type.syncfs(s,r,a)})},mount(r,e,t){var o=t==="/",i=!t,a;if(o&&n.root)throw new n.ErrnoError(10);if(!o&&!i){var s=n.lookupPath(t,{follow_mount:!1});if(t=s.path,a=s.node,n.isMountpoint(a))throw new n.ErrnoError(10);if(!n.isDir(a.mode))throw new n.ErrnoError(54)}var u={type:r,opts:e,mountpoint:t,mounts:[]},c=r.mount(u);return c.mount=u,u.root=c,o?n.root=c:a&&(a.mounted=u,a.mount&&a.mount.mounts.push(u)),c},unmount(r){var e=n.lookupPath(r,{follow_mount:!1});if(!n.isMountpoint(e.node))throw new n.ErrnoError(28);var t=e.node,o=t.mounted,i=n.getMounts(o);Object.keys(n.nameTable).forEach(s=>{for(var u=n.nameTable[s];u;){var c=u.name_next;i.includes(u.mount)&&n.destroyNode(u),u=c}}),t.mounted=null;var a=t.mount.mounts.indexOf(o);t.mount.mounts.splice(a,1)},lookup(r,e){return r.node_ops.lookup(r,e)},mknod(r,e,t){var o=n.lookupPath(r,{parent:!0}),i=o.node,a=A.basename(r);if(!a||a==="."||a==="..")throw new n.ErrnoError(28);var s=n.mayCreate(i,a);if(s)throw new n.ErrnoError(s);if(!i.node_ops.mknod)throw new n.ErrnoError(63);return i.node_ops.mknod(i,a,e,t)},create(r,e){return e=e!==void 0?e:438,e&=4095,e|=32768,n.mknod(r,e,0)},mkdir(r,e){return e=e!==void 0?e:511,e&=1023,e|=16384,n.mknod(r,e,0)},mkdirTree(r,e){for(var t=r.split("/"),o="",i=0;i<t.length;++i)if(t[i]){o+="/"+t[i];try{n.mkdir(o,e)}catch(a){if(a.errno!=20)throw a}}},mkdev(r,e,t){return typeof t>"u"&&(t=e,e=438),e|=8192,n.mknod(r,e,t)},symlink(r,e){if(!ur.resolve(r))throw new n.ErrnoError(44);var t=n.lookupPath(e,{parent:!0}),o=t.node;if(!o)throw new n.ErrnoError(44);var i=A.basename(e),a=n.mayCreate(o,i);if(a)throw new n.ErrnoError(a);if(!o.node_ops.symlink)throw new n.ErrnoError(63);return o.node_ops.symlink(o,i,r)},rename(r,e){var t=A.dirname(r),o=A.dirname(e),i=A.basename(r),a=A.basename(e),s,u,c;if(s=n.lookupPath(r,{parent:!0}),u=s.node,s=n.lookupPath(e,{parent:!0}),c=s.node,!u||!c)throw new n.ErrnoError(44);if(u.mount!==c.mount)throw new n.ErrnoError(75);var h=n.lookupNode(u,i),b=ur.relative(r,o);if(b.charAt(0)!==".")throw new n.ErrnoError(28);if(b=ur.relative(e,t),b.charAt(0)!==".")throw new n.ErrnoError(55);var P;try{P=n.lookupNode(c,a)}catch{}if(h!==P){var m=n.isDir(h.mode),v=n.mayDelete(u,i,m);if(v)throw new n.ErrnoError(v);if(v=P?n.mayDelete(c,a,m):n.mayCreate(c,a),v)throw new n.ErrnoError(v);if(!u.node_ops.rename)throw new n.ErrnoError(63);if(n.isMountpoint(h)||P&&n.isMountpoint(P))throw new n.ErrnoError(10);if(c!==u&&(v=n.nodePermissions(u,"w"),v))throw new n.ErrnoError(v);n.hashRemoveNode(h);try{u.node_ops.rename(h,c,a)}catch(k){throw k}finally{n.hashAddNode(h)}}},rmdir(r){var e=n.lookupPath(r,{parent:!0}),t=e.node,o=A.basename(r),i=n.lookupNode(t,o),a=n.mayDelete(t,o,!0);if(a)throw new n.ErrnoError(a);if(!t.node_ops.rmdir)throw new n.ErrnoError(63);if(n.isMountpoint(i))throw new n.ErrnoError(10);t.node_ops.rmdir(t,o),n.destroyNode(i)},readdir(r){var e=n.lookupPath(r,{follow:!0}),t=e.node;if(!t.node_ops.readdir)throw new n.ErrnoError(54);return t.node_ops.readdir(t)},unlink(r){var e=n.lookupPath(r,{parent:!0}),t=e.node;if(!t)throw new n.ErrnoError(44);var o=A.basename(r),i=n.lookupNode(t,o),a=n.mayDelete(t,o,!1);if(a)throw new n.ErrnoError(a);if(!t.node_ops.unlink)throw new n.ErrnoError(63);if(n.isMountpoint(i))throw new n.ErrnoError(10);t.node_ops.unlink(t,o),n.destroyNode(i)},readlink(r){var e=n.lookupPath(r),t=e.node;if(!t)throw new n.ErrnoError(44);if(!t.node_ops.readlink)throw new n.ErrnoError(28);return ur.resolve(n.getPath(t.parent),t.node_ops.readlink(t))},stat(r,e){var t=n.lookupPath(r,{follow:!e}),o=t.node;if(!o)throw new n.ErrnoError(44);if(!o.node_ops.getattr)throw new n.ErrnoError(63);return o.node_ops.getattr(o)},lstat(r){return n.stat(r,!0)},chmod(r,e,t){var o;if(typeof r=="string"){var i=n.lookupPath(r,{follow:!t});o=i.node}else o=r;if(!o.node_ops.setattr)throw new n.ErrnoError(63);o.node_ops.setattr(o,{mode:e&4095|o.mode&-4096,timestamp:Date.now()})},lchmod(r,e){n.chmod(r,e,!0)},fchmod(r,e){var t=n.getStreamChecked(r);n.chmod(t.node,e)},chown(r,e,t,o){var i;if(typeof r=="string"){var a=n.lookupPath(r,{follow:!o});i=a.node}else i=r;if(!i.node_ops.setattr)throw new n.ErrnoError(63);i.node_ops.setattr(i,{timestamp:Date.now()})},lchown(r,e,t){n.chown(r,e,t,!0)},fchown(r,e,t){var o=n.getStreamChecked(r);n.chown(o.node,e,t)},truncate(r,e){if(e<0)throw new n.ErrnoError(28);var t;if(typeof r=="string"){var o=n.lookupPath(r,{follow:!0});t=o.node}else t=r;if(!t.node_ops.setattr)throw new n.ErrnoError(63);if(n.isDir(t.mode))throw new n.ErrnoError(31);if(!n.isFile(t.mode))throw new n.ErrnoError(28);var i=n.nodePermissions(t,"w");if(i)throw new n.ErrnoError(i);t.node_ops.setattr(t,{size:e,timestamp:Date.now()})},ftruncate(r,e){var t=n.getStreamChecked(r);if(!(t.flags&2097155))throw new n.ErrnoError(28);n.truncate(t.node,e)},utime(r,e,t){var o=n.lookupPath(r,{follow:!0}),i=o.node;i.node_ops.setattr(i,{timestamp:Math.max(e,t)})},open(r,e,t){if(r==="")throw new n.ErrnoError(44);e=typeof e=="string"?Et(e):e,t=typeof t>"u"?438:t,e&64?t=t&4095|32768:t=0;var o;if(typeof r=="object")o=r;else{r=A.normalize(r);try{var i=n.lookupPath(r,{follow:!(e&131072)});o=i.node}catch{}}var a=!1;if(e&64)if(o){if(e&128)throw new n.ErrnoError(20)}else o=n.mknod(r,t,0),a=!0;if(!o)throw new n.ErrnoError(44);if(n.isChrdev(o.mode)&&(e&=-513),e&65536&&!n.isDir(o.mode))throw new n.ErrnoError(54);if(!a){var s=n.mayOpen(o,e);if(s)throw new n.ErrnoError(s)}e&512&&!a&&n.truncate(o,0),e&=-131713;var u=n.createStream({node:o,path:n.getPath(o),flags:e,seekable:!0,position:0,stream_ops:o.stream_ops,ungotten:[],error:!1});return u.stream_ops.open&&u.stream_ops.open(u),l.logReadFiles&&!(e&1)&&(n.readFiles||(n.readFiles={}),r in n.readFiles||(n.readFiles[r]=1)),u},close(r){if(n.isClosed(r))throw new n.ErrnoError(8);r.getdents&&(r.getdents=null);try{r.stream_ops.close&&r.stream_ops.close(r)}catch(e){throw e}finally{n.closeStream(r.fd)}r.fd=null},isClosed(r){return r.fd===null},llseek(r,e,t){if(n.isClosed(r))throw new n.ErrnoError(8);if(!r.seekable||!r.stream_ops.llseek)throw new n.ErrnoError(70);if(t!=0&&t!=1&&t!=2)throw new n.ErrnoError(28);return r.position=r.stream_ops.llseek(r,e,t),r.ungotten=[],r.position},read(r,e,t,o,i){if(o<0||i<0)throw new n.ErrnoError(28);if(n.isClosed(r))throw new n.ErrnoError(8);if((r.flags&2097155)===1)throw new n.ErrnoError(8);if(n.isDir(r.node.mode))throw new n.ErrnoError(31);if(!r.stream_ops.read)throw new n.ErrnoError(28);var a=typeof i<"u";if(!a)i=r.position;else if(!r.seekable)throw new n.ErrnoError(70);var s=r.stream_ops.read(r,e,t,o,i);return a||(r.position+=s),s},write(r,e,t,o,i,a){if(o<0||i<0)throw new n.ErrnoError(28);if(n.isClosed(r))throw new n.ErrnoError(8);if(!(r.flags&2097155))throw new n.ErrnoError(8);if(n.isDir(r.node.mode))throw new n.ErrnoError(31);if(!r.stream_ops.write)throw new n.ErrnoError(28);r.seekable&&r.flags&1024&&n.llseek(r,0,2);var s=typeof i<"u";if(!s)i=r.position;else if(!r.seekable)throw new n.ErrnoError(70);var u=r.stream_ops.write(r,e,t,o,i,a);return s||(r.position+=u),u},allocate(r,e,t){if(n.isClosed(r))throw new n.ErrnoError(8);if(e<0||t<=0)throw new n.ErrnoError(28);if(!(r.flags&2097155))throw new n.ErrnoError(8);if(!n.isFile(r.node.mode)&&!n.isDir(r.node.mode))throw new n.ErrnoError(43);if(!r.stream_ops.allocate)throw new n.ErrnoError(138);r.stream_ops.allocate(r,e,t)},mmap(r,e,t,o,i){if(o&2&&!(i&2)&&(r.flags&2097155)!==2)throw new n.ErrnoError(2);if((r.flags&2097155)===1)throw new n.ErrnoError(2);if(!r.stream_ops.mmap)throw new n.ErrnoError(43);return r.stream_ops.mmap(r,e,t,o,i)},msync(r,e,t,o,i){return r.stream_ops.msync?r.stream_ops.msync(r,e,t,o,i):0},ioctl(r,e,t){if(!r.stream_ops.ioctl)throw new n.ErrnoError(59);return r.stream_ops.ioctl(r,e,t)},readFile(r,e={}){if(e.flags=e.flags||0,e.encoding=e.encoding||"binary",e.encoding!=="utf8"&&e.encoding!=="binary")throw new Error(`Invalid encoding type "${e.encoding}"`);var t,o=n.open(r,e.flags),i=n.stat(r),a=i.size,s=new Uint8Array(a);return n.read(o,s,0,a,0),e.encoding==="utf8"?t=Er(s,0):e.encoding==="binary"&&(t=s),n.close(o),t},writeFile(r,e,t={}){t.flags=t.flags||577;var o=n.open(r,t.flags,t.mode);if(typeof e=="string"){var i=new Uint8Array(Br(e)+1),a=re(e,i,0,i.length);n.write(o,i,0,a,void 0,t.canOwn)}else if(ArrayBuffer.isView(e))n.write(o,e,0,e.byteLength,void 0,t.canOwn);else throw new Error("Unsupported data type");n.close(o)},cwd:()=>n.currentPath,chdir(r){var e=n.lookupPath(r,{follow:!0});if(e.node===null)throw new n.ErrnoError(44);if(!n.isDir(e.node.mode))throw new n.ErrnoError(54);var t=n.nodePermissions(e.node,"x");if(t)throw new n.ErrnoError(t);n.currentPath=e.path},createDefaultDirectories(){n.mkdir("/tmp"),n.mkdir("/home"),n.mkdir("/home/web_user")},createDefaultDevices(){n.mkdir("/dev"),n.registerDevice(n.makedev(1,3),{read:()=>0,write:(o,i,a,s,u)=>s}),n.mkdev("/dev/null",n.makedev(1,3)),cr.register(n.makedev(5,0),cr.default_tty_ops),cr.register(n.makedev(6,0),cr.default_tty1_ops),n.mkdev("/dev/tty",n.makedev(5,0)),n.mkdev("/dev/tty1",n.makedev(6,0));var r=new Uint8Array(1024),e=0,t=()=>(e===0&&(e=ye(r).byteLength),r[--e]);n.createDevice("/dev","random",t),n.createDevice("/dev","urandom",t),n.mkdir("/dev/shm"),n.mkdir("/dev/shm/tmp")},createSpecialDirectories(){n.mkdir("/proc");var r=n.mkdir("/proc/self");n.mkdir("/proc/self/fd"),n.mount({mount(){var e=n.createNode(r,"fd",16895,73);return e.node_ops={lookup(t,o){var i=+o,a=n.getStreamChecked(i),s={parent:null,mount:{mountpoint:"fake"},node_ops:{readlink:()=>a.path}};return s.parent=s,s}},e}},{},"/proc/self/fd")},createStandardStreams(){l.stdin?n.createDevice("/dev","stdin",l.stdin):n.symlink("/dev/tty","/dev/stdin"),l.stdout?n.createDevice("/dev","stdout",null,l.stdout):n.symlink("/dev/tty","/dev/stdout"),l.stderr?n.createDevice("/dev","stderr",null,l.stderr):n.symlink("/dev/tty1","/dev/stderr");var r=n.open("/dev/stdin",0),e=n.open("/dev/stdout",1),t=n.open("/dev/stderr",1)},staticInit(){[44].forEach(r=>{n.genericErrors[r]=new n.ErrnoError(r),n.genericErrors[r].stack="<generic error, no stack>"}),n.nameTable=new Array(4096),n.mount(w,{},"/"),n.createDefaultDirectories(),n.createDefaultDevices(),n.createSpecialDirectories(),n.filesystems={MEMFS:w}},init(r,e,t){n.init.initialized=!0,l.stdin=r||l.stdin,l.stdout=e||l.stdout,l.stderr=t||l.stderr,n.createStandardStreams()},quit(){n.init.initialized=!1;for(var r=0;r<n.streams.length;r++){var e=n.streams[r];e&&n.close(e)}},findObject(r,e){var t=n.analyzePath(r,e);return t.exists?t.object:null},analyzePath(r,e){try{var t=n.lookupPath(r,{follow:!e});r=t.path}catch{}var o={isRoot:!1,exists:!1,error:0,name:null,path:null,object:null,parentExists:!1,parentPath:null,parentObject:null};try{var t=n.lookupPath(r,{parent:!0});o.parentExists=!0,o.parentPath=t.path,o.parentObject=t.node,o.name=A.basename(r),t=n.lookupPath(r,{follow:!e}),o.exists=!0,o.path=t.path,o.object=t.node,o.name=t.node.name,o.isRoot=t.path==="/"}catch(i){o.error=i.errno}return o},createPath(r,e,t,o){r=typeof r=="string"?r:n.getPath(r);for(var i=e.split("/").reverse();i.length;){var a=i.pop();if(a){var s=A.join2(r,a);try{n.mkdir(s)}catch{}r=s}}return s},createFile(r,e,t,o,i){var a=A.join2(typeof r=="string"?r:n.getPath(r),e),s=ee(o,i);return n.create(a,s)},createDataFile(r,e,t,o,i,a){var s=e;r&&(r=typeof r=="string"?r:n.getPath(r),s=e?A.join2(r,e):r);var u=ee(o,i),c=n.create(s,u);if(t){if(typeof t=="string"){for(var h=new Array(t.length),b=0,P=t.length;b<P;++b)h[b]=t.charCodeAt(b);t=h}n.chmod(c,u|146);var m=n.open(c,577);n.write(m,t,0,t.length,0,a),n.close(m),n.chmod(c,u)}},createDevice(r,e,t,o){var i=A.join2(typeof r=="string"?r:n.getPath(r),e),a=ee(!!t,!!o);n.createDevice.major||(n.createDevice.major=64);var s=n.makedev(n.createDevice.major++,0);return n.registerDevice(s,{open(u){u.seekable=!1},close(u){o?.buffer?.length&&o(10)},read(u,c,h,b,P){for(var m=0,v=0;v<b;v++){var k;try{k=t()}catch{throw new n.ErrnoError(29)}if(k===void 0&&m===0)throw new n.ErrnoError(6);if(k==null)break;m++,c[h+v]=k}return m&&(u.node.timestamp=Date.now()),m},write(u,c,h,b,P){for(var m=0;m<b;m++)try{o(c[h+m])}catch{throw new n.ErrnoError(29)}return b&&(u.node.timestamp=Date.now()),m}}),n.mkdev(i,a,s)},forceLoadFile(r){if(r.isDevice||r.isFolder||r.link||r.contents)return!0;if(typeof XMLHttpRequest<"u")throw new Error("Lazy loading should have been performed (contents set) in createLazyFile, but it was not. Lazy loading only works in web workers. Use --embed-file or --preload-file in emcc on the main thread.");if(X)try{r.contents=jr(X(r.url),!0),r.usedBytes=r.contents.length}catch{throw new n.ErrnoError(29)}else throw new Error("Cannot load without read() or XMLHttpRequest.")},createLazyFile(r,e,t,o,i){class a{constructor(){this.lengthKnown=!1,this.chunks=[]}get(v){if(!(v>this.length-1||v<0)){var k=v%this.chunkSize,j=v/this.chunkSize|0;return this.getter(j)[k]}}setDataGetter(v){this.getter=v}cacheLength(){var v=new XMLHttpRequest;if(v.open("HEAD",t,!1),v.send(null),!(v.status>=200&&v.status<300||v.status===304))throw new Error("Couldn't load "+t+". Status: "+v.status);var k=Number(v.getResponseHeader("Content-length")),j,rr=(j=v.getResponseHeader("Accept-Ranges"))&&j==="bytes",Y=(j=v.getResponseHeader("Content-Encoding"))&&j==="gzip",f=1024*1024;rr||(f=k);var d=(I,tr)=>{if(I>tr)throw new Error("invalid range ("+I+", "+tr+") or no bytes requested!");if(tr>k-1)throw new Error("only "+k+" bytes available! programmer error!");var L=new XMLHttpRequest;if(L.open("GET",t,!1),k!==f&&L.setRequestHeader("Range","bytes="+I+"-"+tr),L.responseType="arraybuffer",L.overrideMimeType&&L.overrideMimeType("text/plain; charset=x-user-defined"),L.send(null),!(L.status>=200&&L.status<300||L.status===304))throw new Error("Couldn't load "+t+". Status: "+L.status);return L.response!==void 0?new Uint8Array(L.response||[]):jr(L.responseText||"",!0)},x=this;x.setDataGetter(I=>{var tr=I*f,L=(I+1)*f-1;if(L=Math.min(L,k-1),typeof x.chunks[I]>"u"&&(x.chunks[I]=d(tr,L)),typeof x.chunks[I]>"u")throw new Error("doXHR failed!");return x.chunks[I]}),(Y||!k)&&(f=k=1,k=this.getter(0).length,f=k,Mr("LazyFiles on gzip forces download of the whole file when length is accessed")),this._length=k,this._chunkSize=f,this.lengthKnown=!0}get length(){return this.lengthKnown||this.cacheLength(),this._length}get chunkSize(){return this.lengthKnown||this.cacheLength(),this._chunkSize}}if(typeof XMLHttpRequest<"u"){if(!mr)throw"Cannot do synchronous binary XHRs outside webworkers in modern browsers. Use --embed-file or --preload-file in emcc";var s=new a,u={isDevice:!1,contents:s}}else var u={isDevice:!1,url:t};var c=n.createFile(r,e,u,o,i);u.contents?c.contents=u.contents:u.url&&(c.contents=null,c.url=u.url),Object.defineProperties(c,{usedBytes:{get:function(){return this.contents.length}}});var h={},b=Object.keys(c.stream_ops);b.forEach(m=>{var v=c.stream_ops[m];h[m]=(...k)=>(n.forceLoadFile(c),v(...k))});function P(m,v,k,j,rr){var Y=m.node.contents;if(rr>=Y.length)return 0;var f=Math.min(Y.length-rr,j);if(Y.slice)for(var d=0;d<f;d++)v[k+d]=Y[rr+d];else for(var d=0;d<f;d++)v[k+d]=Y.get(rr+d);return f}return h.read=(m,v,k,j,rr)=>(n.forceLoadFile(c),P(m,v,k,j,rr)),h.mmap=(m,v,k,j,rr)=>{n.forceLoadFile(c);var Y=ge(v);if(!Y)throw new n.ErrnoError(48);return P(m,C,Y,v,k),{ptr:Y,allocated:!0}},c.stream_ops=h,c}},te=(r,e)=>r?Er(B,r,e):"",E={DEFAULT_POLLMASK:5,calculateAt(r,e,t){if(A.isAbs(e))return e;var o;if(r===-100)o=n.cwd();else{var i=E.getStreamFromFD(r);o=i.path}if(e.length==0){if(!t)throw new n.ErrnoError(44);return o}return A.join2(o,e)},doStat(r,e,t){var o=r(e);y[t>>2]=o.dev,y[t+4>>2]=o.mode,T[t+8>>2]=o.nlink,y[t+12>>2]=o.uid,y[t+16>>2]=o.gid,y[t+20>>2]=o.rdev,O=[o.size>>>0,(S=o.size,+Math.abs(S)>=1?S>0?+Math.floor(S/4294967296)>>>0:~~+Math.ceil((S-+(~~S>>>0))/4294967296)>>>0:0)],y[t+24>>2]=O[0],y[t+28>>2]=O[1],y[t+32>>2]=4096,y[t+36>>2]=o.blocks;var i=o.atime.getTime(),a=o.mtime.getTime(),s=o.ctime.getTime();return O=[Math.floor(i/1e3)>>>0,(S=Math.floor(i/1e3),+Math.abs(S)>=1?S>0?+Math.floor(S/4294967296)>>>0:~~+Math.ceil((S-+(~~S>>>0))/4294967296)>>>0:0)],y[t+40>>2]=O[0],y[t+44>>2]=O[1],T[t+48>>2]=i%1e3*1e3,O=[Math.floor(a/1e3)>>>0,(S=Math.floor(a/1e3),+Math.abs(S)>=1?S>0?+Math.floor(S/4294967296)>>>0:~~+Math.ceil((S-+(~~S>>>0))/4294967296)>>>0:0)],y[t+56>>2]=O[0],y[t+60>>2]=O[1],T[t+64>>2]=a%1e3*1e3,O=[Math.floor(s/1e3)>>>0,(S=Math.floor(s/1e3),+Math.abs(S)>=1?S>0?+Math.floor(S/4294967296)>>>0:~~+Math.ceil((S-+(~~S>>>0))/4294967296)>>>0:0)],y[t+72>>2]=O[0],y[t+76>>2]=O[1],T[t+80>>2]=s%1e3*1e3,O=[o.ino>>>0,(S=o.ino,+Math.abs(S)>=1?S>0?+Math.floor(S/4294967296)>>>0:~~+Math.ceil((S-+(~~S>>>0))/4294967296)>>>0:0)],y[t+88>>2]=O[0],y[t+92>>2]=O[1],0},doMsync(r,e,t,o,i){if(!n.isFile(e.node.mode))throw new n.ErrnoError(43);if(o&2)return 0;var a=B.slice(r,r+t);n.msync(e,a,i,t,o)},varargs:void 0,get(){var r=y[+E.varargs>>2];return E.varargs+=4,r},getp(){return E.get()},getStr(r){var e=te(r);return e},getStreamFromFD(r){var e=n.getStreamChecked(r);return e}};function St(r){try{return r=E.getStr(r),n.chdir(r),0}catch(e){if(typeof n>"u"||e.name!=="ErrnoError")throw e;return-e.errno}}function kt(r,e,t,o){try{if(e=E.getStr(e),e=E.calculateAt(r,e),t&-8)return-28;var i=n.lookupPath(e,{follow:!0}),a=i.node;if(!a)return-44;var s="";return t&4&&(s+="r"),t&2&&(s+="w"),t&1&&(s+="x"),s&&n.nodePermissions(a,s)?-2:0}catch(u){if(typeof n>"u"||u.name!=="ErrnoError")throw u;return-u.errno}}function bt(r,e,t){E.varargs=t;try{var o=E.getStreamFromFD(r);switch(e){case 0:{var i=E.get();if(i<0)return-28;for(;n.streams[i];)i++;var a;return a=n.dupStream(o,i),a.fd}case 1:case 2:return 0;case 3:return o.flags;case 4:{var i=E.get();return o.flags|=i,0}case 12:{var i=E.getp(),s=0;return Lr[i+s>>1]=2,0}case 13:case 14:return 0}return-28}catch(u){if(typeof n>"u"||u.name!=="ErrnoError")throw u;return-u.errno}}function Ft(r,e){try{var t=E.getStreamFromFD(r);return E.doStat(n.stat,t.path,e)}catch(o){if(typeof n>"u"||o.name!=="ErrnoError")throw o;return-o.errno}}var Ee=(r,e,t)=>re(r,B,e,t);function Pt(r,e){try{if(e===0)return-28;var t=n.cwd(),o=Br(t)+1;return e<o?-68:(Ee(t,r,e),o)}catch(i){if(typeof n>"u"||i.name!=="ErrnoError")throw i;return-i.errno}}function Mt(r,e,t){E.varargs=t;try{var o=E.getStreamFromFD(r);switch(e){case 21509:return o.tty?0:-59;case 21505:{if(!o.tty)return-59;if(o.tty.ops.ioctl_tcgets){var i=o.tty.ops.ioctl_tcgets(o),a=E.getp();y[a>>2]=i.c_iflag||0,y[a+4>>2]=i.c_oflag||0,y[a+8>>2]=i.c_cflag||0,y[a+12>>2]=i.c_lflag||0;for(var s=0;s<32;s++)C[a+s+17]=i.c_cc[s]||0;return 0}return 0}case 21510:case 21511:case 21512:return o.tty?0:-59;case 21506:case 21507:case 21508:{if(!o.tty)return-59;if(o.tty.ops.ioctl_tcsets){for(var a=E.getp(),u=y[a>>2],c=y[a+4>>2],h=y[a+8>>2],b=y[a+12>>2],P=[],s=0;s<32;s++)P.push(C[a+s+17]);return o.tty.ops.ioctl_tcsets(o.tty,e,{c_iflag:u,c_oflag:c,c_cflag:h,c_lflag:b,c_cc:P})}return 0}case 21519:{if(!o.tty)return-59;var a=E.getp();return y[a>>2]=0,0}case 21520:return o.tty?-28:-59;case 21531:{var a=E.getp();return n.ioctl(o,e,a)}case 21523:{if(!o.tty)return-59;if(o.tty.ops.ioctl_tiocgwinsz){var m=o.tty.ops.ioctl_tiocgwinsz(o.tty),a=E.getp();Lr[a>>1]=m[0],Lr[a+2>>1]=m[1]}return 0}case 21524:return o.tty?0:-59;case 21515:return o.tty?0:-59;default:return-28}}catch(v){if(typeof n>"u"||v.name!=="ErrnoError")throw v;return-v.errno}}function Dt(r,e,t,o){try{e=E.getStr(e);var i=o&256,a=o&4096;return o=o&-6401,e=E.calculateAt(r,e,a),E.doStat(i?n.lstat:n.stat,e,t)}catch(s){if(typeof n>"u"||s.name!=="ErrnoError")throw s;return-s.errno}}function Rt(r,e,t,o){E.varargs=o;try{e=E.getStr(e),e=E.calculateAt(r,e);var i=o?E.get():0;return n.open(e,t,i).fd}catch(a){if(typeof n>"u"||a.name!=="ErrnoError")throw a;return-a.errno}}function At(r,e){try{return r=E.getStr(r),E.doStat(n.stat,r,e)}catch(t){if(typeof n>"u"||t.name!=="ErrnoError")throw t;return-t.errno}}var Tt=1,It=()=>Tt,Nt=()=>{he=!1,be=0},Ct=()=>{throw 1/0},ne=(r,e)=>e+2097152>>>0<4194305-!!r?(r>>>0)+e*4294967296:NaN;function zt(r,e,t,o,i,a,s,u){var c=ne(i,a);try{if(isNaN(c))return 61;var h=E.getStreamFromFD(o),b=n.mmap(h,r,c,e,t),P=b.ptr;return y[s>>2]=b.allocated,T[u>>2]=P,0}catch(m){if(typeof n>"u"||m.name!=="ErrnoError")throw m;return-m.errno}}function Lt(r,e,t,o,i,a,s){var u=ne(a,s);try{var c=E.getStreamFromFD(i);t&2&&E.doMsync(r,c,e,o,u)}catch(h){if(typeof n>"u"||h.name!=="ErrnoError")throw h;return-h.errno}}var Ot=()=>{Qr("")},xt=()=>Date.now(),Se=()=>2147483648,Ut=()=>Se(),ke;ke=()=>performance.now();var Bt=(r,e,t)=>B.copyWithin(r,e,e+t),jt=r=>{var e=pr.buffer,t=(r-e.byteLength+65535)/65536;try{return pr.grow(t),se(),1}catch{}},Ht=r=>{var e=B.length;r>>>=0;var t=Se();if(r>t)return!1;for(var o=(c,h)=>c+(h-c%h)%h,i=1;i<=4;i*=2){var a=e*(1+.2/i);a=Math.min(a,r+100663296);var s=Math.min(t,o(Math.max(r,a),65536)),u=jt(s);if(u)return!0}return!1},oe={},Wt=()=>er||"./this.program",Tr=()=>{if(!Tr.strings){var r=(typeof navigator=="object"&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",e={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:r,_:Wt()};for(var t in oe)oe[t]===void 0?delete e[t]:e[t]=oe[t];var o=[];for(var t in e)o.push(`${t}=${e[t]}`);Tr.strings=o}return Tr.strings},Yt=(r,e)=>{for(var t=0;t<r.length;++t)C[e++]=r.charCodeAt(t);C[e]=0},$t=(r,e)=>{var t=0;return Tr().forEach((o,i)=>{var a=e+t;T[r+i*4>>2]=a,Yt(o,a),t+=o.length+1}),0},qt=(r,e)=>{var t=Tr();T[r>>2]=t.length;var o=0;return t.forEach(i=>o+=i.length+1),T[e>>2]=o,0},be=0,Xt=()=>he||be>0,Fe=r=>{wr=r,Xt()||(l.onExit?.(r),Dr=!0),q(r,new me(r))},Pe=(r,e)=>{wr=r,Fe(r)},Vt=Pe;function Gt(r){try{var e=E.getStreamFromFD(r);return n.close(e),0}catch(t){if(typeof n>"u"||t.name!=="ErrnoError")throw t;return t.errno}}var Kt=(r,e,t,o)=>{for(var i=0,a=0;a<t;a++){var s=T[e>>2],u=T[e+4>>2];e+=8;var c=n.read(r,C,s,u,o);if(c<0)return-1;if(i+=c,c<u)break;typeof o<"u"&&(o+=c)}return i};function Jt(r,e,t,o){try{var i=E.getStreamFromFD(r),a=Kt(i,e,t);return T[o>>2]=a,0}catch(s){if(typeof n>"u"||s.name!=="ErrnoError")throw s;return s.errno}}function Qt(r,e,t,o,i){var a=ne(e,t);try{if(isNaN(a))return 61;var s=E.getStreamFromFD(r);return n.llseek(s,a,o),O=[s.position>>>0,(S=s.position,+Math.abs(S)>=1?S>0?+Math.floor(S/4294967296)>>>0:~~+Math.ceil((S-+(~~S>>>0))/4294967296)>>>0:0)],y[i>>2]=O[0],y[i+4>>2]=O[1],s.getdents&&a===0&&o===0&&(s.getdents=null),0}catch(u){if(typeof n>"u"||u.name!=="ErrnoError")throw u;return u.errno}}var Zt=(r,e,t,o)=>{for(var i=0,a=0;a<t;a++){var s=T[e>>2],u=T[e+4>>2];e+=8;var c=n.write(r,C,s,u,o);if(c<0)return-1;i+=c,typeof o<"u"&&(o+=c)}return i};function rn(r,e,t,o){try{var i=E.getStreamFromFD(r),a=Zt(i,e,t);return T[o>>2]=a,0}catch(s){if(typeof n>"u"||s.name!=="ErrnoError")throw s;return s.errno}}var Hr=r=>r%4===0&&(r%100!==0||r%400===0),en=(r,e)=>{for(var t=0,o=0;o<=e;t+=r[o++]);return t},Me=[31,29,31,30,31,30,31,31,30,31,30,31],De=[31,28,31,30,31,30,31,31,30,31,30,31],tn=(r,e)=>{for(var t=new Date(r.getTime());e>0;){var o=Hr(t.getFullYear()),i=t.getMonth(),a=(o?Me:De)[i];if(e>a-t.getDate())e-=a-t.getDate()+1,t.setDate(1),i<11?t.setMonth(i+1):(t.setMonth(0),t.setFullYear(t.getFullYear()+1));else return t.setDate(t.getDate()+e),t}return t},nn=(r,e)=>{C.set(r,e)},on=(r,e,t,o)=>{var i=T[o+40>>2],a={tm_sec:y[o>>2],tm_min:y[o+4>>2],tm_hour:y[o+8>>2],tm_mday:y[o+12>>2],tm_mon:y[o+16>>2],tm_year:y[o+20>>2],tm_wday:y[o+24>>2],tm_yday:y[o+28>>2],tm_isdst:y[o+32>>2],tm_gmtoff:y[o+36>>2],tm_zone:i?te(i):""},s=te(t),u={"%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"};for(var c in u)s=s.replace(new RegExp(c,"g"),u[c]);var h=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],b=["January","February","March","April","May","June","July","August","September","October","November","December"];function P(f,d,x){for(var I=typeof f=="number"?f.toString():f||"";I.length<d;)I=x[0]+I;return I}function m(f,d){return P(f,d,"0")}function v(f,d){function x(tr){return tr<0?-1:tr>0?1:0}var I;return(I=x(f.getFullYear()-d.getFullYear()))===0&&(I=x(f.getMonth()-d.getMonth()))===0&&(I=x(f.getDate()-d.getDate())),I}function k(f){switch(f.getDay()){case 0:return new Date(f.getFullYear()-1,11,29);case 1:return f;case 2:return new Date(f.getFullYear(),0,3);case 3:return new Date(f.getFullYear(),0,2);case 4:return new Date(f.getFullYear(),0,1);case 5:return new Date(f.getFullYear()-1,11,31);case 6:return new Date(f.getFullYear()-1,11,30)}}function j(f){var d=tn(new Date(f.tm_year+1900,0,1),f.tm_yday),x=new Date(d.getFullYear(),0,4),I=new Date(d.getFullYear()+1,0,4),tr=k(x),L=k(I);return v(tr,d)<=0?v(L,d)<=0?d.getFullYear()+1:d.getFullYear():d.getFullYear()-1}var rr={"%a":f=>h[f.tm_wday].substring(0,3),"%A":f=>h[f.tm_wday],"%b":f=>b[f.tm_mon].substring(0,3),"%B":f=>b[f.tm_mon],"%C":f=>{var d=f.tm_year+1900;return m(d/100|0,2)},"%d":f=>m(f.tm_mday,2),"%e":f=>P(f.tm_mday,2," "),"%g":f=>j(f).toString().substring(2),"%G":j,"%H":f=>m(f.tm_hour,2),"%I":f=>{var d=f.tm_hour;return d==0?d=12:d>12&&(d-=12),m(d,2)},"%j":f=>m(f.tm_mday+en(Hr(f.tm_year+1900)?Me:De,f.tm_mon-1),3),"%m":f=>m(f.tm_mon+1,2),"%M":f=>m(f.tm_min,2),"%n":()=>`
4
+ `,"%p":f=>f.tm_hour>=0&&f.tm_hour<12?"AM":"PM","%S":f=>m(f.tm_sec,2),"%t":()=>" ","%u":f=>f.tm_wday||7,"%U":f=>{var d=f.tm_yday+7-f.tm_wday;return m(Math.floor(d/7),2)},"%V":f=>{var d=Math.floor((f.tm_yday+7-(f.tm_wday+6)%7)/7);if((f.tm_wday+371-f.tm_yday-2)%7<=2&&d++,d){if(d==53){var I=(f.tm_wday+371-f.tm_yday)%7;I!=4&&(I!=3||!Hr(f.tm_year))&&(d=1)}}else{d=52;var x=(f.tm_wday+7-f.tm_yday-1)%7;(x==4||x==5&&Hr(f.tm_year%400-1))&&d++}return m(d,2)},"%w":f=>f.tm_wday,"%W":f=>{var d=f.tm_yday+7-(f.tm_wday+6)%7;return m(Math.floor(d/7),2)},"%y":f=>(f.tm_year+1900).toString().substring(2),"%Y":f=>f.tm_year+1900,"%z":f=>{var d=f.tm_gmtoff,x=d>=0;return d=Math.abs(d)/60,d=d/60*100+d%60,(x?"+":"-")+("0000"+d).slice(-4)},"%Z":f=>f.tm_zone,"%%":()=>"%"};s=s.replace(/%%/g,"\0\0");for(var c in rr)s.includes(c)&&(s=s.replace(new RegExp(c,"g"),rr[c](a)));s=s.replace(/\0\0/g,"%");var Y=jr(s,!1);return Y.length>e?0:(nn(Y,r),Y.length-1)},an=(r,e,t,o,i)=>on(r,e,t,o),sn=r=>{if(r instanceof me||r=="unwind")return wr;q(1,r)},un=r=>{var e=Br(r)+1,t=ie(e);return Ee(r,t,e),t};n.createPreloadedFile=gt,n.staticInit(),l.FS_createPath=n.createPath,l.FS_createDataFile=n.createDataFile,l.FS_createPreloadedFile=n.createPreloadedFile,l.FS_unlink=n.unlink,l.FS_createLazyFile=n.createLazyFile,l.FS_createDevice=n.createDevice;var ln={y:ut,a:ct,L:St,M:kt,q:bt,G:Ft,D:Pt,N:Mt,E:Dt,n:Rt,F:At,I:It,A:Nt,v:Ct,r:zt,s:Lt,b:Ot,J:xt,x:Ut,H:ke,K:Bt,w:Ht,B:$t,C:qt,j:Vt,l:Gt,p:Jt,t:Qt,o:rn,h:pn,k:vn,d:cn,e:dn,m:wn,c:mn,f:hn,i:_n,g:yn,z:Fe,u:an},J=st(),fn=()=>(fn=J.P)(),Re=l._main=(r,e)=>(Re=l._main=J.Q)(r,e),Ae=(r,e)=>(Ae=J.S)(r,e),or=(r,e)=>(or=J.T)(r,e),ir=()=>(ir=J.U)(),ar=r=>(ar=J.V)(r),ie=r=>(ie=J.W)(r),Te=r=>(Te=J.X)(r);function cn(r,e,t,o){var i=ir();try{return nr(r)(e,t,o)}catch(a){if(ar(i),a!==a+0)throw a;or(1,0)}}function dn(r,e,t,o,i){var a=ir();try{return nr(r)(e,t,o,i)}catch(s){if(ar(a),s!==s+0)throw s;or(1,0)}}function vn(r,e,t){var o=ir();try{return nr(r)(e,t)}catch(i){if(ar(o),i!==i+0)throw i;or(1,0)}}function mn(r){var e=ir();try{nr(r)()}catch(t){if(ar(e),t!==t+0)throw t;or(1,0)}}function hn(r,e){var t=ir();try{nr(r)(e)}catch(o){if(ar(t),o!==o+0)throw o;or(1,0)}}function pn(r){var e=ir();try{return nr(r)()}catch(t){if(ar(e),t!==t+0)throw t;or(1,0)}}function wn(r,e,t,o,i,a){var s=ir();try{return nr(r)(e,t,o,i,a)}catch(u){if(ar(s),u!==u+0)throw u;or(1,0)}}function yn(r,e,t,o){var i=ir();try{nr(r)(e,t,o)}catch(a){if(ar(i),a!==a+0)throw a;or(1,0)}}function _n(r,e,t){var o=ir();try{nr(r)(e,t)}catch(i){if(ar(o),i!==i+0)throw i;or(1,0)}}l.addRunDependency=Or,l.removeRunDependency=Ar,l.FS_createPath=n.createPath,l.FS_createLazyFile=n.createLazyFile,l.FS_createDevice=n.createDevice,l.callMain=Ie,l.FS_createPreloadedFile=n.createPreloadedFile,l.FS=n,l.FS_createDataFile=n.createDataFile,l.FS_unlink=n.unlink;var Wr;Rr=function r(){Wr||Ne(),Wr||(Rr=r)};function Ie(r=[]){var e=Re;r.unshift(er);var t=r.length,o=ie((t+1)*4),i=o;r.forEach(s=>{T[i>>2]=un(s),i+=4}),T[i>>2]=0;try{var a=e(t,o);return Pe(a,!0),a}catch(s){return sn(s)}}function Ne(r=lr){if(yr>0||(Je(),yr>0))return;function e(){Wr||(Wr=!0,l.calledRun=!0,!Dr&&(Qe(),Ze(),H(l),l.onRuntimeInitialized&&l.onRuntimeInitialized(),Ce&&Ie(r),rt()))}l.setStatus?(l.setStatus("Running..."),setTimeout(function(){setTimeout(function(){l.setStatus("")},1),e()},1)):e()}if(l.preInit)for(typeof l.preInit=="function"&&(l.preInit=[l.preInit]);l.preInit.length>0;)l.preInit.pop()();var Ce=!1;return l.noInitialRun&&(Ce=!1),Ne(),F.ready}})(),D=null,R=!1,z=null,sr=null,V=null,Q=new Promise(function(p,F){sr=p,V=F}),G={OPTIMAL:"optimal",INFEASIBLE:"infeasible",UNBOUNDED:"unbounded",TIME_LIMIT:"timelimit",UNKNOWN:"unknown",ERROR:"error"};function qr(p){return p.includes("optimal solution found")?G.OPTIMAL:p.includes("problem is infeasible")?G.INFEASIBLE:p.includes("problem is unbounded")?G.UNBOUNDED:p.includes("time limit reached")?G.TIME_LIMIT:G.UNKNOWN}function Xr(p,F){var l={},H={value:null},g=F||p,U=g.match(/objective value:\s*([\d.e+-]+)/i);U&&(H.value=parseFloat(U[1]));for(var lr=/^([\w$#]+)\s+([\d.e+-]+)/gm,er;(er=lr.exec(g))!==null;){var q=er[1],fr=parseFloat(er[2]);!isNaN(fr)&&q!=="objective"&&q!=="solution"&&(l[q]=fr)}return{variables:l,objective:H}}function Cr(p){var F={solvingTime:null,nodes:null,iterations:null,gap:null},l=p.match(/Solving Time \(sec\)\s*:\s*([\d.]+)/);l&&(F.solvingTime=parseFloat(l[1]));var H=p.match(/Nodes\s*:\s*(\d+)/);H&&(F.nodes=parseInt(H[1]));var g=p.match(/LP Iterations\s*:\s*(\d+)/);g&&(F.iterations=parseInt(g[1]));var U=p.match(/Gap\s*:\s*([\d.]+)\s*%/);return U&&(F.gap=parseFloat(U[1])),F}function vr(p){return p=p||{},R?Promise.resolve():z||(z=new Promise(function(F,l){try{var H=p.wasmPath||M+"scip.wasm";W({locateFile:function(g){return g.endsWith(".wasm")?H:g},print:function(g){D&&D.onStdout&&D.onStdout(g)},printErr:function(g){D&&D.onStderr&&D.onStderr(g)}}).then(function(g){if(D=g,D.FS){try{D.FS.mkdir("/problems")}catch{}try{D.FS.mkdir("/solutions")}catch{}try{D.FS.mkdir("/settings")}catch{}}R=!0,sr&&sr(),F()}).catch(function(g){var U=new Error("SCIP WASM loading failed: "+(g.message||g));V&&V(U),l(U)})}catch(g){V&&V(g),l(g)}}),z)}function $(p,F){F=F||{};var l=function(){var H=F.format||"lp",g=F.timeLimit||3600,U=F.gap||null,lr=F.verbose||!1,er=F.parameters||{},q="",fr="";D.onStdout=function(B){q+=B+`
5
+ `,lr&&console.log("[SCIP]",B)},D.onStderr=function(B){fr+=B+`
6
+ `,lr&&console.error("[SCIP Error]",B)};try{var mr={mps:"mps",zpl:"zpl",cip:"cip",lp:"lp"},ae=mr[H]||"lp",K="/problems/problem."+ae,zr="/solutions/solution.sol";D.FS.writeFile(K,p);var X=[];X.push("set limits time "+g),U!==null&&X.push("set limits gap "+U);for(var gr in er)er.hasOwnProperty(gr)&&X.push("set "+gr+" "+er[gr]);X.push("read "+K),X.push("optimize"),X.push("display solution"),X.push("write solution "+zr),X.push("display statistics"),X.push("quit");var Pr=X.join(`
7
+ `);D.FS.writeFile("/settings/commands.txt",Pr);var Mr=D.callMain(["-b","/settings/commands.txt"]),Z=null;try{Z=D.FS.readFile(zr,{encoding:"utf8"})}catch{}for(var hr=qr(q),pr=Xr(q,Z),Dr=Cr(q),wr=["/problems/problem.lp","/problems/problem.mps","/problems/problem.zpl","/problems/problem.cip","/solutions/solution.sol","/settings/commands.txt"],C=0;C<wr.length;C++)try{D.FS.unlink(wr[C])}catch{}return{status:hr,objective:pr.objective.value,variables:pr.variables,statistics:Dr,exitCode:Mr,output:lr?q:void 0,rawSolution:Z}}catch(B){return{status:G.ERROR,error:B.message,output:q+fr}}};return R?Promise.resolve(l()):vr(F).then(l)}function br(p,F){return p.toLowerCase().includes("minimize")||(p=`Minimize
8
+ `+p),$(p,F)}function Vr(p,F){return p.toLowerCase().includes("maximize")||(p=`Maximize
9
+ `+p),$(p,F)}function Gr(){var p=function(){var F="";return D.onStdout=function(l){F+=l+`
10
+ `},D.callMain(["--version"]),F.trim()};return R?Promise.resolve(p()):vr().then(p)}function Fr(){return R}var Kr={init:vr,ready:Q,isReady:Fr,solve:$,minimize:br,maximize:Vr,version:Gr,Status:G};_.SCIP=Kr,vr().catch(function(p){console.error("[SCIP.js] Auto-initialization failed:",p.message)})})(typeof self<"u"?self:typeof window<"u"?window:globalThis);var N=null,Sr=!1,Ir=null,Yr=null,kr=null,Oe=new Promise(function(_,M){Yr=_,kr=M}),dr={OPTIMAL:"optimal",INFEASIBLE:"infeasible",UNBOUNDED:"unbounded",TIME_LIMIT:"timelimit",UNKNOWN:"unknown",ERROR:"error"};function xe(_){return _.includes("optimal solution found")?dr.OPTIMAL:_.includes("problem is infeasible")?dr.INFEASIBLE:_.includes("problem is unbounded")?dr.UNBOUNDED:_.includes("time limit reached")?dr.TIME_LIMIT:dr.UNKNOWN}function Ue(_,M){var W={},D={value:null},R=M||_,z=R.match(/objective value:\s*([\d.e+-]+)/i);z&&(D.value=parseFloat(z[1]));for(var sr=/^([\w$#]+)\s+([\d.e+-]+)/gm,V;(V=sr.exec(R))!==null;){var Q=V[1],G=parseFloat(V[2]);!isNaN(G)&&Q!=="objective"&&Q!=="solution"&&(W[Q]=G)}return{variables:W,objective:D}}function Be(_){var M={solvingTime:null,nodes:null,iterations:null,gap:null},W=_.match(/Solving Time \(sec\)\s*:\s*([\d.]+)/);W&&(M.solvingTime=parseFloat(W[1]));var D=_.match(/Nodes\s*:\s*(\d+)/);D&&(M.nodes=parseInt(D[1]));var R=_.match(/LP Iterations\s*:\s*(\d+)/);R&&(M.iterations=parseInt(R[1]));var z=_.match(/Gap\s*:\s*([\d.]+)\s*%/);return z&&(M.gap=parseFloat(z[1])),M}function Nr(_){return _=_||{},Sr?Promise.resolve():Ir||(Ir=new Promise(function(M,W){try{var D=_.wasmPath||Le+"scip.wasm";createSCIP({locateFile:function(R){return R.endsWith(".wasm")?D:R},print:function(R){N&&N.onStdout&&N.onStdout(R)},printErr:function(R){N&&N.onStderr&&N.onStderr(R)}}).then(function(R){if(N=R,N.FS){try{N.FS.mkdir("/problems")}catch{}try{N.FS.mkdir("/solutions")}catch{}try{N.FS.mkdir("/settings")}catch{}}Sr=!0,Yr&&Yr(),M()}).catch(function(R){var z=new Error("SCIP WASM loading failed: "+(R.message||R));kr&&kr(z),W(z)})}catch(R){kr&&kr(R),W(R)}}),Ir)}function $r(_,M){M=M||{};var W=function(){var D=M.format||"lp",R=M.timeLimit||3600,z=M.gap||null,sr=M.verbose||!1,V=M.parameters||{},Q="",G="";N.onStdout=function(g){Q+=g+`
11
+ `,sr&&console.log("[SCIP]",g)},N.onStderr=function(g){G+=g+`
12
+ `,sr&&console.error("[SCIP Error]",g)};try{var qr={mps:"mps",zpl:"zpl",cip:"cip",lp:"lp"},Xr=qr[D]||"lp",Cr="/problems/problem."+Xr,vr="/solutions/solution.sol";N.FS.writeFile(Cr,_);var $=[];$.push("set limits time "+R),z!==null&&$.push("set limits gap "+z);for(var br in V)V.hasOwnProperty(br)&&$.push("set "+br+" "+V[br]);$.push("read "+Cr),$.push("optimize"),$.push("display solution"),$.push("write solution "+vr),$.push("display statistics"),$.push("quit");var Vr=$.join(`
13
+ `);N.FS.writeFile("/settings/commands.txt",Vr);var Gr=N.callMain(["-b","/settings/commands.txt"]),Fr=null;try{Fr=N.FS.readFile(vr,{encoding:"utf8"})}catch{}for(var Kr=xe(Q),p=Ue(Q,Fr),F=Be(Q),l=["/problems/problem.lp","/problems/problem.mps","/problems/problem.zpl","/problems/problem.cip","/solutions/solution.sol","/settings/commands.txt"],H=0;H<l.length;H++)try{N.FS.unlink(l[H])}catch{}return{status:Kr,objective:p.objective.value,variables:p.variables,statistics:F,exitCode:Gr,output:sr?Q:void 0,rawSolution:Fr}}catch(g){return{status:dr.ERROR,error:g.message,output:Q+G}}};return Sr?Promise.resolve(W()):Nr(M).then(W)}function je(_,M){return _.toLowerCase().includes("minimize")||(_=`Minimize
14
+ `+_),$r(_,M)}function He(_,M){return _.toLowerCase().includes("maximize")||(_=`Maximize
15
+ `+_),$r(_,M)}function We(){var _=function(){var M="";return N.onStdout=function(W){M+=W+`
16
+ `},N.callMain(["--version"]),M.trim()};return Sr?Promise.resolve(_()):Nr().then(_)}function Ye(){return Sr}var $e={init:Nr,ready:Oe,isReady:Ye,solve:$r,minimize:je,maximize:He,version:We,Status:dr};ze.SCIP=$e,Nr().catch(function(_){console.error("[SCIP.js] Auto-initialization failed:",_.message)})})(typeof self<"u"?self:typeof window<"u"?window:globalThis);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@areb0s/scip.js",
3
- "version": "1.1.3",
3
+ "version": "1.1.5",
4
4
  "description": "SCIP Optimization Solver compiled to WebAssembly - LP, MIP, and MINLP support",
5
5
  "main": "dist/index.mjs",
6
6
  "module": "dist/index.mjs",