@areb0s/scip.js 1.0.9 → 1.1.0

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