@areb0s/scip.js 1.1.10 → 1.1.12

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