@arcgis/core
Version:
ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API
5 lines • 74.8 kB
JavaScript
/*
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/4.32/esri/copyright.txt for details.
*/
import{c as e,g as r}from"./_commonjsHelpers.js";var t,n={exports:{}};function o(){return t||(t=1,r=n,o="undefined"!=typeof document&&document.currentScript?document.currentScript.src:void 0,a=function(r={}){var t,n,a=r;a.ready=new Promise(((e,r)=>{t=e,n=r}));var i,s,u=Object.assign({},a),l="./this.program",d=!0,c="";function f(e){return a.locateFile?a.locateFile(e,c):c+e}"undefined"!=typeof document&&document.currentScript&&(c=document.currentScript.src),o&&(c=o),c=0!==c.indexOf("blob:")?c.substr(0,c.replace(/[?#].*/,"").lastIndexOf("/")+1):"",i=e=>{var r=new XMLHttpRequest;return r.open("GET",e,!1),r.send(null),r.responseText},s=(e,r,t)=>{var n=new XMLHttpRequest;n.open("GET",e,!0),n.responseType="arraybuffer",n.onload=()=>{200==n.status||0==n.status&&n.response?r(n.response):t()},n.onerror=t,n.send(null)};var m,h,p=a.print||console.log.bind(console),v=a.printErr||console.error.bind(console);Object.assign(a,u),u=null,a.arguments&&a.arguments,a.thisProgram&&(l=a.thisProgram),a.quit&&a.quit,a.wasmBinary&&(m=a.wasmBinary),"object"!=typeof WebAssembly&&N("no native wasm support detected");var g,y,w,E,b,_,k,x,F=!1;function A(e,r){e||N(r)}function P(){var e=h.buffer;a.HEAP8=g=new Int8Array(e),a.HEAP16=w=new Int16Array(e),a.HEAPU8=y=new Uint8Array(e),a.HEAPU16=E=new Uint16Array(e),a.HEAP32=b=new Int32Array(e),a.HEAPU32=_=new Uint32Array(e),a.HEAPF32=k=new Float32Array(e),a.HEAPF64=x=new Float64Array(e)}var S=[],C=[],D=[];function T(){if(a.preRun)for("function"==typeof a.preRun&&(a.preRun=[a.preRun]);a.preRun.length;)M(a.preRun.shift());Z(S)}function $(){a.noFSInit||Ae.init.initialized||Ae.init(),Ae.ignorePermissions=!1,Z(C)}function j(){if(a.postRun)for("function"==typeof a.postRun&&(a.postRun=[a.postRun]);a.postRun.length;)L(a.postRun.shift());Z(D)}function M(e){S.unshift(e)}function B(e){C.unshift(e)}function L(e){D.unshift(e)}var R=0,I=null;function H(e){return e}function O(e){R++,a.monitorRunDependencies&&a.monitorRunDependencies(R)}function W(e){if(R--,a.monitorRunDependencies&&a.monitorRunDependencies(R),0==R&&I){var r=I;I=null,r()}}function N(e){a.onAbort&&a.onAbort(e),v(e="Aborted("+e+")"),F=!0,e+=". Build with -sASSERTIONS for more info.";var r=new WebAssembly.RuntimeError(e);throw n(r),r}var z,U,V,G="data:application/octet-stream;base64,",q=e=>e.startsWith(G);function Y(e){if(e==z&&m)return new Uint8Array(m);throw"both async and sync fetching of the wasm failed"}function X(e){return!m&&d&&"function"==typeof fetch?fetch(e,{credentials:"same-origin"}).then((r=>{if(!r.ok)throw"failed to load wasm binary file at '"+e+"'";return r.arrayBuffer()})).catch((()=>Y(e))):Promise.resolve().then((()=>Y(e)))}function Q(e,r,t){return X(e).then((e=>WebAssembly.instantiate(e,r))).then((e=>e)).then(t,(e=>{v(`failed to asynchronously prepare wasm: ${e}`),N(e)}))}function J(e,r,t,n){return e||"function"!=typeof WebAssembly.instantiateStreaming||q(r)||"function"!=typeof fetch?Q(r,t,n):fetch(r,{credentials:"same-origin"}).then((e=>WebAssembly.instantiateStreaming(e,t).then(n,(function(e){return v(`wasm streaming compile failed: ${e}`),v("falling back to ArrayBuffer instantiation"),Q(r,t,n)}))))}function K(){var e={a:Ho};function r(e,r){return Oo=e.exports,h=Oo.eb,P(),wr=Oo.gb,B(Oo.fb),W(),Oo}function t(e){r(e.instance)}if(O(),a.instantiateWasm)try{return a.instantiateWasm(e,r)}catch(o){v(`Module.instantiateWasm callback failed with error: ${o}`),n(o)}return J(m,z,e,t).catch(n),{}}q(z="vxlLayer.wasm")||(z=f(z));var Z=e=>{for(;e.length>0;)e.shift()(a)};a.noExitRuntime;var ee="undefined"!=typeof TextDecoder?new TextDecoder("utf8"):void 0,re=(e,r,t)=>{for(var n=r+t,o=r;e[o]&&!(o>=n);)++o;if(o-r>16&&e.buffer&&ee)return ee.decode(e.subarray(r,o));for(var a="";r<o;){var i=e[r++];if(128&i){var s=63&e[r++];if(192!=(224&i)){var u=63&e[r++];if((i=224==(240&i)?(15&i)<<12|s<<6|u:(7&i)<<18|s<<12|u<<6|63&e[r++])<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},te=(e,r)=>e?re(y,e,r):"",ne=(e,r,t,n)=>{N(`Assertion failed: ${te(e)}, at: `+[r?te(r):"unknown filename",t,n?te(n):"unknown function"])};function oe(e){this.excPtr=e,this.ptr=e-24,this.set_type=function(e){_[this.ptr+4>>2]=e},this.get_type=function(){return _[this.ptr+4>>2]},this.set_destructor=function(e){_[this.ptr+8>>2]=e},this.get_destructor=function(){return _[this.ptr+8>>2]},this.set_caught=function(e){e=e?1:0,g[this.ptr+12|0]=e},this.get_caught=function(){return 0!=g[this.ptr+12|0]},this.set_rethrown=function(e){e=e?1:0,g[this.ptr+13|0]=e},this.get_rethrown=function(){return 0!=g[this.ptr+13|0]},this.init=function(e,r){this.set_adjusted_ptr(0),this.set_type(e),this.set_destructor(r)},this.set_adjusted_ptr=function(e){_[this.ptr+16>>2]=e},this.get_adjusted_ptr=function(){return _[this.ptr+16>>2]},this.get_exception_ptr=function(){if(Go(this.get_type()))return _[this.excPtr>>2];var e=this.get_adjusted_ptr();return 0!==e?e:this.excPtr}}var ae=(e,r,t)=>{throw new oe(e).init(r,t),e},ie=e=>(b[Vo()>>2]=e,e),se={isAbs:e=>"/"===e.charAt(0),splitPath:e=>/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/.exec(e).slice(1),normalizeArray:(e,r)=>{for(var t=0,n=e.length-1;n>=0;n--){var o=e[n];"."===o?e.splice(n,1):".."===o?(e.splice(n,1),t++):t&&(e.splice(n,1),t--)}if(r)for(;t;t--)e.unshift("..");return e},normalize:e=>{var r=se.isAbs(e),t="/"===e.substr(-1);return(e=se.normalizeArray(e.split("/").filter((e=>!!e)),!r).join("/"))||r||(e="."),e&&t&&(e+="/"),(r?"/":"")+e},dirname:e=>{var r=se.splitPath(e),t=r[0],n=r[1];return t||n?(n&&(n=n.substr(0,n.length-1)),t+n):"."},basename:e=>{if("/"===e)return"/";var r=(e=(e=se.normalize(e)).replace(/\/$/,"")).lastIndexOf("/");return-1===r?e:e.substr(r+1)},join:function(){var e=Array.prototype.slice.call(arguments);return se.normalize(e.join("/"))},join2:(e,r)=>se.normalize(e+"/"+r)},ue=()=>{if("object"==typeof crypto&&"function"==typeof crypto.getRandomValues)return e=>crypto.getRandomValues(e);N("initRandomDevice")},le=e=>(le=ue())(e),de={resolve:function(){for(var e="",r=!1,t=arguments.length-1;t>=-1&&!r;t--){var n=t>=0?arguments[t]:Ae.cwd();if("string"!=typeof n)throw new TypeError("Arguments to path.resolve must be strings");if(!n)return"";e=n+"/"+e,r=se.isAbs(n)}return(r?"/":"")+(e=se.normalizeArray(e.split("/").filter((e=>!!e)),!r).join("/"))||"."},relative:(e,r)=>{function t(e){for(var r=0;r<e.length&&""===e[r];r++);for(var t=e.length-1;t>=0&&""===e[t];t--);return r>t?[]:e.slice(r,t-r+1)}e=de.resolve(e).substr(1),r=de.resolve(r).substr(1);for(var n=t(e.split("/")),o=t(r.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("/")}},ce=[],fe=e=>{for(var r=0,t=0;t<e.length;++t){var n=e.charCodeAt(t);n<=127?r++:n<=2047?r+=2:n>=55296&&n<=57343?(r+=4,++t):r+=3}return r},me=(e,r,t,n)=>{if(!(n>0))return 0;for(var o=t,a=t+n-1,i=0;i<e.length;++i){var s=e.charCodeAt(i);if(s>=55296&&s<=57343&&(s=65536+((1023&s)<<10)|1023&e.charCodeAt(++i)),s<=127){if(t>=a)break;r[t++]=s}else if(s<=2047){if(t+1>=a)break;r[t++]=192|s>>6,r[t++]=128|63&s}else if(s<=65535){if(t+2>=a)break;r[t++]=224|s>>12,r[t++]=128|s>>6&63,r[t++]=128|63&s}else{if(t+3>=a)break;r[t++]=240|s>>18,r[t++]=128|s>>12&63,r[t++]=128|s>>6&63,r[t++]=128|63&s}}return r[t]=0,t-o};function he(e,r,t){var n=fe(e)+1,o=new Array(n),a=me(e,o,0,o.length);return r&&(o.length=a),o}var pe=()=>{if(!ce.length){var e=null;if("undefined"!=typeof window&&"function"==typeof window.prompt?null!==(e=window.prompt("Input: "))&&(e+="\n"):"function"==typeof readline&&null!==(e=readline())&&(e+="\n"),!e)return null;ce=he(e,!0)}return ce.shift()},ve={ttys:[],init(){},shutdown(){},register(e,r){ve.ttys[e]={input:[],output:[],ops:r},Ae.registerDevice(e,ve.stream_ops)},stream_ops:{open(e){var r=ve.ttys[e.node.rdev];if(!r)throw new Ae.ErrnoError(43);e.tty=r,e.seekable=!1},close(e){e.tty.ops.fsync(e.tty)},fsync(e){e.tty.ops.fsync(e.tty)},read(e,r,t,n,o){if(!e.tty||!e.tty.ops.get_char)throw new Ae.ErrnoError(60);for(var a=0,i=0;i<n;i++){var s;try{s=e.tty.ops.get_char(e.tty)}catch(u){throw new Ae.ErrnoError(29)}if(void 0===s&&0===a)throw new Ae.ErrnoError(6);if(null==s)break;a++,r[t+i]=s}return a&&(e.node.timestamp=Date.now()),a},write(e,r,t,n,o){if(!e.tty||!e.tty.ops.put_char)throw new Ae.ErrnoError(60);try{for(var a=0;a<n;a++)e.tty.ops.put_char(e.tty,r[t+a])}catch(i){throw new Ae.ErrnoError(29)}return n&&(e.node.timestamp=Date.now()),a}},default_tty_ops:{get_char:e=>pe(),put_char(e,r){null===r||10===r?(p(re(e.output,0)),e.output=[]):0!=r&&e.output.push(r)},fsync(e){e.output&&e.output.length>0&&(p(re(e.output,0)),e.output=[])},ioctl_tcgets:e=>({c_iflag:25856,c_oflag:5,c_cflag:191,c_lflag:35387,c_cc:[3,28,127,21,4,0,1,0,17,19,26,0,18,15,23,22,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]}),ioctl_tcsets:(e,r,t)=>0,ioctl_tiocgwinsz:e=>[24,80]},default_tty1_ops:{put_char(e,r){null===r||10===r?(v(re(e.output,0)),e.output=[]):0!=r&&e.output.push(r)},fsync(e){e.output&&e.output.length>0&&(v(re(e.output,0)),e.output=[])}}},ge=e=>{N()},ye={ops_table:null,mount:e=>ye.createNode(null,"/",16895,0),createNode(e,r,t,n){if(Ae.isBlkdev(t)||Ae.isFIFO(t))throw new Ae.ErrnoError(63);ye.ops_table||(ye.ops_table={dir:{node:{getattr:ye.node_ops.getattr,setattr:ye.node_ops.setattr,lookup:ye.node_ops.lookup,mknod:ye.node_ops.mknod,rename:ye.node_ops.rename,unlink:ye.node_ops.unlink,rmdir:ye.node_ops.rmdir,readdir:ye.node_ops.readdir,symlink:ye.node_ops.symlink},stream:{llseek:ye.stream_ops.llseek}},file:{node:{getattr:ye.node_ops.getattr,setattr:ye.node_ops.setattr},stream:{llseek:ye.stream_ops.llseek,read:ye.stream_ops.read,write:ye.stream_ops.write,allocate:ye.stream_ops.allocate,mmap:ye.stream_ops.mmap,msync:ye.stream_ops.msync}},link:{node:{getattr:ye.node_ops.getattr,setattr:ye.node_ops.setattr,readlink:ye.node_ops.readlink},stream:{}},chrdev:{node:{getattr:ye.node_ops.getattr,setattr:ye.node_ops.setattr},stream:Ae.chrdev_stream_ops}});var o=Ae.createNode(e,r,t,n);return Ae.isDir(o.mode)?(o.node_ops=ye.ops_table.dir.node,o.stream_ops=ye.ops_table.dir.stream,o.contents={}):Ae.isFile(o.mode)?(o.node_ops=ye.ops_table.file.node,o.stream_ops=ye.ops_table.file.stream,o.usedBytes=0,o.contents=null):Ae.isLink(o.mode)?(o.node_ops=ye.ops_table.link.node,o.stream_ops=ye.ops_table.link.stream):Ae.isChrdev(o.mode)&&(o.node_ops=ye.ops_table.chrdev.node,o.stream_ops=ye.ops_table.chrdev.stream),o.timestamp=Date.now(),e&&(e.contents[r]=o,e.timestamp=o.timestamp),o},getFileDataAsTypedArray:e=>e.contents?e.contents.subarray?e.contents.subarray(0,e.usedBytes):new Uint8Array(e.contents):new Uint8Array(0),expandFileStorage(e,r){var t=e.contents?e.contents.length:0;if(!(t>=r)){var n=1048576;r=Math.max(r,t*(t<n?2:1.125)>>>0),0!=t&&(r=Math.max(r,256));var o=e.contents;e.contents=new Uint8Array(r),e.usedBytes>0&&e.contents.set(o.subarray(0,e.usedBytes),0)}},resizeFileStorage(e,r){if(e.usedBytes!=r)if(0==r)e.contents=null,e.usedBytes=0;else{var t=e.contents;e.contents=new Uint8Array(r),t&&e.contents.set(t.subarray(0,Math.min(r,e.usedBytes))),e.usedBytes=r}},node_ops:{getattr(e){var r={};return r.dev=Ae.isChrdev(e.mode)?e.id:1,r.ino=e.id,r.mode=e.mode,r.nlink=1,r.uid=0,r.gid=0,r.rdev=e.rdev,Ae.isDir(e.mode)?r.size=4096:Ae.isFile(e.mode)?r.size=e.usedBytes:Ae.isLink(e.mode)?r.size=e.link.length:r.size=0,r.atime=new Date(e.timestamp),r.mtime=new Date(e.timestamp),r.ctime=new Date(e.timestamp),r.blksize=4096,r.blocks=Math.ceil(r.size/r.blksize),r},setattr(e,r){void 0!==r.mode&&(e.mode=r.mode),void 0!==r.timestamp&&(e.timestamp=r.timestamp),void 0!==r.size&&ye.resizeFileStorage(e,r.size)},lookup(e,r){throw Ae.genericErrors[44]},mknod:(e,r,t,n)=>ye.createNode(e,r,t,n),rename(e,r,t){if(Ae.isDir(e.mode)){var n;try{n=Ae.lookupNode(r,t)}catch(a){}if(n)for(var o in n.contents)throw new Ae.ErrnoError(55)}delete e.parent.contents[e.name],e.parent.timestamp=Date.now(),e.name=t,r.contents[t]=e,r.timestamp=e.parent.timestamp,e.parent=r},unlink(e,r){delete e.contents[r],e.timestamp=Date.now()},rmdir(e,r){var t=Ae.lookupNode(e,r);for(var n in t.contents)throw new Ae.ErrnoError(55);delete e.contents[r],e.timestamp=Date.now()},readdir(e){var r=[".",".."];for(var t in e.contents)e.contents.hasOwnProperty(t)&&r.push(t);return r},symlink(e,r,t){var n=ye.createNode(e,r,41471,0);return n.link=t,n},readlink(e){if(!Ae.isLink(e.mode))throw new Ae.ErrnoError(28);return e.link}},stream_ops:{read(e,r,t,n,o){var a=e.node.contents;if(o>=e.node.usedBytes)return 0;var i=Math.min(e.node.usedBytes-o,n);if(i>8&&a.subarray)r.set(a.subarray(o,o+i),t);else for(var s=0;s<i;s++)r[t+s]=a[o+s];return i},write(e,r,t,n,o,a){if(r.buffer===g.buffer&&(a=!1),!n)return 0;var i=e.node;if(i.timestamp=Date.now(),r.subarray&&(!i.contents||i.contents.subarray)){if(a)return i.contents=r.subarray(t,t+n),i.usedBytes=n,n;if(0===i.usedBytes&&0===o)return i.contents=r.slice(t,t+n),i.usedBytes=n,n;if(o+n<=i.usedBytes)return i.contents.set(r.subarray(t,t+n),o),n}if(ye.expandFileStorage(i,o+n),i.contents.subarray&&r.subarray)i.contents.set(r.subarray(t,t+n),o);else for(var s=0;s<n;s++)i.contents[o+s]=r[t+s];return i.usedBytes=Math.max(i.usedBytes,o+n),n},llseek(e,r,t){var n=r;if(1===t?n+=e.position:2===t&&Ae.isFile(e.node.mode)&&(n+=e.node.usedBytes),n<0)throw new Ae.ErrnoError(28);return n},allocate(e,r,t){ye.expandFileStorage(e.node,r+t),e.node.usedBytes=Math.max(e.node.usedBytes,r+t)},mmap(e,r,t,n,o){if(!Ae.isFile(e.node.mode))throw new Ae.ErrnoError(43);var a,i,s=e.node.contents;if(2&o||s.buffer!==g.buffer){if((t>0||t+r<s.length)&&(s=s.subarray?s.subarray(t,t+r):Array.prototype.slice.call(s,t,t+r)),i=!0,!(a=ge()))throw new Ae.ErrnoError(48);g.set(s,a)}else i=!1,a=s.byteOffset;return{ptr:a,allocated:i}},msync:(e,r,t,n,o)=>(ye.stream_ops.write(e,r,0,n,t,!1),0)}},we=(e,r,t,n)=>{var o=H(`al ${e}`);s(e,(t=>{A(t,`Loading data file "${e}" failed (no arrayBuffer).`),r(new Uint8Array(t)),o&&W()}),(r=>{if(!t)throw`Loading data file "${e}" failed.`;t()})),o&&O()},Ee=(e,r,t,n,o,a)=>Ae.createDataFile(e,r,t,n,o,a),be=a.preloadPlugins||[],_e=(e,r,t,n)=>{"undefined"!=typeof Browser&&Browser.init();var o=!1;return be.forEach((a=>{o||a.canHandle(r)&&(a.handle(e,r,t,n),o=!0)})),o},ke=(e,r,t,n,o,a,i,s,u,l)=>{var d=r?de.resolve(se.join2(e,r)):e;function c(t){function c(t){l&&l(),s||Ee(e,r,t,n,o,u),a&&a(),W()}_e(t,d,c,(()=>{i&&i(),W()}))||c(t)}O(),"string"==typeof t?we(t,(e=>c(e)),i):c(t)},xe=e=>{var r={r:0,"r+":2,w:577,"w+":578,a:1089,"a+":1090}[e];if(void 0===r)throw new Error(`Unknown file open mode: ${e}`);return r},Fe=(e,r)=>{var t=0;return e&&(t|=365),r&&(t|=146),t},Ae={root:null,mounts:[],devices:{},streams:[],nextInode:1,nameTable:null,currentPath:"/",initialized:!1,ignorePermissions:!0,ErrnoError:null,genericErrors:{},filesystems:null,syncFSRequests:0,lookupPath(e,r={}){if(!(e=de.resolve(e)))return{path:"",node:null};var t={follow_mount:!0,recurse_count:0};if((r=Object.assign(t,r)).recurse_count>8)throw new Ae.ErrnoError(32);for(var n=e.split("/").filter((e=>!!e)),o=Ae.root,a="/",i=0;i<n.length;i++){var s=i===n.length-1;if(s&&r.parent)break;if(o=Ae.lookupNode(o,n[i]),a=se.join2(a,n[i]),Ae.isMountpoint(o)&&(!s||s&&r.follow_mount)&&(o=o.mounted.root),!s||r.follow)for(var u=0;Ae.isLink(o.mode);){var l=Ae.readlink(a);if(a=de.resolve(se.dirname(a),l),o=Ae.lookupPath(a,{recurse_count:r.recurse_count+1}).node,u++>40)throw new Ae.ErrnoError(32)}}return{path:a,node:o}},getPath(e){for(var r;;){if(Ae.isRoot(e)){var t=e.mount.mountpoint;return r?"/"!==t[t.length-1]?`${t}/${r}`:t+r:t}r=r?`${e.name}/${r}`:e.name,e=e.parent}},hashName(e,r){for(var t=0,n=0;n<r.length;n++)t=(t<<5)-t+r.charCodeAt(n)|0;return(e+t>>>0)%Ae.nameTable.length},hashAddNode(e){var r=Ae.hashName(e.parent.id,e.name);e.name_next=Ae.nameTable[r],Ae.nameTable[r]=e},hashRemoveNode(e){var r=Ae.hashName(e.parent.id,e.name);if(Ae.nameTable[r]===e)Ae.nameTable[r]=e.name_next;else for(var t=Ae.nameTable[r];t;){if(t.name_next===e){t.name_next=e.name_next;break}t=t.name_next}},lookupNode(e,r){var t=Ae.mayLookup(e);if(t)throw new Ae.ErrnoError(t,e);for(var n=Ae.hashName(e.id,r),o=Ae.nameTable[n];o;o=o.name_next){var a=o.name;if(o.parent.id===e.id&&a===r)return o}return Ae.lookup(e,r)},createNode(e,r,t,n){var o=new Ae.FSNode(e,r,t,n);return Ae.hashAddNode(o),o},destroyNode(e){Ae.hashRemoveNode(e)},isRoot:e=>e===e.parent,isMountpoint:e=>!!e.mounted,isFile:e=>32768==(61440&e),isDir:e=>16384==(61440&e),isLink:e=>40960==(61440&e),isChrdev:e=>8192==(61440&e),isBlkdev:e=>24576==(61440&e),isFIFO:e=>4096==(61440&e),isSocket:e=>!(49152&~e),flagsToPermissionString(e){var r=["r","w","rw"][3&e];return 512&e&&(r+="w"),r},nodePermissions:(e,r)=>Ae.ignorePermissions||(!r.includes("r")||292&e.mode)&&(!r.includes("w")||146&e.mode)&&(!r.includes("x")||73&e.mode)?0:2,mayLookup(e){var r=Ae.nodePermissions(e,"x");return r||(e.node_ops.lookup?0:2)},mayCreate(e,r){try{return Ae.lookupNode(e,r),20}catch(t){}return Ae.nodePermissions(e,"wx")},mayDelete(e,r,t){var n;try{n=Ae.lookupNode(e,r)}catch(a){return a.errno}var o=Ae.nodePermissions(e,"wx");if(o)return o;if(t){if(!Ae.isDir(n.mode))return 54;if(Ae.isRoot(n)||Ae.getPath(n)===Ae.cwd())return 10}else if(Ae.isDir(n.mode))return 31;return 0},mayOpen:(e,r)=>e?Ae.isLink(e.mode)?32:Ae.isDir(e.mode)&&("r"!==Ae.flagsToPermissionString(r)||512&r)?31:Ae.nodePermissions(e,Ae.flagsToPermissionString(r)):44,MAX_OPEN_FDS:4096,nextfd(){for(var e=0;e<=Ae.MAX_OPEN_FDS;e++)if(!Ae.streams[e])return e;throw new Ae.ErrnoError(33)},getStreamChecked(e){var r=Ae.getStream(e);if(!r)throw new Ae.ErrnoError(8);return r},getStream:e=>Ae.streams[e],createStream:(e,r=-1)=>(Ae.FSStream||(Ae.FSStream=function(){this.shared={}},Ae.FSStream.prototype={},Object.defineProperties(Ae.FSStream.prototype,{object:{get(){return this.node},set(e){this.node=e}},isRead:{get(){return 1!=(2097155&this.flags)}},isWrite:{get(){return!!(2097155&this.flags)}},isAppend:{get(){return 1024&this.flags}},flags:{get(){return this.shared.flags},set(e){this.shared.flags=e}},position:{get(){return this.shared.position},set(e){this.shared.position=e}}})),e=Object.assign(new Ae.FSStream,e),-1==r&&(r=Ae.nextfd()),e.fd=r,Ae.streams[r]=e,e),closeStream(e){Ae.streams[e]=null},chrdev_stream_ops:{open(e){var r=Ae.getDevice(e.node.rdev);e.stream_ops=r.stream_ops,e.stream_ops.open&&e.stream_ops.open(e)},llseek(){throw new Ae.ErrnoError(70)}},major:e=>e>>8,minor:e=>255&e,makedev:(e,r)=>e<<8|r,registerDevice(e,r){Ae.devices[e]={stream_ops:r}},getDevice:e=>Ae.devices[e],getMounts(e){for(var r=[],t=[e];t.length;){var n=t.pop();r.push(n),t.push.apply(t,n.mounts)}return r},syncfs(e,r){"function"==typeof e&&(r=e,e=!1),Ae.syncFSRequests++,Ae.syncFSRequests>1&&v(`warning: ${Ae.syncFSRequests} FS.syncfs operations in flight at once, probably just doing extra work`);var t=Ae.getMounts(Ae.root.mount),n=0;function o(e){return Ae.syncFSRequests--,r(e)}function a(e){if(e)return a.errored?void 0:(a.errored=!0,o(e));++n>=t.length&&o(null)}t.forEach((r=>{if(!r.type.syncfs)return a(null);r.type.syncfs(r,e,a)}))},mount(e,r,t){var n,o="/"===t,a=!t;if(o&&Ae.root)throw new Ae.ErrnoError(10);if(!o&&!a){var i=Ae.lookupPath(t,{follow_mount:!1});if(t=i.path,n=i.node,Ae.isMountpoint(n))throw new Ae.ErrnoError(10);if(!Ae.isDir(n.mode))throw new Ae.ErrnoError(54)}var s={type:e,opts:r,mountpoint:t,mounts:[]},u=e.mount(s);return u.mount=s,s.root=u,o?Ae.root=u:n&&(n.mounted=s,n.mount&&n.mount.mounts.push(s)),u},unmount(e){var r=Ae.lookupPath(e,{follow_mount:!1});if(!Ae.isMountpoint(r.node))throw new Ae.ErrnoError(28);var t=r.node,n=t.mounted,o=Ae.getMounts(n);Object.keys(Ae.nameTable).forEach((e=>{for(var r=Ae.nameTable[e];r;){var t=r.name_next;o.includes(r.mount)&&Ae.destroyNode(r),r=t}})),t.mounted=null;var a=t.mount.mounts.indexOf(n);t.mount.mounts.splice(a,1)},lookup:(e,r)=>e.node_ops.lookup(e,r),mknod(e,r,t){var n=Ae.lookupPath(e,{parent:!0}).node,o=se.basename(e);if(!o||"."===o||".."===o)throw new Ae.ErrnoError(28);var a=Ae.mayCreate(n,o);if(a)throw new Ae.ErrnoError(a);if(!n.node_ops.mknod)throw new Ae.ErrnoError(63);return n.node_ops.mknod(n,o,r,t)},create:(e,r)=>(r=void 0!==r?r:438,r&=4095,r|=32768,Ae.mknod(e,r,0)),mkdir:(e,r)=>(r=void 0!==r?r:511,r&=1023,r|=16384,Ae.mknod(e,r,0)),mkdirTree(e,r){for(var t=e.split("/"),n="",o=0;o<t.length;++o)if(t[o]){n+="/"+t[o];try{Ae.mkdir(n,r)}catch(a){if(20!=a.errno)throw a}}},mkdev:(e,r,t)=>(void 0===t&&(t=r,r=438),r|=8192,Ae.mknod(e,r,t)),symlink(e,r){if(!de.resolve(e))throw new Ae.ErrnoError(44);var t=Ae.lookupPath(r,{parent:!0}).node;if(!t)throw new Ae.ErrnoError(44);var n=se.basename(r),o=Ae.mayCreate(t,n);if(o)throw new Ae.ErrnoError(o);if(!t.node_ops.symlink)throw new Ae.ErrnoError(63);return t.node_ops.symlink(t,n,e)},rename(e,r){var t,n,o=se.dirname(e),a=se.dirname(r),i=se.basename(e),s=se.basename(r);if(t=Ae.lookupPath(e,{parent:!0}).node,n=Ae.lookupPath(r,{parent:!0}).node,!t||!n)throw new Ae.ErrnoError(44);if(t.mount!==n.mount)throw new Ae.ErrnoError(75);var u,l=Ae.lookupNode(t,i),d=de.relative(e,a);if("."!==d.charAt(0))throw new Ae.ErrnoError(28);if("."!==(d=de.relative(r,o)).charAt(0))throw new Ae.ErrnoError(55);try{u=Ae.lookupNode(n,s)}catch(m){}if(l!==u){var c=Ae.isDir(l.mode),f=Ae.mayDelete(t,i,c);if(f)throw new Ae.ErrnoError(f);if(f=u?Ae.mayDelete(n,s,c):Ae.mayCreate(n,s))throw new Ae.ErrnoError(f);if(!t.node_ops.rename)throw new Ae.ErrnoError(63);if(Ae.isMountpoint(l)||u&&Ae.isMountpoint(u))throw new Ae.ErrnoError(10);if(n!==t&&(f=Ae.nodePermissions(t,"w")))throw new Ae.ErrnoError(f);Ae.hashRemoveNode(l);try{t.node_ops.rename(l,n,s)}catch(m){throw m}finally{Ae.hashAddNode(l)}}},rmdir(e){var r=Ae.lookupPath(e,{parent:!0}).node,t=se.basename(e),n=Ae.lookupNode(r,t),o=Ae.mayDelete(r,t,!0);if(o)throw new Ae.ErrnoError(o);if(!r.node_ops.rmdir)throw new Ae.ErrnoError(63);if(Ae.isMountpoint(n))throw new Ae.ErrnoError(10);r.node_ops.rmdir(r,t),Ae.destroyNode(n)},readdir(e){var r=Ae.lookupPath(e,{follow:!0}).node;if(!r.node_ops.readdir)throw new Ae.ErrnoError(54);return r.node_ops.readdir(r)},unlink(e){var r=Ae.lookupPath(e,{parent:!0}).node;if(!r)throw new Ae.ErrnoError(44);var t=se.basename(e),n=Ae.lookupNode(r,t),o=Ae.mayDelete(r,t,!1);if(o)throw new Ae.ErrnoError(o);if(!r.node_ops.unlink)throw new Ae.ErrnoError(63);if(Ae.isMountpoint(n))throw new Ae.ErrnoError(10);r.node_ops.unlink(r,t),Ae.destroyNode(n)},readlink(e){var r=Ae.lookupPath(e).node;if(!r)throw new Ae.ErrnoError(44);if(!r.node_ops.readlink)throw new Ae.ErrnoError(28);return de.resolve(Ae.getPath(r.parent),r.node_ops.readlink(r))},stat(e,r){var t=Ae.lookupPath(e,{follow:!r}).node;if(!t)throw new Ae.ErrnoError(44);if(!t.node_ops.getattr)throw new Ae.ErrnoError(63);return t.node_ops.getattr(t)},lstat:e=>Ae.stat(e,!0),chmod(e,r,t){var n;if(!(n="string"==typeof e?Ae.lookupPath(e,{follow:!t}).node:e).node_ops.setattr)throw new Ae.ErrnoError(63);n.node_ops.setattr(n,{mode:4095&r|-4096&n.mode,timestamp:Date.now()})},lchmod(e,r){Ae.chmod(e,r,!0)},fchmod(e,r){var t=Ae.getStreamChecked(e);Ae.chmod(t.node,r)},chown(e,r,t,n){var o;if(!(o="string"==typeof e?Ae.lookupPath(e,{follow:!n}).node:e).node_ops.setattr)throw new Ae.ErrnoError(63);o.node_ops.setattr(o,{timestamp:Date.now()})},lchown(e,r,t){Ae.chown(e,r,t,!0)},fchown(e,r,t){var n=Ae.getStreamChecked(e);Ae.chown(n.node,r,t)},truncate(e,r){if(r<0)throw new Ae.ErrnoError(28);var t;if(!(t="string"==typeof e?Ae.lookupPath(e,{follow:!0}).node:e).node_ops.setattr)throw new Ae.ErrnoError(63);if(Ae.isDir(t.mode))throw new Ae.ErrnoError(31);if(!Ae.isFile(t.mode))throw new Ae.ErrnoError(28);var n=Ae.nodePermissions(t,"w");if(n)throw new Ae.ErrnoError(n);t.node_ops.setattr(t,{size:r,timestamp:Date.now()})},ftruncate(e,r){var t=Ae.getStreamChecked(e);if(!(2097155&t.flags))throw new Ae.ErrnoError(28);Ae.truncate(t.node,r)},utime(e,r,t){var n=Ae.lookupPath(e,{follow:!0}).node;n.node_ops.setattr(n,{timestamp:Math.max(r,t)})},open(e,r,t){if(""===e)throw new Ae.ErrnoError(44);var n;if(t=void 0===t?438:t,t=64&(r="string"==typeof r?xe(r):r)?4095&t|32768:0,"object"==typeof e)n=e;else{e=se.normalize(e);try{n=Ae.lookupPath(e,{follow:!(131072&r)}).node}catch(u){}}var o=!1;if(64&r)if(n){if(128&r)throw new Ae.ErrnoError(20)}else n=Ae.mknod(e,t,0),o=!0;if(!n)throw new Ae.ErrnoError(44);if(Ae.isChrdev(n.mode)&&(r&=-513),65536&r&&!Ae.isDir(n.mode))throw new Ae.ErrnoError(54);if(!o){var i=Ae.mayOpen(n,r);if(i)throw new Ae.ErrnoError(i)}512&r&&!o&&Ae.truncate(n,0),r&=-131713;var s=Ae.createStream({node:n,path:Ae.getPath(n),flags:r,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&r||(Ae.readFiles||(Ae.readFiles={}),e in Ae.readFiles||(Ae.readFiles[e]=1)),s},close(e){if(Ae.isClosed(e))throw new Ae.ErrnoError(8);e.getdents&&(e.getdents=null);try{e.stream_ops.close&&e.stream_ops.close(e)}catch(r){throw r}finally{Ae.closeStream(e.fd)}e.fd=null},isClosed:e=>null===e.fd,llseek(e,r,t){if(Ae.isClosed(e))throw new Ae.ErrnoError(8);if(!e.seekable||!e.stream_ops.llseek)throw new Ae.ErrnoError(70);if(0!=t&&1!=t&&2!=t)throw new Ae.ErrnoError(28);return e.position=e.stream_ops.llseek(e,r,t),e.ungotten=[],e.position},read(e,r,t,n,o){if(n<0||o<0)throw new Ae.ErrnoError(28);if(Ae.isClosed(e))throw new Ae.ErrnoError(8);if(1==(2097155&e.flags))throw new Ae.ErrnoError(8);if(Ae.isDir(e.node.mode))throw new Ae.ErrnoError(31);if(!e.stream_ops.read)throw new Ae.ErrnoError(28);var a=void 0!==o;if(a){if(!e.seekable)throw new Ae.ErrnoError(70)}else o=e.position;var i=e.stream_ops.read(e,r,t,n,o);return a||(e.position+=i),i},write(e,r,t,n,o,a){if(n<0||o<0)throw new Ae.ErrnoError(28);if(Ae.isClosed(e))throw new Ae.ErrnoError(8);if(!(2097155&e.flags))throw new Ae.ErrnoError(8);if(Ae.isDir(e.node.mode))throw new Ae.ErrnoError(31);if(!e.stream_ops.write)throw new Ae.ErrnoError(28);e.seekable&&1024&e.flags&&Ae.llseek(e,0,2);var i=void 0!==o;if(i){if(!e.seekable)throw new Ae.ErrnoError(70)}else o=e.position;var s=e.stream_ops.write(e,r,t,n,o,a);return i||(e.position+=s),s},allocate(e,r,t){if(Ae.isClosed(e))throw new Ae.ErrnoError(8);if(r<0||t<=0)throw new Ae.ErrnoError(28);if(!(2097155&e.flags))throw new Ae.ErrnoError(8);if(!Ae.isFile(e.node.mode)&&!Ae.isDir(e.node.mode))throw new Ae.ErrnoError(43);if(!e.stream_ops.allocate)throw new Ae.ErrnoError(138);e.stream_ops.allocate(e,r,t)},mmap(e,r,t,n,o){if(2&n&&!(2&o)&&2!=(2097155&e.flags))throw new Ae.ErrnoError(2);if(1==(2097155&e.flags))throw new Ae.ErrnoError(2);if(!e.stream_ops.mmap)throw new Ae.ErrnoError(43);return e.stream_ops.mmap(e,r,t,n,o)},msync:(e,r,t,n,o)=>e.stream_ops.msync?e.stream_ops.msync(e,r,t,n,o):0,munmap:e=>0,ioctl(e,r,t){if(!e.stream_ops.ioctl)throw new Ae.ErrnoError(59);return e.stream_ops.ioctl(e,r,t)},readFile(e,r={}){if(r.flags=r.flags||0,r.encoding=r.encoding||"binary","utf8"!==r.encoding&&"binary"!==r.encoding)throw new Error(`Invalid encoding type "${r.encoding}"`);var t,n=Ae.open(e,r.flags),o=Ae.stat(e).size,a=new Uint8Array(o);return Ae.read(n,a,0,o,0),"utf8"===r.encoding?t=re(a,0):"binary"===r.encoding&&(t=a),Ae.close(n),t},writeFile(e,r,t={}){t.flags=t.flags||577;var n=Ae.open(e,t.flags,t.mode);if("string"==typeof r){var o=new Uint8Array(fe(r)+1),a=me(r,o,0,o.length);Ae.write(n,o,0,a,void 0,t.canOwn)}else{if(!ArrayBuffer.isView(r))throw new Error("Unsupported data type");Ae.write(n,r,0,r.byteLength,void 0,t.canOwn)}Ae.close(n)},cwd:()=>Ae.currentPath,chdir(e){var r=Ae.lookupPath(e,{follow:!0});if(null===r.node)throw new Ae.ErrnoError(44);if(!Ae.isDir(r.node.mode))throw new Ae.ErrnoError(54);var t=Ae.nodePermissions(r.node,"x");if(t)throw new Ae.ErrnoError(t);Ae.currentPath=r.path},createDefaultDirectories(){Ae.mkdir("/tmp"),Ae.mkdir("/home"),Ae.mkdir("/home/web_user")},createDefaultDevices(){Ae.mkdir("/dev"),Ae.registerDevice(Ae.makedev(1,3),{read:()=>0,write:(e,r,t,n,o)=>n}),Ae.mkdev("/dev/null",Ae.makedev(1,3)),ve.register(Ae.makedev(5,0),ve.default_tty_ops),ve.register(Ae.makedev(6,0),ve.default_tty1_ops),Ae.mkdev("/dev/tty",Ae.makedev(5,0)),Ae.mkdev("/dev/tty1",Ae.makedev(6,0));var e=new Uint8Array(1024),r=0,t=()=>(0===r&&(r=le(e).byteLength),e[--r]);Ae.createDevice("/dev","random",t),Ae.createDevice("/dev","urandom",t),Ae.mkdir("/dev/shm"),Ae.mkdir("/dev/shm/tmp")},createSpecialDirectories(){Ae.mkdir("/proc");var e=Ae.mkdir("/proc/self");Ae.mkdir("/proc/self/fd"),Ae.mount({mount(){var r=Ae.createNode(e,"fd",16895,73);return r.node_ops={lookup(e,r){var t=+r,n=Ae.getStreamChecked(t),o={parent:null,mount:{mountpoint:"fake"},node_ops:{readlink:()=>n.path}};return o.parent=o,o}},r}},{},"/proc/self/fd")},createStandardStreams(){a.stdin?Ae.createDevice("/dev","stdin",a.stdin):Ae.symlink("/dev/tty","/dev/stdin"),a.stdout?Ae.createDevice("/dev","stdout",null,a.stdout):Ae.symlink("/dev/tty","/dev/stdout"),a.stderr?Ae.createDevice("/dev","stderr",null,a.stderr):Ae.symlink("/dev/tty1","/dev/stderr"),Ae.open("/dev/stdin",0),Ae.open("/dev/stdout",1),Ae.open("/dev/stderr",1)},ensureErrnoError(){Ae.ErrnoError||(Ae.ErrnoError=function(e,r){this.name="ErrnoError",this.node=r,this.setErrno=function(e){this.errno=e},this.setErrno(e),this.message="FS error"},Ae.ErrnoError.prototype=new Error,Ae.ErrnoError.prototype.constructor=Ae.ErrnoError,[44].forEach((e=>{Ae.genericErrors[e]=new Ae.ErrnoError(e),Ae.genericErrors[e].stack="<generic error, no stack>"})))},staticInit(){Ae.ensureErrnoError(),Ae.nameTable=new Array(4096),Ae.mount(ye,{},"/"),Ae.createDefaultDirectories(),Ae.createDefaultDevices(),Ae.createSpecialDirectories(),Ae.filesystems={MEMFS:ye}},init(e,r,t){Ae.init.initialized=!0,Ae.ensureErrnoError(),a.stdin=e||a.stdin,a.stdout=r||a.stdout,a.stderr=t||a.stderr,Ae.createStandardStreams()},quit(){Ae.init.initialized=!1;for(var e=0;e<Ae.streams.length;e++){var r=Ae.streams[e];r&&Ae.close(r)}},findObject(e,r){var t=Ae.analyzePath(e,r);return t.exists?t.object:null},analyzePath(e,r){try{e=(n=Ae.lookupPath(e,{follow:!r})).path}catch(o){}var t={isRoot:!1,exists:!1,error:0,name:null,path:null,object:null,parentExists:!1,parentPath:null,parentObject:null};try{var n=Ae.lookupPath(e,{parent:!0});t.parentExists=!0,t.parentPath=n.path,t.parentObject=n.node,t.name=se.basename(e),n=Ae.lookupPath(e,{follow:!r}),t.exists=!0,t.path=n.path,t.object=n.node,t.name=n.node.name,t.isRoot="/"===n.path}catch(o){t.error=o.errno}return t},createPath(e,r,t,n){e="string"==typeof e?e:Ae.getPath(e);for(var o=r.split("/").reverse();o.length;){var a=o.pop();if(a){var i=se.join2(e,a);try{Ae.mkdir(i)}catch(s){}e=i}}return i},createFile(e,r,t,n,o){var a=se.join2("string"==typeof e?e:Ae.getPath(e),r),i=Fe(n,o);return Ae.create(a,i)},createDataFile(e,r,t,n,o,a){var i=r;e&&(e="string"==typeof e?e:Ae.getPath(e),i=r?se.join2(e,r):e);var s=Fe(n,o),u=Ae.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}Ae.chmod(u,146|s);var f=Ae.open(u,577);Ae.write(f,t,0,t.length,0,a),Ae.close(f),Ae.chmod(u,s)}return u},createDevice(e,r,t,n){var o=se.join2("string"==typeof e?e:Ae.getPath(e),r),a=Fe(!!t,!!n);Ae.createDevice.major||(Ae.createDevice.major=64);var i=Ae.makedev(Ae.createDevice.major++,0);return Ae.registerDevice(i,{open(e){e.seekable=!1},close(e){n&&n.buffer&&n.buffer.length&&n(10)},read(e,r,n,o,a){for(var i=0,s=0;s<o;s++){var u;try{u=t()}catch(l){throw new Ae.ErrnoError(29)}if(void 0===u&&0===i)throw new Ae.ErrnoError(6);if(null==u)break;i++,r[n+s]=u}return i&&(e.node.timestamp=Date.now()),i},write(e,r,t,o,a){for(var i=0;i<o;i++)try{n(r[t+i])}catch(s){throw new Ae.ErrnoError(29)}return o&&(e.node.timestamp=Date.now()),i}}),Ae.mkdev(o,a,i)},forceLoadFile(e){if(e.isDevice||e.isFolder||e.link||e.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{e.contents=he(i(e.url),!0),e.usedBytes=e.contents.length}catch(r){throw new Ae.ErrnoError(29)}},createLazyFile(e,r,t,n,o){function a(){this.lengthKnown=!1,this.chunks=[]}if(a.prototype.get=function(e){if(!(e>this.length-1||e<0)){var r=e%this.chunkSize,t=e/this.chunkSize|0;return this.getter(t)[r]}},a.prototype.setDataGetter=function(e){this.getter=e},a.prototype.cacheLength=function(){var e=new XMLHttpRequest;if(e.open("HEAD",t,!1),e.send(null),!(e.status>=200&&e.status<300||304===e.status))throw new Error("Couldn't load "+t+". Status: "+e.status);var r,n=Number(e.getResponseHeader("Content-length")),o=(r=e.getResponseHeader("Accept-Ranges"))&&"bytes"===r,a=(r=e.getResponseHeader("Content-Encoding"))&&"gzip"===r,i=1048576;o||(i=n);var s=(e,r)=>{if(e>r)throw new Error("invalid range ("+e+", "+r+") or no bytes requested!");if(r>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="+e+"-"+r),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||[]):he(o.responseText||"",!0)},u=this;u.setDataGetter((e=>{var r=e*i,t=(e+1)*i-1;if(t=Math.min(t,n-1),void 0===u.chunks[e]&&(u.chunks[e]=s(r,t)),void 0===u.chunks[e])throw new Error("doXHR failed!");return u.chunks[e]})),!a&&n||(i=n=1,n=this.getter(0).length,i=n,p("LazyFiles on gzip forces download of the whole file when length is accessed")),this._length=n,this._chunkSize=i,this.lengthKnown=!0},"undefined"!=typeof XMLHttpRequest)throw"Cannot do synchronous binary XHRs outside webworkers in modern browsers. Use --embed-file or --preload-file in emcc";var i={isDevice:!1,url:t},s=Ae.createFile(e,r,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(e,r,t,n,o){var a=e.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++)r[t+s]=a[o+s];else for(s=0;s<i;s++)r[t+s]=a.get(o+s);return i}return Object.keys(s.stream_ops).forEach((e=>{var r=s.stream_ops[e];u[e]=function(){return Ae.forceLoadFile(s),r.apply(null,arguments)}})),u.read=(e,r,t,n,o)=>(Ae.forceLoadFile(s),l(e,r,t,n,o)),u.mmap=(e,r,t,n,o)=>{Ae.forceLoadFile(s);var a=ge();if(!a)throw new Ae.ErrnoError(48);return l(e,g,a,r,t),{ptr:a,allocated:!0}},s.stream_ops=u,s}},Pe={DEFAULT_POLLMASK:5,calculateAt(e,r,t){if(se.isAbs(r))return r;var n;if(n=-100===e?Ae.cwd():Pe.getStreamFromFD(e).path,0==r.length){if(!t)throw new Ae.ErrnoError(44);return n}return se.join2(n,r)},doStat(e,r,t){try{var n=e(r)}catch(s){if(s&&s.node&&se.normalize(r)!==se.normalize(Ae.getPath(s.node)))return-54;throw s}b[t>>2]=n.dev,b[t+4>>2]=n.mode,_[t+8>>2]=n.nlink,b[t+12>>2]=n.uid,b[t+16>>2]=n.gid,b[t+20>>2]=n.rdev,V=[n.size>>>0,(U=n.size,+Math.abs(U)>=1?U>0?+Math.floor(U/4294967296)>>>0:~~+Math.ceil((U-+(~~U>>>0))/4294967296)>>>0:0)],b[t+24>>2]=V[0],b[t+28>>2]=V[1],b[t+32>>2]=4096,b[t+36>>2]=n.blocks;var o=n.atime.getTime(),a=n.mtime.getTime(),i=n.ctime.getTime();return V=[Math.floor(o/1e3)>>>0,(U=Math.floor(o/1e3),+Math.abs(U)>=1?U>0?+Math.floor(U/4294967296)>>>0:~~+Math.ceil((U-+(~~U>>>0))/4294967296)>>>0:0)],b[t+40>>2]=V[0],b[t+44>>2]=V[1],_[t+48>>2]=o%1e3*1e3,V=[Math.floor(a/1e3)>>>0,(U=Math.floor(a/1e3),+Math.abs(U)>=1?U>0?+Math.floor(U/4294967296)>>>0:~~+Math.ceil((U-+(~~U>>>0))/4294967296)>>>0:0)],b[t+56>>2]=V[0],b[t+60>>2]=V[1],_[t+64>>2]=a%1e3*1e3,V=[Math.floor(i/1e3)>>>0,(U=Math.floor(i/1e3),+Math.abs(U)>=1?U>0?+Math.floor(U/4294967296)>>>0:~~+Math.ceil((U-+(~~U>>>0))/4294967296)>>>0:0)],b[t+72>>2]=V[0],b[t+76>>2]=V[1],_[t+80>>2]=i%1e3*1e3,V=[n.ino>>>0,(U=n.ino,+Math.abs(U)>=1?U>0?+Math.floor(U/4294967296)>>>0:~~+Math.ceil((U-+(~~U>>>0))/4294967296)>>>0:0)],b[t+88>>2]=V[0],b[t+92>>2]=V[1],0},doMsync(e,r,t,n,o){if(!Ae.isFile(r.node.mode))throw new Ae.ErrnoError(43);if(2&n)return 0;var a=y.slice(e,e+t);Ae.msync(r,a,o,t,n)},varargs:void 0,get(){var e=b[+Pe.varargs>>2];return Pe.varargs+=4,e},getp:()=>Pe.get(),getStr:e=>te(e),getStreamFromFD:e=>Ae.getStreamChecked(e)};function Se(e,r,t){Pe.varargs=t;try{var n=Pe.getStreamFromFD(e);switch(r){case 0:if((o=Pe.get())<0)return-28;for(;Ae.streams[o];)o++;return Ae.createStream(n,o).fd;case 1:case 2:case 6:case 7:return 0;case 3:return n.flags;case 4:var o=Pe.get();return n.flags|=o,0;case 5:return o=Pe.getp(),w[o+0>>1]=2,0;case 16:case 8:default:return-28;case 9:return ie(28),-1}}catch(a){if(void 0===Ae||"ErrnoError"!==a.name)throw a;return-a.errno}}function Ce(e,r,t){Pe.varargs=t;try{var n=Pe.getStreamFromFD(e);switch(r){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=Pe.getp();b[a>>2]=o.c_iflag||0,b[a+4>>2]=o.c_oflag||0,b[a+8>>2]=o.c_cflag||0,b[a+12>>2]=o.c_lflag||0;for(var i=0;i<32;i++)g[a+i+17|0]=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=Pe.getp();var s=b[a>>2],u=b[a+4>>2],l=b[a+8>>2],d=b[a+12>>2],c=[];for(i=0;i<32;i++)c.push(g[a+i+17|0]);return n.tty.ops.ioctl_tcsets(n.tty,r,{c_iflag:s,c_oflag:u,c_cflag:l,c_lflag:d,c_cc:c})}return 0;case 21519:return n.tty?(a=Pe.getp(),b[a>>2]=0,0):-59;case 21520:return n.tty?-28:-59;case 21531:return a=Pe.getp(),Ae.ioctl(n,r,a);case 21523:if(!n.tty)return-59;if(n.tty.ops.ioctl_tiocgwinsz){var f=n.tty.ops.ioctl_tiocgwinsz(n.tty);a=Pe.getp(),w[a>>1]=f[0],w[a+2>>1]=f[1]}return 0;default:return-28}}catch(m){if(void 0===Ae||"ErrnoError"!==m.name)throw m;return-m.errno}}function De(e,r,t,n){Pe.varargs=n;try{r=Pe.getStr(r),r=Pe.calculateAt(e,r);var o=n?Pe.get():0;return Ae.open(r,t,o).fd}catch(a){if(void 0===Ae||"ErrnoError"!==a.name)throw a;return-a.errno}}var Te={},$e=e=>{for(;e.length;){var r=e.pop();e.pop()(r)}};function je(e){return this.fromWireType(b[e>>2])}var Me,Be,Le,Re={},Ie={},He={},Oe=e=>{throw new Me(e)},We=(e,r,t)=>{function n(r){var n=t(r);n.length!==e.length&&Oe("Mismatched type converter count");for(var o=0;o<e.length;++o)Ye(e[o],n[o])}e.forEach((function(e){He[e]=r}));var o=new Array(r.length),a=[],i=0;r.forEach(((e,r)=>{Ie.hasOwnProperty(e)?o[r]=Ie[e]:(a.push(e),Re.hasOwnProperty(e)||(Re[e]=[]),Re[e].push((()=>{o[r]=Ie[e],++i===a.length&&n(o)})))})),0===a.length&&n(o)},Ne=e=>{var r=Te[e];delete Te[e];var t=r.rawConstructor,n=r.rawDestructor,o=r.fields,a=o.map((e=>e.getterReturnType)).concat(o.map((e=>e.setterArgumentType)));We([e],a,(e=>{var a={};return o.forEach(((r,t)=>{var n=r.fieldName,i=e[t],s=r.getter,u=r.getterContext,l=e[t+o.length],d=r.setter,c=r.setterContext;a[n]={read:e=>i.fromWireType(s(u,e)),write:(e,r)=>{var t=[];d(c,e,l.toWireType(t,r)),$e(t)}}})),[{name:r.name,fromWireType:e=>{var r={};for(var t in a)r[t]=a[t].read(e);return n(e),r},toWireType:(e,r)=>{for(var o in a)if(!(o in r))throw new TypeError(`Missing field: "${o}"`);var i=t();for(o in a)a[o].write(i,r[o]);return null!==e&&e.push(n,i),i},argPackAdvance:Xe,readValueFromPointer:je,destructorFunction:n}]}))},ze=(e,r,t,n,o)=>{},Ue=()=>{for(var e=new Array(256),r=0;r<256;++r)e[r]=String.fromCharCode(r);Be=e},Ve=e=>{for(var r="",t=e;y[t];)r+=Be[y[t++]];return r},Ge=e=>{throw new Le(e)};function qe(e,r,t={}){var n=r.name;if(e||Ge(`type "${n}" must have a positive integer typeid pointer`),Ie.hasOwnProperty(e)){if(t.ignoreDuplicateRegistrations)return;Ge(`Cannot register type '${n}' twice`)}if(Ie[e]=r,delete He[e],Re.hasOwnProperty(e)){var o=Re[e];delete Re[e],o.forEach((e=>e()))}}function Ye(e,r,t={}){if(!("argPackAdvance"in r))throw new TypeError("registerType registeredInstance requires argPackAdvance");return qe(e,r,t)}var Xe=8,Qe=(e,r,t,n)=>{Ye(e,{name:r=Ve(r),fromWireType:function(e){return!!e},toWireType:function(e,r){return r?t:n},argPackAdvance:Xe,readValueFromPointer:function(e){return this.fromWireType(y[e])},destructorFunction:null})};function Je(){Object.assign(Ke.prototype,{get(e){return this.allocated[e]},has(e){return void 0!==this.allocated[e]},allocate(e){var r=this.freelist.pop()||this.allocated.length;return this.allocated[r]=e,r},free(e){this.allocated[e]=void 0,this.freelist.push(e)}})}function Ke(){this.allocated=[void 0],this.freelist=[]}var Ze=new Ke,er=e=>{e>=Ze.reserved&&0==--Ze.get(e).refcount&&Ze.free(e)},rr=()=>{for(var e=0,r=Ze.reserved;r<Ze.allocated.length;++r)void 0!==Ze.allocated[r]&&++e;return e},tr=()=>{Ze.allocated.push({value:void 0},{value:null},{value:!0},{value:!1}),Ze.reserved=Ze.allocated.length,a.count_emval_handles=rr},nr={toValue:e=>(e||Ge("Cannot use deleted val. handle = "+e),Ze.get(e).value),toHandle:e=>{switch(e){case void 0:return 1;case null:return 2;case!0:return 3;case!1:return 4;default:return Ze.allocate({refcount:1,value:e})}}},or=(e,r)=>{Ye(e,{name:r=Ve(r),fromWireType:e=>{var r=nr.toValue(e);return er(e),r},toWireType:(e,r)=>nr.toHandle(r),argPackAdvance:Xe,readValueFromPointer:je,destructorFunction:null})},ar=(e,r,t)=>{if(void 0===e[r].overloadTable){var n=e[r];e[r]=function(){return e[r].overloadTable.hasOwnProperty(arguments.length)||Ge(`Function '${t}' called with an invalid number of arguments (${arguments.length}) - expects one of (${e[r].overloadTable})!`),e[r].overloadTable[arguments.length].apply(this,arguments)},e[r].overloadTable=[],e[r].overloadTable[n.argCount]=n}},ir=(e,r,t)=>{a.hasOwnProperty(e)?((void 0===t||void 0!==a[e].overloadTable&&void 0!==a[e].overloadTable[t])&&Ge(`Cannot register public name '${e}' twice`),ar(a,e,e),a.hasOwnProperty(t)&&Ge(`Cannot register multiple overloads of a function with the same number of arguments (${t})!`),a[e].overloadTable[t]=r):(a[e]=r,void 0!==t&&(a[e].numArguments=t))},sr=(e,r,t)=>{switch(r){case 1:return t?function(e){return this.fromWireType(g[0|e])}:function(e){return this.fromWireType(y[0|e])};case 2:return t?function(e){return this.fromWireType(w[e>>1])}:function(e){return this.fromWireType(E[e>>1])};case 4:return t?function(e){return this.fromWireType(b[e>>2])}:function(e){return this.fromWireType(_[e>>2])};default:throw new TypeError(`invalid integer width (${r}): ${e}`)}},ur=(e,r,t,n)=>{function o(){}r=Ve(r),o.values={},Ye(e,{name:r,constructor:o,fromWireType:function(e){return this.constructor.values[e]},toWireType:(e,r)=>r.value,argPackAdvance:Xe,readValueFromPointer:sr(r,t,n),destructorFunction:null}),ir(r,o)},lr=48,dr=57,cr=e=>{if(void 0===e)return"_unknown";var r=(e=e.replace(/[^a-zA-Z0-9_]/g,"$")).charCodeAt(0);return r>=lr&&r<=dr?`_${e}`:e};function fr(e,r){return e=cr(e),{[e]:function(){return r.apply(this,arguments)}}[e]}var mr=e=>{var r=zo(e),t=Ve(r);return Wo(r),t},hr=(e,r)=>{var t=Ie[e];return void 0===t&&Ge(r+" has unknown type "+mr(e)),t},pr=(e,r,t)=>{var n=hr(e,"enum");r=Ve(r);var o=n.constructor,a=Object.create(n.constructor.prototype,{value:{value:t},constructor:{value:fr(`${n.name}_${r}`,(function(){}))}});o.values[t]=a,o[r]=a},vr=(e,r)=>{switch(r){case 4:return function(e){return this.fromWireType(k[e>>2])};case 8:return function(e){return this.fromWireType(x[e>>3])};default:throw new TypeError(`invalid float width (${r}): ${e}`)}},gr=(e,r,t)=>{Ye(e,{name:r=Ve(r),fromWireType:e=>e,toWireType:(e,r)=>r,argPackAdvance:Xe,readValueFromPointer:vr(r,t),destructorFunction:null})};function yr(e,r,t,n,o,a){var i=r.length;i<2&&Ge("argTypes array size mismatch! Must at least get return value and 'this' types!"),r[1];for(var s=!1,u=1;u<r.length;++u)if(null!==r[u]&&void 0===r[u].destructorFunction){s=!0;break}var l="void"!==r[0].name,d=i-2,c=new Array(d),f=[],m=[];return function(){var t;arguments.length!==d&&Ge(`function ${e} called with ${arguments.length} arguments, expected ${d}`),m.length=0,f.length=1,f[0]=o;for(var a=0;a<d;++a)c[a]=r[a+2].toWireType(m,arguments[a]),f.push(c[a]);function i(e){if(s)$e(m);else for(var n=2;n<r.length;n++){var o=1===n?t:c[n-2];null!==r[n].destructorFunction&&r[n].destructorFunction(o)}if(l)return r[0].fromWireType(e)}return i(n.apply(null,f))}}var wr,Er,br=(e,r)=>{for(var t=[],n=0;n<e;n++)t.push(_[r+4*n>>2]);return t},_r=(e,r,t)=>{a.hasOwnProperty(e)||Oe("Replacing nonexistant public symbol"),void 0!==a[e].overloadTable&&void 0!==t?a[e].overloadTable[t]=r:(a[e]=r,a[e].argCount=t)},kr=(e,r,t)=>{var n=a["dynCall_"+e];return t&&t.length?n.apply(null,[r].concat(t)):n.call(null,r)},xr=[],Fr=e=>{var r=xr[e];return r||(e>=xr.length&&(xr.length=e+1),xr[e]=r=wr.get(e)),r},Ar=(e,r,t)=>e.includes("j")?kr(e,r,t):Fr(r).apply(null,t),Pr=(e,r)=>{var t=[];return function(){return t.length=0,Object.assign(t,arguments),Ar(e,r,t)}},Sr=(e,r)=>{function t(){return e.includes("j")?Pr(e,r):Fr(r)}e=Ve(e);var n=t();return"function"!=typeof n&&Ge(`unknown function pointer with signature ${e}: ${r}`),n},Cr=(e,r)=>{var t=fr(r,(function(e){this.name=r,this.message=e;var t=new Error(e).stack;void 0!==t&&(this.stack=this.toString()+"\n"+t.replace(/^Error(:[^\n]*)?\n/,""))}));return t.prototype=Object.create(e.prototype),t.prototype.constructor=t,t.prototype.toString=function(){return void 0===this.message?this.name:`${this.name}: ${this.message}`},t},Dr=(e,r)=>{var t=[],n={};function o(e){n[e]||Ie[e]||(He[e]?He[e].forEach(o):(t.push(e),n[e]=!0))}throw r.forEach(o),new Er(`${e}: `+t.map(mr).join([", "]))},Tr=e=>{const r=(e=e.trim()).indexOf("(");return-1!==r?(A(")"==e[e.length-1],"Parentheses for argument names should match."),e.substr(0,r)):e},$r=(e,r,t,n,o,a,i)=>{var s=br(r,t);e=Ve(e),e=Tr(e),o=Sr(n,o),ir(e,(function(){Dr(`Cannot call ${e} due to unbound types`,s)}),r-1),We([],s,(function(t){var n=[t[0],null].concat(t.slice(1));return _r(e,yr(e,n,null,o,a),r-1),[]}))},jr=(e,r,t)=>{switch(r){case 1:return t?e=>g[0|e]:e=>y[0|e];case 2:return t?e=>w[e>>1]:e=>E[e>>1];case 4:return t?e=>b[e>>2]:e=>_[e>>2];default:throw new TypeError(`invalid integer width (${r}): ${e}`)}},Mr=(e,r,t,n,o)=>{r=Ve(r);var a=e=>e;if(0===n){var i=32-8*t;a=e=>e<<i>>>i}var s=r.includes("unsigned"),u=(e,r)=>{};Ye(e,{name:r,fromWireType:a,toWireType:s?function(e,r){return u(r,this.name),r>>>0}:function(e,r){return u(r,this.name),r},argPackAdvance:Xe,readValueFromPointer:jr(r,t,0!==n),destructorFunction:null})},Br=(e,r,t)=>{var n=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array][r];function o(e){var r=_[e>>2],t=_[e+4>>2];return new n(g.buffer,t,r)}Ye(e,{name:t=Ve(t),fromWireType:o,argPackAdvance:Xe,readValueFromPointer:o},{ignoreDuplicateRegistrations:!0})};function Lr(e){return this.fromWireType(_[e>>2])}var Rr=(e,r,t)=>me(e,y,r,t),Ir=(e,r)=>{var t="std::string"===(r=Ve(r));Ye(e,{name:r,fromWireType(e){var r,n=_[e>>2],o=e+4;if(t)for(var a=o,i=0;i<=n;++i){var s=o+i;if(i==n||0==y[s]){var u=te(a,s-a);void 0===r?r=u:(r+=String.fromCharCode(0),r+=u),a=s+1}}else{var l=new Array(n);for(i=0;i<n;++i)l[i]=String.fromCharCode(y[o+i]);r=l.join("")}return Wo(e),r},toWireType(e,r){var n;r instanceof ArrayBuffer&&(r=new Uint8Array(r));var o="string"==typeof r;o||r instanceof Uint8Array||r instanceof Uint8ClampedArray||r instanceof Int8Array||Ge("Cannot pass non-string to std::string"),n=t&&o?fe(r):r.length;var a=No(4+n+1),i=a+4;if(_[a>>2]=n,t&&o)Rr(r,i,n+1);else if(o)for(var s=0;s<n;++s){var u=r.charCodeAt(s);u>255&&(Wo(i),Ge("String has UTF-16 code units that do not fit in 8 bits")),y[i+s]=u}else for(s=0;s<n;++s)y[i+s]=r[s];return null!==e&&e.push(Wo,a),a},argPackAdvance:Xe,readValueFromPointer:Lr,destructorFunction(e){Wo(e)}})},Hr="undefined"!=typeof TextDecoder?new TextDecoder("utf-16le"):void 0,Or=(e,r)=>{for(var t=e,n=t>>1,o=n+r/2;!(n>=o)&&E[n];)++n;if((t=n<<1)-e>32&&Hr)return Hr.decode(y.subarray(e,t));for(var a="",i=0;!(i>=r/2);++i){var s=w[e+2*i>>1];if(0==s)break;a+=String.fromCharCode(s)}return a},Wr=(e,r,t)=>{if(void 0===t&&(t=2147483647),t<2)return 0;for(var n=r,o=(t-=2)<2*e.length?t/2:e.length,a=0;a<o;++a){var i=e.charCodeAt(a);w[r>>1]=i,r+=2}return w[r>>1]=0,r-n},Nr=e=>2*e.length,zr=(e,r)=>{for(var t=0,n="";!(t>=r/4);){var o=b[e+4*t>>2];if(0==o)break;if(++t,o>=65536){var a=o-65536;n+=String.fromCharCode(55296|a>>10,56320|1023&a)}else n+=String.fromCharCode(o)}return n},Ur=(e,r,t)=>{if(void 0===t&&(t=2147483647),t<4)return 0;for(var n=r,o=n+t-4,a=0;a<e.length;++a){var i=e.charCodeAt(a);if(i>=55296&&i<=57343&&(i=65536+((1023&i)<<10)|1023&e.charCodeAt(++a)),b[r>>2]=i,(r+=4)+4>o)break}return b[r>>2]=0,r-n},Vr=e=>{for(var r=0,t=0;t<e.length;++t){var n=e.charCodeAt(t);n>=55296&&n<=57343&&++t,r+=4}return r},Gr=(e,r,t)=>{var n,o,a,i,s;t=Ve(t),2===r?(n=Or,o=Wr,i=Nr,a=()=>E,s=1):4===r&&(n=zr,o=Ur,i=Vr,a=()=>_,s=2),Ye(e,{name:t,fromWireType:e=>{for(var t,o=_[e>>2],i=a(),u=e+4,l=0;l<=o;++l){var d=e+4+l*r;if(l==o||0==i[d>>s]){var c=n(u,d-u);void 0===t?t=c:(t+=String.fromCharCode(0),t+=c),u=d+r}}return Wo(e),t},toWireType:(e,n)=>{"string"!=typeof n&&Ge(`Cannot pass non-string to C++ string type ${t}`);var a=i(n),u=No(4+a+r);return _[u>>2]=a>>s,o(n,u+4,a+r),null!==e&&e.push(Wo,u),u},argPackAdvance:Xe,readValueFromPointer:je,destructorFunction(e){Wo(e)}})},qr=(e,r,t,n,o,a)=>{Te[e]={name:Ve(r),rawConstructor:Sr(t,n),rawDestructor:Sr(o,a),fields:[]}},Yr=(e,r,t,n,o,a,i,s,u,l)=>{Te[e].fields.push({fieldName:Ve(r),getterReturnType:t,getter:Sr(n,o),getterContext:a,setterArgumentType:i,setter:Sr(s,u),setterContext:l})},Xr=(e,r)=>{Ye(e,{isVoid:!0,name:r=Ve(r),argPackAdvance:0,fromWireType:()=>{},toWireType:(e,r)=>{}})},Qr=e=>{do{var r=_[e>>2],t=_[(e+=4)>>2],n=_[(e+=4)>>2];e+=4;var o=te(r);Ae.createPath("/",se.dirname(o),!0,!0),Ae.createDataFile(o,null,g.subarray(n,n+t),!0,!0,!0)}while(_[e>>2])},Jr=(e,r,t)=>{e=nr.toValue(e),r=hr(r,"emval::as");var n=[],o=nr.toHandle(n);return _[t>>2]=o,r.toWireType(n,e)},Kr={},Zr=e=>{var r=Kr[e];return void 0===r?Ve(e):r},et=[],rt=(e,r,t,n,o)=>{var a=[],i=(e=et[e])(