scanbot-web-sdk
Version:
Scanbot Web Document and Barcode Scanner SDK
1 lines • 121 kB
JavaScript
!function(t){var e={};function r(n){if(e[n])return e[n].exports;var o=e[n]={i:n,l:!1,exports:{}};return t[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}r.m=t,r.c=e,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)r.d(n,o,function(e){return t[e]}.bind(null,o));return n},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=5)}([function(t,e,r){"use strict";(function(t){function n(t,e=!1){const r=[];if(e)return r;return function t(e){if(e)if(e.constructor===ImageData)r.push(e.data.buffer);else if(e.constructor===ArrayBuffer)r.push(e);else if(ArrayBuffer.isView(e))r.push(e.buffer);else if(Array.isArray(e))for(let r=0;r<e.length;++r)t(e[r]);else if("object"==typeof e)for(const r in e)e.hasOwnProperty(r)&&t(e[r])}(t),r}function o(t){return t.startsWith("http:")||t.startsWith("https:")}function i(e){const{allowSimd:r=!0,allowThreads:n=!0}=e||{};let o="";if(r&&function(){try{const t=WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,10,9,1,7,0,65,0,253,15,26,11])),e=WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,5,3,1,0,1,11,9,1,0,65,1,65,2,106,11,0]));return t&&e}catch(t){return!1}}()){o+="-simd";n&&function(){if("undefined"!=typeof t&&"undefined"!=typeof t.versions&&"undefined"!=typeof t.versions.node)return!1;if(/(iPad|iPhone|iPod)/g.test(navigator.userAgent))return!1;try{return(new MessageChannel).port1.postMessage(new SharedArrayBuffer(1)),WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,5,4,1,3,1,1,10,11,1,9,0,65,0,254,16,2,0,26,11]))}catch(t){return!1}}()&&(o+="-threads")}return o}r.d(e,"a",(function(){return n})),r.d(e,"c",(function(){return o})),r.d(e,"b",(function(){return i}))}).call(this,r(1))},function(t,e){var r,n,o=t.exports={};function i(){throw new Error("setTimeout has not been defined")}function a(){throw new Error("clearTimeout has not been defined")}function s(t){if(r===setTimeout)return setTimeout(t,0);if((r===i||!r)&&setTimeout)return r=setTimeout,setTimeout(t,0);try{return r(t,0)}catch(e){try{return r.call(null,t,0)}catch(e){return r.call(this,t,0)}}}!function(){try{r="function"==typeof setTimeout?setTimeout:i}catch(t){r=i}try{n="function"==typeof clearTimeout?clearTimeout:a}catch(t){n=a}}();var u,c=[],l=!1,d=-1;function h(){l&&u&&(l=!1,u.length?c=u.concat(c):d=-1,c.length&&f())}function f(){if(!l){var t=s(h);l=!0;for(var e=c.length;e;){for(u=c,c=[];++d<e;)u&&u[d].run();d=-1,e=c.length}u=null,l=!1,function(t){if(n===clearTimeout)return clearTimeout(t);if((n===a||!n)&&clearTimeout)return n=clearTimeout,clearTimeout(t);try{n(t)}catch(e){try{return n.call(null,t)}catch(e){return n.call(this,t)}}}(t)}}function p(t,e){this.fun=t,this.array=e}function m(){}o.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)e[r-1]=arguments[r];c.push(new p(t,e)),1!==c.length||l||s(f)},p.prototype.run=function(){this.fun.apply(null,this.array)},o.title="browser",o.browser=!0,o.env={},o.argv=[],o.version="",o.versions={},o.on=m,o.addListener=m,o.once=m,o.off=m,o.removeListener=m,o.removeAllListeners=m,o.emit=m,o.prependListener=m,o.prependOnceListener=m,o.listeners=function(t){return[]},o.binding=function(t){throw new Error("process.binding is not supported")},o.cwd=function(){return"/"},o.chdir=function(t){throw new Error("process.chdir is not supported")},o.umask=function(){return 0}},function(t,e,r){(function(e){var r,n=(r="undefined"!=typeof document&&document.currentScript?document.currentScript.src:void 0,function(t={}){var n,o,i=t;i.ready=new Promise(((t,e)=>{n=t,o=e}));var a,s,u,c=Object.assign({},i),l="./this.program",d=(t,e)=>{throw e},h="";h=self.location.href,r&&(h=r),h=0!==h.indexOf("blob:")?h.substr(0,h.replace(/[?#].*/,"").lastIndexOf("/")+1):"",a=t=>{var e=new XMLHttpRequest;return e.open("GET",t,!1),e.send(null),e.responseText},u=t=>{var e=new XMLHttpRequest;return e.open("GET",t,!1),e.responseType="arraybuffer",e.send(null),new Uint8Array(e.response)},s=(t,e,r)=>{var n=new XMLHttpRequest;n.open("GET",t,!0),n.responseType="arraybuffer",n.onload=()=>{200==n.status||0==n.status&&n.response?e(n.response):r()},n.onerror=r,n.send(null)};var f,p=i.print||console.log.bind(console),m=i.printErr||console.error.bind(console);Object.assign(i,c),c=null,i.arguments&&i.arguments,i.thisProgram&&(l=i.thisProgram),i.quit&&(d=i.quit),i.wasmBinary&&(f=i.wasmBinary);var v,y=i.noExitRuntime||!0;"object"!=typeof WebAssembly&&U("no native wasm support detected");var g,w,b,E,_,M,k,C,P,$=!1;function T(){var t=v.buffer;i.HEAP8=g=new Int8Array(t),i.HEAP16=b=new Int16Array(t),i.HEAPU8=w=new Uint8Array(t),i.HEAPU16=E=new Uint16Array(t),i.HEAP32=_=new Int32Array(t),i.HEAPU32=M=new Uint32Array(t),i.HEAPF32=k=new Float32Array(t),i.HEAPF64=C=new Float64Array(t)}var j,S,F,D,W=[],A=[],O=[],x=0,I=null,R=null;function z(t){x++,i.monitorRunDependencies&&i.monitorRunDependencies(x)}function N(t){if(x--,i.monitorRunDependencies&&i.monitorRunDependencies(x),0==x&&(null!==I&&(clearInterval(I),I=null),R)){var e=R;R=null,e()}}function U(t){i.onAbort&&i.onAbort(t),m(t="Aborted("+t+")"),$=!0,t+=". Build with -sASSERTIONS for more info.";var e=new WebAssembly.RuntimeError(t);throw o(e),e}function L(t){return t.startsWith("data:application/octet-stream;base64,")}function B(t){if(t==j&&f)return new Uint8Array(f);if(u)return u(t);throw"both async and sync fetching of the wasm failed"}function H(t,e,r){return function(t){return f||"function"!=typeof fetch?Promise.resolve().then((()=>B(t))):fetch(t,{credentials:"same-origin"}).then((e=>{if(!e.ok)throw"failed to load wasm binary file at '"+t+"'";return e.arrayBuffer()})).catch((()=>B(t)))}(t).then((t=>WebAssembly.instantiate(t,e))).then((t=>t)).then(r,(t=>{m(`failed to asynchronously prepare wasm: ${t}`),U(t)}))}L(j="ScanbotSDK.Asm.wasm")||(S=j,j=i.locateFile?i.locateFile(S,h):h+S);var V={1557832:t=>mr(function(){return this[vt(t)].toString()}.apply(function(){return this}.call(void 0)))};function Y(t){this.name="ExitStatus",this.message=`Program terminated with exit(${t})`,this.status=t}var q=t=>{for(;t.length>0;)t.shift()(i)},G=[],K=0,Q=0;function J(t){this.excPtr=t,this.ptr=t-24,this.set_type=function(t){M[this.ptr+4>>2]=t},this.get_type=function(){return M[this.ptr+4>>2]},this.set_destructor=function(t){M[this.ptr+8>>2]=t},this.get_destructor=function(){return M[this.ptr+8>>2]},this.set_caught=function(t){t=t?1:0,g[this.ptr+12>>0]=t},this.get_caught=function(){return 0!=g[this.ptr+12>>0]},this.set_rethrown=function(t){t=t?1:0,g[this.ptr+13>>0]=t},this.get_rethrown=function(){return 0!=g[this.ptr+13>>0]},this.init=function(t,e){this.set_adjusted_ptr(0),this.set_type(t),this.set_destructor(e)},this.set_adjusted_ptr=function(t){M[this.ptr+16>>2]=t},this.get_adjusted_ptr=function(){return M[this.ptr+16>>2]},this.get_exception_ptr=function(){if(Ar(this.get_type()))return M[this.excPtr>>2];var t=this.get_adjusted_ptr();return 0!==t?t:this.excPtr}}var X=t=>{var e=Q;if(!e)return Cr(0),0;var r=new J(e);r.set_adjusted_ptr(e);var n=r.get_type();if(!n)return Cr(0),e;for(var o in t){var i=t[o];if(0===i||i===n)break;var a=r.ptr+16;if(Wr(i,n,a))return Cr(i),e}return Cr(n),e},Z=()=>{var t=G.pop();t||U("no exception to throw");var e=t.excPtr;throw t.get_rethrown()||(G.push(t),t.set_rethrown(!0),t.set_caught(!1),K++),Q=e},tt={isAbs:t=>"/"===t.charAt(0),splitPath:t=>/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/.exec(t).slice(1),normalizeArray:(t,e)=>{for(var r=0,n=t.length-1;n>=0;n--){var o=t[n];"."===o?t.splice(n,1):".."===o?(t.splice(n,1),r++):r&&(t.splice(n,1),r--)}if(e)for(;r;r--)t.unshift("..");return t},normalize:t=>{var e=tt.isAbs(t),r="/"===t.substr(-1);return(t=tt.normalizeArray(t.split("/").filter((t=>!!t)),!e).join("/"))||e||(t="."),t&&r&&(t+="/"),(e?"/":"")+t},dirname:t=>{var e=tt.splitPath(t),r=e[0],n=e[1];return r||n?(n&&(n=n.substr(0,n.length-1)),r+n):"."},basename:t=>{if("/"===t)return"/";var e=(t=(t=tt.normalize(t)).replace(/\/$/,"")).lastIndexOf("/");return-1===e?t:t.substr(e+1)},join:function(){var t=Array.prototype.slice.call(arguments);return tt.normalize(t.join("/"))},join2:(t,e)=>tt.normalize(t+"/"+e)},et=t=>(et=(()=>{if("object"==typeof crypto&&"function"==typeof crypto.getRandomValues)return t=>crypto.getRandomValues(t);U("initRandomDevice")})())(t),rt={resolve:function(){for(var t="",e=!1,r=arguments.length-1;r>=-1&&!e;r--){var n=r>=0?arguments[r]:mt.cwd();if("string"!=typeof n)throw new TypeError("Arguments to path.resolve must be strings");if(!n)return"";t=n+"/"+t,e=tt.isAbs(n)}return(e?"/":"")+(t=tt.normalizeArray(t.split("/").filter((t=>!!t)),!e).join("/"))||"."},relative:(t,e)=>{function r(t){for(var e=0;e<t.length&&""===t[e];e++);for(var r=t.length-1;r>=0&&""===t[r];r--);return e>r?[]:t.slice(e,r-e+1)}t=rt.resolve(t).substr(1),e=rt.resolve(e).substr(1);for(var n=r(t.split("/")),o=r(e.split("/")),i=Math.min(n.length,o.length),a=i,s=0;s<i;s++)if(n[s]!==o[s]){a=s;break}var u=[];for(s=a;s<n.length;s++)u.push("..");return(u=u.concat(o.slice(a))).join("/")}},nt="undefined"!=typeof TextDecoder?new TextDecoder("utf8"):void 0,ot=(t,e,r)=>{for(var n=e+r,o=e;t[o]&&!(o>=n);)++o;if(o-e>16&&t.buffer&&nt)return nt.decode(t.subarray(e,o));for(var i="";e<o;){var a=t[e++];if(128&a){var s=63&t[e++];if(192!=(224&a)){var u=63&t[e++];if((a=224==(240&a)?(15&a)<<12|s<<6|u:(7&a)<<18|s<<12|u<<6|63&t[e++])<65536)i+=String.fromCharCode(a);else{var c=a-65536;i+=String.fromCharCode(55296|c>>10,56320|1023&c)}}else i+=String.fromCharCode((31&a)<<6|s)}else i+=String.fromCharCode(a)}return i},it=[],at=t=>{for(var e=0,r=0;r<t.length;++r){var n=t.charCodeAt(r);n<=127?e++:n<=2047?e+=2:n>=55296&&n<=57343?(e+=4,++r):e+=3}return e},st=(t,e,r,n)=>{if(!(n>0))return 0;for(var o=r,i=r+n-1,a=0;a<t.length;++a){var s=t.charCodeAt(a);if(s>=55296&&s<=57343&&(s=65536+((1023&s)<<10)|1023&t.charCodeAt(++a)),s<=127){if(r>=i)break;e[r++]=s}else if(s<=2047){if(r+1>=i)break;e[r++]=192|s>>6,e[r++]=128|63&s}else if(s<=65535){if(r+2>=i)break;e[r++]=224|s>>12,e[r++]=128|s>>6&63,e[r++]=128|63&s}else{if(r+3>=i)break;e[r++]=240|s>>18,e[r++]=128|s>>12&63,e[r++]=128|s>>6&63,e[r++]=128|63&s}}return e[r]=0,r-o};function ut(t,e,r){var n=r>0?r:at(t)+1,o=new Array(n),i=st(t,o,0,o.length);return e&&(o.length=i),o}var ct={ttys:[],init(){},shutdown(){},register(t,e){ct.ttys[t]={input:[],output:[],ops:e},mt.registerDevice(t,ct.stream_ops)},stream_ops:{open(t){var e=ct.ttys[t.node.rdev];if(!e)throw new mt.ErrnoError(43);t.tty=e,t.seekable=!1},close(t){t.tty.ops.fsync(t.tty)},fsync(t){t.tty.ops.fsync(t.tty)},read(t,e,r,n,o){if(!t.tty||!t.tty.ops.get_char)throw new mt.ErrnoError(60);for(var i=0,a=0;a<n;a++){var s;try{s=t.tty.ops.get_char(t.tty)}catch(t){throw new mt.ErrnoError(29)}if(void 0===s&&0===i)throw new mt.ErrnoError(6);if(null==s)break;i++,e[r+a]=s}return i&&(t.node.timestamp=Date.now()),i},write(t,e,r,n,o){if(!t.tty||!t.tty.ops.put_char)throw new mt.ErrnoError(60);try{for(var i=0;i<n;i++)t.tty.ops.put_char(t.tty,e[r+i])}catch(t){throw new mt.ErrnoError(29)}return n&&(t.node.timestamp=Date.now()),i}},default_tty_ops:{get_char:t=>(()=>{if(!it.length){var t=null;if("undefined"!=typeof window&&"function"==typeof window.prompt?null!==(t=window.prompt("Input: "))&&(t+="\n"):"function"==typeof readline&&null!==(t=readline())&&(t+="\n"),!t)return null;it=ut(t,!0)}return it.shift()})(),put_char(t,e){null===e||10===e?(p(ot(t.output,0)),t.output=[]):0!=e&&t.output.push(e)},fsync(t){t.output&&t.output.length>0&&(p(ot(t.output,0)),t.output=[])},ioctl_tcgets:t=>({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:(t,e,r)=>0,ioctl_tiocgwinsz:t=>[24,80]},default_tty1_ops:{put_char(t,e){null===e||10===e?(m(ot(t.output,0)),t.output=[]):0!=e&&t.output.push(e)},fsync(t){t.output&&t.output.length>0&&(m(ot(t.output,0)),t.output=[])}}},lt=t=>{t=((t,e)=>Math.ceil(t/e)*e)(t,65536);var e=$r(65536,t);return e?((t,e)=>(w.fill(0,t,t+e),t))(e,t):0},dt={ops_table:null,mount:t=>dt.createNode(null,"/",16895,0),createNode(t,e,r,n){if(mt.isBlkdev(r)||mt.isFIFO(r))throw new mt.ErrnoError(63);dt.ops_table||(dt.ops_table={dir:{node:{getattr:dt.node_ops.getattr,setattr:dt.node_ops.setattr,lookup:dt.node_ops.lookup,mknod:dt.node_ops.mknod,rename:dt.node_ops.rename,unlink:dt.node_ops.unlink,rmdir:dt.node_ops.rmdir,readdir:dt.node_ops.readdir,symlink:dt.node_ops.symlink},stream:{llseek:dt.stream_ops.llseek}},file:{node:{getattr:dt.node_ops.getattr,setattr:dt.node_ops.setattr},stream:{llseek:dt.stream_ops.llseek,read:dt.stream_ops.read,write:dt.stream_ops.write,allocate:dt.stream_ops.allocate,mmap:dt.stream_ops.mmap,msync:dt.stream_ops.msync}},link:{node:{getattr:dt.node_ops.getattr,setattr:dt.node_ops.setattr,readlink:dt.node_ops.readlink},stream:{}},chrdev:{node:{getattr:dt.node_ops.getattr,setattr:dt.node_ops.setattr},stream:mt.chrdev_stream_ops}});var o=mt.createNode(t,e,r,n);return mt.isDir(o.mode)?(o.node_ops=dt.ops_table.dir.node,o.stream_ops=dt.ops_table.dir.stream,o.contents={}):mt.isFile(o.mode)?(o.node_ops=dt.ops_table.file.node,o.stream_ops=dt.ops_table.file.stream,o.usedBytes=0,o.contents=null):mt.isLink(o.mode)?(o.node_ops=dt.ops_table.link.node,o.stream_ops=dt.ops_table.link.stream):mt.isChrdev(o.mode)&&(o.node_ops=dt.ops_table.chrdev.node,o.stream_ops=dt.ops_table.chrdev.stream),o.timestamp=Date.now(),t&&(t.contents[e]=o,t.timestamp=o.timestamp),o},getFileDataAsTypedArray:t=>t.contents?t.contents.subarray?t.contents.subarray(0,t.usedBytes):new Uint8Array(t.contents):new Uint8Array(0),expandFileStorage(t,e){var r=t.contents?t.contents.length:0;if(!(r>=e)){e=Math.max(e,r*(r<1048576?2:1.125)>>>0),0!=r&&(e=Math.max(e,256));var n=t.contents;t.contents=new Uint8Array(e),t.usedBytes>0&&t.contents.set(n.subarray(0,t.usedBytes),0)}},resizeFileStorage(t,e){if(t.usedBytes!=e)if(0==e)t.contents=null,t.usedBytes=0;else{var r=t.contents;t.contents=new Uint8Array(e),r&&t.contents.set(r.subarray(0,Math.min(e,t.usedBytes))),t.usedBytes=e}},node_ops:{getattr(t){var e={};return e.dev=mt.isChrdev(t.mode)?t.id:1,e.ino=t.id,e.mode=t.mode,e.nlink=1,e.uid=0,e.gid=0,e.rdev=t.rdev,mt.isDir(t.mode)?e.size=4096:mt.isFile(t.mode)?e.size=t.usedBytes:mt.isLink(t.mode)?e.size=t.link.length:e.size=0,e.atime=new Date(t.timestamp),e.mtime=new Date(t.timestamp),e.ctime=new Date(t.timestamp),e.blksize=4096,e.blocks=Math.ceil(e.size/e.blksize),e},setattr(t,e){void 0!==e.mode&&(t.mode=e.mode),void 0!==e.timestamp&&(t.timestamp=e.timestamp),void 0!==e.size&&dt.resizeFileStorage(t,e.size)},lookup(t,e){throw mt.genericErrors[44]},mknod:(t,e,r,n)=>dt.createNode(t,e,r,n),rename(t,e,r){if(mt.isDir(t.mode)){var n;try{n=mt.lookupNode(e,r)}catch(t){}if(n)for(var o in n.contents)throw new mt.ErrnoError(55)}delete t.parent.contents[t.name],t.parent.timestamp=Date.now(),t.name=r,e.contents[r]=t,e.timestamp=t.parent.timestamp,t.parent=e},unlink(t,e){delete t.contents[e],t.timestamp=Date.now()},rmdir(t,e){var r=mt.lookupNode(t,e);for(var n in r.contents)throw new mt.ErrnoError(55);delete t.contents[e],t.timestamp=Date.now()},readdir(t){var e=[".",".."];for(var r in t.contents)t.contents.hasOwnProperty(r)&&e.push(r);return e},symlink(t,e,r){var n=dt.createNode(t,e,41471,0);return n.link=r,n},readlink(t){if(!mt.isLink(t.mode))throw new mt.ErrnoError(28);return t.link}},stream_ops:{read(t,e,r,n,o){var i=t.node.contents;if(o>=t.node.usedBytes)return 0;var a=Math.min(t.node.usedBytes-o,n);if(a>8&&i.subarray)e.set(i.subarray(o,o+a),r);else for(var s=0;s<a;s++)e[r+s]=i[o+s];return a},write(t,e,r,n,o,i){if(e.buffer===g.buffer&&(i=!1),!n)return 0;var a=t.node;if(a.timestamp=Date.now(),e.subarray&&(!a.contents||a.contents.subarray)){if(i)return a.contents=e.subarray(r,r+n),a.usedBytes=n,n;if(0===a.usedBytes&&0===o)return a.contents=e.slice(r,r+n),a.usedBytes=n,n;if(o+n<=a.usedBytes)return a.contents.set(e.subarray(r,r+n),o),n}if(dt.expandFileStorage(a,o+n),a.contents.subarray&&e.subarray)a.contents.set(e.subarray(r,r+n),o);else for(var s=0;s<n;s++)a.contents[o+s]=e[r+s];return a.usedBytes=Math.max(a.usedBytes,o+n),n},llseek(t,e,r){var n=e;if(1===r?n+=t.position:2===r&&mt.isFile(t.node.mode)&&(n+=t.node.usedBytes),n<0)throw new mt.ErrnoError(28);return n},allocate(t,e,r){dt.expandFileStorage(t.node,e+r),t.node.usedBytes=Math.max(t.node.usedBytes,e+r)},mmap(t,e,r,n,o){if(!mt.isFile(t.node.mode))throw new mt.ErrnoError(43);var i,a,s=t.node.contents;if(2&o||s.buffer!==g.buffer){if((r>0||r+e<s.length)&&(s=s.subarray?s.subarray(r,r+e):Array.prototype.slice.call(s,r,r+e)),a=!0,!(i=lt(e)))throw new mt.ErrnoError(48);g.set(s,i)}else a=!1,i=s.byteOffset;return{ptr:i,allocated:a}},msync:(t,e,r,n,o)=>(dt.stream_ops.write(t,e,0,n,r,!1),0)}},ht=(t,e,r,n)=>{var o=n?"":`al ${t}`;s(t,(r=>{var n;n=`Loading data file "${t}" failed (no arrayBuffer).`,r||U(n),e(new Uint8Array(r)),o&&N()}),(e=>{if(!r)throw`Loading data file "${t}" failed.`;r()})),o&&z()},ft=i.preloadPlugins||[],pt=(t,e)=>{var r=0;return t&&(r|=365),e&&(r|=146),r},mt={root:null,mounts:[],devices:{},streams:[],nextInode:1,nameTable:null,currentPath:"/",initialized:!1,ignorePermissions:!0,ErrnoError:null,genericErrors:{},filesystems:null,syncFSRequests:0,lookupPath(t,e={}){if(!(t=rt.resolve(t)))return{path:"",node:null};if((e=Object.assign({follow_mount:!0,recurse_count:0},e)).recurse_count>8)throw new mt.ErrnoError(32);for(var r=t.split("/").filter((t=>!!t)),n=mt.root,o="/",i=0;i<r.length;i++){var a=i===r.length-1;if(a&&e.parent)break;if(n=mt.lookupNode(n,r[i]),o=tt.join2(o,r[i]),mt.isMountpoint(n)&&(!a||a&&e.follow_mount)&&(n=n.mounted.root),!a||e.follow)for(var s=0;mt.isLink(n.mode);){var u=mt.readlink(o);if(o=rt.resolve(tt.dirname(o),u),n=mt.lookupPath(o,{recurse_count:e.recurse_count+1}).node,s++>40)throw new mt.ErrnoError(32)}}return{path:o,node:n}},getPath(t){for(var e;;){if(mt.isRoot(t)){var r=t.mount.mountpoint;return e?"/"!==r[r.length-1]?`${r}/${e}`:r+e:r}e=e?`${t.name}/${e}`:t.name,t=t.parent}},hashName(t,e){for(var r=0,n=0;n<e.length;n++)r=(r<<5)-r+e.charCodeAt(n)|0;return(t+r>>>0)%mt.nameTable.length},hashAddNode(t){var e=mt.hashName(t.parent.id,t.name);t.name_next=mt.nameTable[e],mt.nameTable[e]=t},hashRemoveNode(t){var e=mt.hashName(t.parent.id,t.name);if(mt.nameTable[e]===t)mt.nameTable[e]=t.name_next;else for(var r=mt.nameTable[e];r;){if(r.name_next===t){r.name_next=t.name_next;break}r=r.name_next}},lookupNode(t,e){var r=mt.mayLookup(t);if(r)throw new mt.ErrnoError(r,t);for(var n=mt.hashName(t.id,e),o=mt.nameTable[n];o;o=o.name_next){var i=o.name;if(o.parent.id===t.id&&i===e)return o}return mt.lookup(t,e)},createNode(t,e,r,n){var o=new mt.FSNode(t,e,r,n);return mt.hashAddNode(o),o},destroyNode(t){mt.hashRemoveNode(t)},isRoot:t=>t===t.parent,isMountpoint:t=>!!t.mounted,isFile:t=>32768==(61440&t),isDir:t=>16384==(61440&t),isLink:t=>40960==(61440&t),isChrdev:t=>8192==(61440&t),isBlkdev:t=>24576==(61440&t),isFIFO:t=>4096==(61440&t),isSocket:t=>49152==(49152&t),flagsToPermissionString(t){var e=["r","w","rw"][3&t];return 512&t&&(e+="w"),e},nodePermissions:(t,e)=>mt.ignorePermissions||(!e.includes("r")||292&t.mode)&&(!e.includes("w")||146&t.mode)&&(!e.includes("x")||73&t.mode)?0:2,mayLookup(t){var e=mt.nodePermissions(t,"x");return e||(t.node_ops.lookup?0:2)},mayCreate(t,e){try{return mt.lookupNode(t,e),20}catch(t){}return mt.nodePermissions(t,"wx")},mayDelete(t,e,r){var n;try{n=mt.lookupNode(t,e)}catch(t){return t.errno}var o=mt.nodePermissions(t,"wx");if(o)return o;if(r){if(!mt.isDir(n.mode))return 54;if(mt.isRoot(n)||mt.getPath(n)===mt.cwd())return 10}else if(mt.isDir(n.mode))return 31;return 0},mayOpen:(t,e)=>t?mt.isLink(t.mode)?32:mt.isDir(t.mode)&&("r"!==mt.flagsToPermissionString(e)||512&e)?31:mt.nodePermissions(t,mt.flagsToPermissionString(e)):44,MAX_OPEN_FDS:4096,nextfd(){for(var t=0;t<=mt.MAX_OPEN_FDS;t++)if(!mt.streams[t])return t;throw new mt.ErrnoError(33)},getStreamChecked(t){var e=mt.getStream(t);if(!e)throw new mt.ErrnoError(8);return e},getStream:t=>mt.streams[t],createStream:(t,e=-1)=>(mt.FSStream||(mt.FSStream=function(){this.shared={}},mt.FSStream.prototype={},Object.defineProperties(mt.FSStream.prototype,{object:{get(){return this.node},set(t){this.node=t}},isRead:{get(){return 1!=(2097155&this.flags)}},isWrite:{get(){return 0!=(2097155&this.flags)}},isAppend:{get(){return 1024&this.flags}},flags:{get(){return this.shared.flags},set(t){this.shared.flags=t}},position:{get(){return this.shared.position},set(t){this.shared.position=t}}})),t=Object.assign(new mt.FSStream,t),-1==e&&(e=mt.nextfd()),t.fd=e,mt.streams[e]=t,t),closeStream(t){mt.streams[t]=null},chrdev_stream_ops:{open(t){var e=mt.getDevice(t.node.rdev);t.stream_ops=e.stream_ops,t.stream_ops.open&&t.stream_ops.open(t)},llseek(){throw new mt.ErrnoError(70)}},major:t=>t>>8,minor:t=>255&t,makedev:(t,e)=>t<<8|e,registerDevice(t,e){mt.devices[t]={stream_ops:e}},getDevice:t=>mt.devices[t],getMounts(t){for(var e=[],r=[t];r.length;){var n=r.pop();e.push(n),r.push.apply(r,n.mounts)}return e},syncfs(t,e){"function"==typeof t&&(e=t,t=!1),mt.syncFSRequests++,mt.syncFSRequests>1&&m(`warning: ${mt.syncFSRequests} FS.syncfs operations in flight at once, probably just doing extra work`);var r=mt.getMounts(mt.root.mount),n=0;function o(t){return mt.syncFSRequests--,e(t)}function i(t){if(t)return i.errored?void 0:(i.errored=!0,o(t));++n>=r.length&&o(null)}r.forEach((e=>{if(!e.type.syncfs)return i(null);e.type.syncfs(e,t,i)}))},mount(t,e,r){var n,o="/"===r,i=!r;if(o&&mt.root)throw new mt.ErrnoError(10);if(!o&&!i){var a=mt.lookupPath(r,{follow_mount:!1});if(r=a.path,n=a.node,mt.isMountpoint(n))throw new mt.ErrnoError(10);if(!mt.isDir(n.mode))throw new mt.ErrnoError(54)}var s={type:t,opts:e,mountpoint:r,mounts:[]},u=t.mount(s);return u.mount=s,s.root=u,o?mt.root=u:n&&(n.mounted=s,n.mount&&n.mount.mounts.push(s)),u},unmount(t){var e=mt.lookupPath(t,{follow_mount:!1});if(!mt.isMountpoint(e.node))throw new mt.ErrnoError(28);var r=e.node,n=r.mounted,o=mt.getMounts(n);Object.keys(mt.nameTable).forEach((t=>{for(var e=mt.nameTable[t];e;){var r=e.name_next;o.includes(e.mount)&&mt.destroyNode(e),e=r}})),r.mounted=null;var i=r.mount.mounts.indexOf(n);r.mount.mounts.splice(i,1)},lookup:(t,e)=>t.node_ops.lookup(t,e),mknod(t,e,r){var n=mt.lookupPath(t,{parent:!0}).node,o=tt.basename(t);if(!o||"."===o||".."===o)throw new mt.ErrnoError(28);var i=mt.mayCreate(n,o);if(i)throw new mt.ErrnoError(i);if(!n.node_ops.mknod)throw new mt.ErrnoError(63);return n.node_ops.mknod(n,o,e,r)},create:(t,e)=>(e=void 0!==e?e:438,e&=4095,e|=32768,mt.mknod(t,e,0)),mkdir:(t,e)=>(e=void 0!==e?e:511,e&=1023,e|=16384,mt.mknod(t,e,0)),mkdirTree(t,e){for(var r=t.split("/"),n="",o=0;o<r.length;++o)if(r[o]){n+="/"+r[o];try{mt.mkdir(n,e)}catch(t){if(20!=t.errno)throw t}}},mkdev:(t,e,r)=>("undefined"==typeof r&&(r=e,e=438),e|=8192,mt.mknod(t,e,r)),symlink(t,e){if(!rt.resolve(t))throw new mt.ErrnoError(44);var r=mt.lookupPath(e,{parent:!0}).node;if(!r)throw new mt.ErrnoError(44);var n=tt.basename(e),o=mt.mayCreate(r,n);if(o)throw new mt.ErrnoError(o);if(!r.node_ops.symlink)throw new mt.ErrnoError(63);return r.node_ops.symlink(r,n,t)},rename(t,e){var r,n,o=tt.dirname(t),i=tt.dirname(e),a=tt.basename(t),s=tt.basename(e);if(r=mt.lookupPath(t,{parent:!0}).node,n=mt.lookupPath(e,{parent:!0}).node,!r||!n)throw new mt.ErrnoError(44);if(r.mount!==n.mount)throw new mt.ErrnoError(75);var u,c=mt.lookupNode(r,a),l=rt.relative(t,i);if("."!==l.charAt(0))throw new mt.ErrnoError(28);if("."!==(l=rt.relative(e,o)).charAt(0))throw new mt.ErrnoError(55);try{u=mt.lookupNode(n,s)}catch(t){}if(c!==u){var d=mt.isDir(c.mode),h=mt.mayDelete(r,a,d);if(h)throw new mt.ErrnoError(h);if(h=u?mt.mayDelete(n,s,d):mt.mayCreate(n,s))throw new mt.ErrnoError(h);if(!r.node_ops.rename)throw new mt.ErrnoError(63);if(mt.isMountpoint(c)||u&&mt.isMountpoint(u))throw new mt.ErrnoError(10);if(n!==r&&(h=mt.nodePermissions(r,"w")))throw new mt.ErrnoError(h);mt.hashRemoveNode(c);try{r.node_ops.rename(c,n,s)}catch(t){throw t}finally{mt.hashAddNode(c)}}},rmdir(t){var e=mt.lookupPath(t,{parent:!0}).node,r=tt.basename(t),n=mt.lookupNode(e,r),o=mt.mayDelete(e,r,!0);if(o)throw new mt.ErrnoError(o);if(!e.node_ops.rmdir)throw new mt.ErrnoError(63);if(mt.isMountpoint(n))throw new mt.ErrnoError(10);e.node_ops.rmdir(e,r),mt.destroyNode(n)},readdir(t){var e=mt.lookupPath(t,{follow:!0}).node;if(!e.node_ops.readdir)throw new mt.ErrnoError(54);return e.node_ops.readdir(e)},unlink(t){var e=mt.lookupPath(t,{parent:!0}).node;if(!e)throw new mt.ErrnoError(44);var r=tt.basename(t),n=mt.lookupNode(e,r),o=mt.mayDelete(e,r,!1);if(o)throw new mt.ErrnoError(o);if(!e.node_ops.unlink)throw new mt.ErrnoError(63);if(mt.isMountpoint(n))throw new mt.ErrnoError(10);e.node_ops.unlink(e,r),mt.destroyNode(n)},readlink(t){var e=mt.lookupPath(t).node;if(!e)throw new mt.ErrnoError(44);if(!e.node_ops.readlink)throw new mt.ErrnoError(28);return rt.resolve(mt.getPath(e.parent),e.node_ops.readlink(e))},stat(t,e){var r=mt.lookupPath(t,{follow:!e}).node;if(!r)throw new mt.ErrnoError(44);if(!r.node_ops.getattr)throw new mt.ErrnoError(63);return r.node_ops.getattr(r)},lstat:t=>mt.stat(t,!0),chmod(t,e,r){var n;if(!(n="string"==typeof t?mt.lookupPath(t,{follow:!r}).node:t).node_ops.setattr)throw new mt.ErrnoError(63);n.node_ops.setattr(n,{mode:4095&e|-4096&n.mode,timestamp:Date.now()})},lchmod(t,e){mt.chmod(t,e,!0)},fchmod(t,e){var r=mt.getStreamChecked(t);mt.chmod(r.node,e)},chown(t,e,r,n){var o;if(!(o="string"==typeof t?mt.lookupPath(t,{follow:!n}).node:t).node_ops.setattr)throw new mt.ErrnoError(63);o.node_ops.setattr(o,{timestamp:Date.now()})},lchown(t,e,r){mt.chown(t,e,r,!0)},fchown(t,e,r){var n=mt.getStreamChecked(t);mt.chown(n.node,e,r)},truncate(t,e){if(e<0)throw new mt.ErrnoError(28);var r;if(!(r="string"==typeof t?mt.lookupPath(t,{follow:!0}).node:t).node_ops.setattr)throw new mt.ErrnoError(63);if(mt.isDir(r.mode))throw new mt.ErrnoError(31);if(!mt.isFile(r.mode))throw new mt.ErrnoError(28);var n=mt.nodePermissions(r,"w");if(n)throw new mt.ErrnoError(n);r.node_ops.setattr(r,{size:e,timestamp:Date.now()})},ftruncate(t,e){var r=mt.getStreamChecked(t);if(0==(2097155&r.flags))throw new mt.ErrnoError(28);mt.truncate(r.node,e)},utime(t,e,r){var n=mt.lookupPath(t,{follow:!0}).node;n.node_ops.setattr(n,{timestamp:Math.max(e,r)})},open(t,e,r){if(""===t)throw new mt.ErrnoError(44);var n;if(r="undefined"==typeof r?438:r,r=64&(e="string"==typeof e?(t=>{var e={r:0,"r+":2,w:577,"w+":578,a:1089,"a+":1090}[t];if("undefined"==typeof e)throw new Error(`Unknown file open mode: ${t}`);return e})(e):e)?4095&r|32768:0,"object"==typeof t)n=t;else{t=tt.normalize(t);try{n=mt.lookupPath(t,{follow:!(131072&e)}).node}catch(t){}}var o=!1;if(64&e)if(n){if(128&e)throw new mt.ErrnoError(20)}else n=mt.mknod(t,r,0),o=!0;if(!n)throw new mt.ErrnoError(44);if(mt.isChrdev(n.mode)&&(e&=-513),65536&e&&!mt.isDir(n.mode))throw new mt.ErrnoError(54);if(!o){var a=mt.mayOpen(n,e);if(a)throw new mt.ErrnoError(a)}512&e&&!o&&mt.truncate(n,0),e&=-131713;var s=mt.createStream({node:n,path:mt.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),!i.logReadFiles||1&e||(mt.readFiles||(mt.readFiles={}),t in mt.readFiles||(mt.readFiles[t]=1)),s},close(t){if(mt.isClosed(t))throw new mt.ErrnoError(8);t.getdents&&(t.getdents=null);try{t.stream_ops.close&&t.stream_ops.close(t)}catch(t){throw t}finally{mt.closeStream(t.fd)}t.fd=null},isClosed:t=>null===t.fd,llseek(t,e,r){if(mt.isClosed(t))throw new mt.ErrnoError(8);if(!t.seekable||!t.stream_ops.llseek)throw new mt.ErrnoError(70);if(0!=r&&1!=r&&2!=r)throw new mt.ErrnoError(28);return t.position=t.stream_ops.llseek(t,e,r),t.ungotten=[],t.position},read(t,e,r,n,o){if(n<0||o<0)throw new mt.ErrnoError(28);if(mt.isClosed(t))throw new mt.ErrnoError(8);if(1==(2097155&t.flags))throw new mt.ErrnoError(8);if(mt.isDir(t.node.mode))throw new mt.ErrnoError(31);if(!t.stream_ops.read)throw new mt.ErrnoError(28);var i="undefined"!=typeof o;if(i){if(!t.seekable)throw new mt.ErrnoError(70)}else o=t.position;var a=t.stream_ops.read(t,e,r,n,o);return i||(t.position+=a),a},write(t,e,r,n,o,i){if(n<0||o<0)throw new mt.ErrnoError(28);if(mt.isClosed(t))throw new mt.ErrnoError(8);if(0==(2097155&t.flags))throw new mt.ErrnoError(8);if(mt.isDir(t.node.mode))throw new mt.ErrnoError(31);if(!t.stream_ops.write)throw new mt.ErrnoError(28);t.seekable&&1024&t.flags&&mt.llseek(t,0,2);var a="undefined"!=typeof o;if(a){if(!t.seekable)throw new mt.ErrnoError(70)}else o=t.position;var s=t.stream_ops.write(t,e,r,n,o,i);return a||(t.position+=s),s},allocate(t,e,r){if(mt.isClosed(t))throw new mt.ErrnoError(8);if(e<0||r<=0)throw new mt.ErrnoError(28);if(0==(2097155&t.flags))throw new mt.ErrnoError(8);if(!mt.isFile(t.node.mode)&&!mt.isDir(t.node.mode))throw new mt.ErrnoError(43);if(!t.stream_ops.allocate)throw new mt.ErrnoError(138);t.stream_ops.allocate(t,e,r)},mmap(t,e,r,n,o){if(0!=(2&n)&&0==(2&o)&&2!=(2097155&t.flags))throw new mt.ErrnoError(2);if(1==(2097155&t.flags))throw new mt.ErrnoError(2);if(!t.stream_ops.mmap)throw new mt.ErrnoError(43);return t.stream_ops.mmap(t,e,r,n,o)},msync:(t,e,r,n,o)=>t.stream_ops.msync?t.stream_ops.msync(t,e,r,n,o):0,munmap:t=>0,ioctl(t,e,r){if(!t.stream_ops.ioctl)throw new mt.ErrnoError(59);return t.stream_ops.ioctl(t,e,r)},readFile(t,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 r,n=mt.open(t,e.flags),o=mt.stat(t).size,i=new Uint8Array(o);return mt.read(n,i,0,o,0),"utf8"===e.encoding?r=ot(i,0):"binary"===e.encoding&&(r=i),mt.close(n),r},writeFile(t,e,r={}){r.flags=r.flags||577;var n=mt.open(t,r.flags,r.mode);if("string"==typeof e){var o=new Uint8Array(at(e)+1),i=st(e,o,0,o.length);mt.write(n,o,0,i,void 0,r.canOwn)}else{if(!ArrayBuffer.isView(e))throw new Error("Unsupported data type");mt.write(n,e,0,e.byteLength,void 0,r.canOwn)}mt.close(n)},cwd:()=>mt.currentPath,chdir(t){var e=mt.lookupPath(t,{follow:!0});if(null===e.node)throw new mt.ErrnoError(44);if(!mt.isDir(e.node.mode))throw new mt.ErrnoError(54);var r=mt.nodePermissions(e.node,"x");if(r)throw new mt.ErrnoError(r);mt.currentPath=e.path},createDefaultDirectories(){mt.mkdir("/tmp"),mt.mkdir("/home"),mt.mkdir("/home/web_user")},createDefaultDevices(){mt.mkdir("/dev"),mt.registerDevice(mt.makedev(1,3),{read:()=>0,write:(t,e,r,n,o)=>n}),mt.mkdev("/dev/null",mt.makedev(1,3)),ct.register(mt.makedev(5,0),ct.default_tty_ops),ct.register(mt.makedev(6,0),ct.default_tty1_ops),mt.mkdev("/dev/tty",mt.makedev(5,0)),mt.mkdev("/dev/tty1",mt.makedev(6,0));var t=new Uint8Array(1024),e=0,r=()=>(0===e&&(e=et(t).byteLength),t[--e]);mt.createDevice("/dev","random",r),mt.createDevice("/dev","urandom",r),mt.mkdir("/dev/shm"),mt.mkdir("/dev/shm/tmp")},createSpecialDirectories(){mt.mkdir("/proc");var t=mt.mkdir("/proc/self");mt.mkdir("/proc/self/fd"),mt.mount({mount(){var e=mt.createNode(t,"fd",16895,73);return e.node_ops={lookup(t,e){var r=+e,n=mt.getStreamChecked(r),o={parent:null,mount:{mountpoint:"fake"},node_ops:{readlink:()=>n.path}};return o.parent=o,o}},e}},{},"/proc/self/fd")},createStandardStreams(){i.stdin?mt.createDevice("/dev","stdin",i.stdin):mt.symlink("/dev/tty","/dev/stdin"),i.stdout?mt.createDevice("/dev","stdout",null,i.stdout):mt.symlink("/dev/tty","/dev/stdout"),i.stderr?mt.createDevice("/dev","stderr",null,i.stderr):mt.symlink("/dev/tty1","/dev/stderr"),mt.open("/dev/stdin",0),mt.open("/dev/stdout",1),mt.open("/dev/stderr",1)},ensureErrnoError(){mt.ErrnoError||(mt.ErrnoError=function(t,e){this.name="ErrnoError",this.node=e,this.setErrno=function(t){this.errno=t},this.setErrno(t),this.message="FS error"},mt.ErrnoError.prototype=new Error,mt.ErrnoError.prototype.constructor=mt.ErrnoError,[44].forEach((t=>{mt.genericErrors[t]=new mt.ErrnoError(t),mt.genericErrors[t].stack="<generic error, no stack>"})))},staticInit(){mt.ensureErrnoError(),mt.nameTable=new Array(4096),mt.mount(dt,{},"/"),mt.createDefaultDirectories(),mt.createDefaultDevices(),mt.createSpecialDirectories(),mt.filesystems={MEMFS:dt}},init(t,e,r){mt.init.initialized=!0,mt.ensureErrnoError(),i.stdin=t||i.stdin,i.stdout=e||i.stdout,i.stderr=r||i.stderr,mt.createStandardStreams()},quit(){mt.init.initialized=!1;for(var t=0;t<mt.streams.length;t++){var e=mt.streams[t];e&&mt.close(e)}},findObject(t,e){var r=mt.analyzePath(t,e);return r.exists?r.object:null},analyzePath(t,e){try{t=(n=mt.lookupPath(t,{follow:!e})).path}catch(t){}var r={isRoot:!1,exists:!1,error:0,name:null,path:null,object:null,parentExists:!1,parentPath:null,parentObject:null};try{var n=mt.lookupPath(t,{parent:!0});r.parentExists=!0,r.parentPath=n.path,r.parentObject=n.node,r.name=tt.basename(t),n=mt.lookupPath(t,{follow:!e}),r.exists=!0,r.path=n.path,r.object=n.node,r.name=n.node.name,r.isRoot="/"===n.path}catch(t){r.error=t.errno}return r},createPath(t,e,r,n){t="string"==typeof t?t:mt.getPath(t);for(var o=e.split("/").reverse();o.length;){var i=o.pop();if(i){var a=tt.join2(t,i);try{mt.mkdir(a)}catch(t){}t=a}}return a},createFile(t,e,r,n,o){var i=tt.join2("string"==typeof t?t:mt.getPath(t),e),a=pt(n,o);return mt.create(i,a)},createDataFile(t,e,r,n,o,i){var a=e;t&&(t="string"==typeof t?t:mt.getPath(t),a=e?tt.join2(t,e):t);var s=pt(n,o),u=mt.create(a,s);if(r){if("string"==typeof r){for(var c=new Array(r.length),l=0,d=r.length;l<d;++l)c[l]=r.charCodeAt(l);r=c}mt.chmod(u,146|s);var h=mt.open(u,577);mt.write(h,r,0,r.length,0,i),mt.close(h),mt.chmod(u,s)}return u},createDevice(t,e,r,n){var o=tt.join2("string"==typeof t?t:mt.getPath(t),e),i=pt(!!r,!!n);mt.createDevice.major||(mt.createDevice.major=64);var a=mt.makedev(mt.createDevice.major++,0);return mt.registerDevice(a,{open(t){t.seekable=!1},close(t){n&&n.buffer&&n.buffer.length&&n(10)},read(t,e,n,o,i){for(var a=0,s=0;s<o;s++){var u;try{u=r()}catch(t){throw new mt.ErrnoError(29)}if(void 0===u&&0===a)throw new mt.ErrnoError(6);if(null==u)break;a++,e[n+s]=u}return a&&(t.node.timestamp=Date.now()),a},write(t,e,r,o,i){for(var a=0;a<o;a++)try{n(e[r+a])}catch(t){throw new mt.ErrnoError(29)}return o&&(t.node.timestamp=Date.now()),a}}),mt.mkdev(o,i,a)},forceLoadFile(t){if(t.isDevice||t.isFolder||t.link||t.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(!a)throw new Error("Cannot load without read() or XMLHttpRequest.");try{t.contents=ut(a(t.url),!0),t.usedBytes=t.contents.length}catch(t){throw new mt.ErrnoError(29)}},createLazyFile(t,e,r,n,o){function i(){this.lengthKnown=!1,this.chunks=[]}if(i.prototype.get=function(t){if(!(t>this.length-1||t<0)){var e=t%this.chunkSize,r=t/this.chunkSize|0;return this.getter(r)[e]}},i.prototype.setDataGetter=function(t){this.getter=t},i.prototype.cacheLength=function(){var t=new XMLHttpRequest;if(t.open("HEAD",r,!1),t.send(null),!(t.status>=200&&t.status<300||304===t.status))throw new Error("Couldn't load "+r+". Status: "+t.status);var e,n=Number(t.getResponseHeader("Content-length")),o=(e=t.getResponseHeader("Accept-Ranges"))&&"bytes"===e,i=(e=t.getResponseHeader("Content-Encoding"))&&"gzip"===e,a=1048576;o||(a=n);var s=this;s.setDataGetter((t=>{var e=t*a,o=(t+1)*a-1;if(o=Math.min(o,n-1),"undefined"==typeof s.chunks[t]&&(s.chunks[t]=((t,e)=>{if(t>e)throw new Error("invalid range ("+t+", "+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",r,!1),n!==a&&o.setRequestHeader("Range","bytes="+t+"-"+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 "+r+". Status: "+o.status);return void 0!==o.response?new Uint8Array(o.response||[]):ut(o.responseText||"",!0)})(e,o)),"undefined"==typeof s.chunks[t])throw new Error("doXHR failed!");return s.chunks[t]})),!i&&n||(a=n=1,n=this.getter(0).length,a=n,p("LazyFiles on gzip forces download of the whole file when length is accessed")),this._length=n,this._chunkSize=a,this.lengthKnown=!0},"undefined"!=typeof XMLHttpRequest){var a=new i;Object.defineProperties(a,{length:{get:function(){return this.lengthKnown||this.cacheLength(),this._length}},chunkSize:{get:function(){return this.lengthKnown||this.cacheLength(),this._chunkSize}}});var s={isDevice:!1,contents:a}}else s={isDevice:!1,url:r};var u=mt.createFile(t,e,s,n,o);s.contents?u.contents=s.contents:s.url&&(u.contents=null,u.url=s.url),Object.defineProperties(u,{usedBytes:{get:function(){return this.contents.length}}});var c={};function l(t,e,r,n,o){var i=t.node.contents;if(o>=i.length)return 0;var a=Math.min(i.length-o,n);if(i.slice)for(var s=0;s<a;s++)e[r+s]=i[o+s];else for(s=0;s<a;s++)e[r+s]=i.get(o+s);return a}return Object.keys(u.stream_ops).forEach((t=>{var e=u.stream_ops[t];c[t]=function(){return mt.forceLoadFile(u),e.apply(null,arguments)}})),c.read=(t,e,r,n,o)=>(mt.forceLoadFile(u),l(t,e,r,n,o)),c.mmap=(t,e,r,n,o)=>{mt.forceLoadFile(u);var i=lt(e);if(!i)throw new mt.ErrnoError(48);return l(t,g,i,e,r),{ptr:i,allocated:!0}},u.stream_ops=c,u}},vt=(t,e)=>t?ot(w,t,e):"",yt={DEFAULT_POLLMASK:5,calculateAt(t,e,r){if(tt.isAbs(e))return e;var n;if(n=-100===t?mt.cwd():yt.getStreamFromFD(t).path,0==e.length){if(!r)throw new mt.ErrnoError(44);return n}return tt.join2(n,e)},doStat(t,e,r){try{var n=t(e)}catch(t){if(t&&t.node&&tt.normalize(e)!==tt.normalize(mt.getPath(t.node)))return-54;throw t}_[r>>2]=n.dev,_[r+4>>2]=n.mode,M[r+8>>2]=n.nlink,_[r+12>>2]=n.uid,_[r+16>>2]=n.gid,_[r+20>>2]=n.rdev,D=[n.size>>>0,(F=n.size,+Math.abs(F)>=1?F>0?+Math.floor(F/4294967296)>>>0:~~+Math.ceil((F-+(~~F>>>0))/4294967296)>>>0:0)],_[r+24>>2]=D[0],_[r+28>>2]=D[1],_[r+32>>2]=4096,_[r+36>>2]=n.blocks;var o=n.atime.getTime(),i=n.mtime.getTime(),a=n.ctime.getTime();return D=[Math.floor(o/1e3)>>>0,(F=Math.floor(o/1e3),+Math.abs(F)>=1?F>0?+Math.floor(F/4294967296)>>>0:~~+Math.ceil((F-+(~~F>>>0))/4294967296)>>>0:0)],_[r+40>>2]=D[0],_[r+44>>2]=D[1],M[r+48>>2]=o%1e3*1e3,D=[Math.floor(i/1e3)>>>0,(F=Math.floor(i/1e3),+Math.abs(F)>=1?F>0?+Math.floor(F/4294967296)>>>0:~~+Math.ceil((F-+(~~F>>>0))/4294967296)>>>0:0)],_[r+56>>2]=D[0],_[r+60>>2]=D[1],M[r+64>>2]=i%1e3*1e3,D=[Math.floor(a/1e3)>>>0,(F=Math.floor(a/1e3),+Math.abs(F)>=1?F>0?+Math.floor(F/4294967296)>>>0:~~+Math.ceil((F-+(~~F>>>0))/4294967296)>>>0:0)],_[r+72>>2]=D[0],_[r+76>>2]=D[1],M[r+80>>2]=a%1e3*1e3,D=[n.ino>>>0,(F=n.ino,+Math.abs(F)>=1?F>0?+Math.floor(F/4294967296)>>>0:~~+Math.ceil((F-+(~~F>>>0))/4294967296)>>>0:0)],_[r+88>>2]=D[0],_[r+92>>2]=D[1],0},doMsync(t,e,r,n,o){if(!mt.isFile(e.node.mode))throw new mt.ErrnoError(43);if(2&n)return 0;var i=w.slice(t,t+r);mt.msync(e,i,o,r,n)},varargs:void 0,get(){var t=_[yt.varargs>>2];return yt.varargs+=4,t},getp:()=>yt.get(),getStr:t=>vt(t),getStreamFromFD:t=>mt.getStreamChecked(t)},gt=(t,e)=>e+2097152>>>0<4194305-!!t?(t>>>0)+4294967296*e:NaN,wt=(t,e,r)=>st(t,w,e,r),bt=void 0,Et=t=>{for(var e="",r=t;w[r];)e+=bt[w[r++]];return e},_t={},Mt={},kt={},Ct=void 0,Pt=t=>{throw new Ct(t)},$t=void 0,Tt=t=>{throw new $t(t)},jt=(t,e,r)=>{function n(e){var n=r(e);n.length!==t.length&&Tt("Mismatched type converter count");for(var o=0;o<t.length;++o)St(t[o],n[o])}t.forEach((function(t){kt[t]=e}));var o=new Array(e.length),i=[],a=0;e.forEach(((t,e)=>{Mt.hasOwnProperty(t)?o[e]=Mt[t]:(i.push(t),_t.hasOwnProperty(t)||(_t[t]=[]),_t[t].push((()=>{o[e]=Mt[t],++a===i.length&&n(o)})))})),0===i.length&&n(o)};function St(t,e,r={}){if(!("argPackAdvance"in e))throw new TypeError("registerType registeredInstance requires argPackAdvance");return function(t,e,r={}){var n=e.name;if(t||Pt(`type "${n}" must have a positive integer typeid pointer`),Mt.hasOwnProperty(t)){if(r.ignoreDuplicateRegistrations)return;Pt(`Cannot register type '${n}' twice`)}if(Mt[t]=e,delete kt[t],_t.hasOwnProperty(t)){var o=_t[t];delete _t[t],o.forEach((t=>t()))}}(t,e,r)}function Ft(t){if(!(this instanceof Zt))return!1;if(!(t instanceof Zt))return!1;for(var e=this.$$.ptrType.registeredClass,r=this.$$.ptr,n=t.$$.ptrType.registeredClass,o=t.$$.ptr;e.baseClass;)r=e.upcast(r),e=e.baseClass;for(;n.baseClass;)o=n.upcast(o),n=n.baseClass;return e===n&&r===o}var Dt=t=>{Pt(t.$$.ptrType.registeredClass.name+" instance already deleted")},Wt=!1,At=t=>{},Ot=t=>{t.count.value-=1,0===t.count.value&&(t=>{t.smartPtr?t.smartPtrType.rawDestructor(t.smartPtr):t.ptrType.registeredClass.rawDestructor(t.ptr)})(t)},xt=(t,e,r)=>{if(e===r)return t;if(void 0===r.baseClass)return null;var n=xt(t,e,r.baseClass);return null===n?null:r.downcast(n)},It={},Rt=()=>Object.keys(Ht).length,zt=()=>{var t=[];for(var e in Ht)Ht.hasOwnProperty(e)&&t.push(Ht[e]);return t},Nt=[],Ut=()=>{for(;Nt.length;){var t=Nt.pop();t.$$.deleteScheduled=!1,t.delete()}},Lt=void 0,Bt=t=>{Lt=t,Nt.length&&Lt&&Lt(Ut)},Ht={},Vt=(t,e)=>(e=((t,e)=>{for(void 0===e&&Pt("ptr should not be undefined");t.baseClass;)e=t.upcast(e),t=t.baseClass;return e})(t,e),Ht[e]),Yt=(t,e)=>(e.ptrType&&e.ptr||Tt("makeClassHandle requires ptr and ptrType"),!!e.smartPtrType!=!!e.smartPtr&&Tt("Both smartPtrType and smartPtr must be specified"),e.count={value:1},Gt(Object.create(t,{$$:{value:e}})));function qt(t){var e=this.getPointee(t);if(!e)return this.destructor(t),null;var r=Vt(this.registeredClass,e);if(void 0!==r){if(0===r.$$.count.value)return r.$$.ptr=e,r.$$.smartPtr=t,r.clone();var n=r.clone();return this.destructor(t),n}function o(){return this.isSmartPointer?Yt(this.registeredClass.instancePrototype,{ptrType:this.pointeeType,ptr:e,smartPtrType:this,smartPtr:t}):Yt(this.registeredClass.instancePrototype,{ptrType:this,ptr:t})}var i,a=this.registeredClass.getActualType(e),s=It[a];if(!s)return o.call(this);i=this.isConst?s.constPointerType:s.pointerType;var u=xt(e,this.registeredClass,i.registeredClass);return null===u?o.call(this):this.isSmartPointer?Yt(i.registeredClass.instancePrototype,{ptrType:i,ptr:u,smartPtrType:this,smartPtr:t}):Yt(i.registeredClass.instancePrototype,{ptrType:i,ptr:u})}var Gt=t=>"undefined"==typeof FinalizationRegistry?(Gt=t=>t,t):(Wt=new FinalizationRegistry((t=>{Ot(t.$$)})),Gt=t=>{var e=t.$$;if(e.smartPtr){var r={$$:e};Wt.register(t,r,t)}return t},At=t=>Wt.unregister(t),Gt(t));function Kt(){if(this.$$.ptr||Dt(this),this.$$.preservePointerOnDelete)return this.$$.count.value+=1,this;var t,e=Gt(Object.create(Object.getPrototypeOf(this),{$$:{value:(t=this.$$,{count:t.count,deleteScheduled:t.deleteScheduled,preservePointerOnDelete:t.preservePointerOnDelete,ptr:t.ptr,ptrType:t.ptrType,smartPtr:t.smartPtr,smartPtrType:t.smartPtrType})}}));return e.$$.count.value+=1,e.$$.deleteScheduled=!1,e}function Qt(){this.$$.ptr||Dt(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&Pt("Object already scheduled for deletion"),At(this),Ot(this.$$),this.$$.preservePointerOnDelete||(this.$$.smartPtr=void 0,this.$$.ptr=void 0)}function Jt(){return!this.$$.ptr}function Xt(){return this.$$.ptr||Dt(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&Pt("Object already scheduled for deletion"),Nt.push(this),1===Nt.length&&Lt&&Lt(Ut),this.$$.deleteScheduled=!0,this}function Zt(){}var te=t=>{if(void 0===t)return"_unknown";var e=(t=t.replace(/[^a-zA-Z0-9_]/g,"$")).charCodeAt(0);return e>=48&&e<=57?`_${t}`:t};function ee(t,e){return{[t=te(t)]:function(){return e.apply(this,arguments)}}[t]}var re=(t,e,r)=>{if(void 0===t[e].overloadTable){var n=t[e];t[e]=function(){return t[e].overloadTable.hasOwnProperty(arguments.length)||Pt(`Function '${r}' called with an invalid number of arguments (${arguments.length}) - expects one of (${t[e].overloadTable})!`),t[e].overloadTable[arguments.length].apply(this,arguments)},t[e].overloadTable=[],t[e].overloadTable[n.argCount]=n}},ne=(t,e,r)=>{i.hasOwnProperty(t)?((void 0===r||void 0!==i[t].overloadTable&&void 0!==i[t].overloadTable[r])&&Pt(`Cannot register public name '${t}' twice`),re(i,t,t),i.hasOwnProperty(r)&&Pt(`Cannot register multiple overloads of a function with the same number of arguments (${r})!`),i[t].overloadTable[r]=e):(i[t]=e,void 0!==r&&(i[t].numArguments=r))};function oe(t,e,r,n,o,i,a,s){this.name=t,this.constructor=e,this.instancePrototype=r,this.rawDestructor=n,this.baseClass=o,this.getActualType=i,this.upcast=a,this.downcast=s,this.pureVirtualFunctions=[]}var ie=(t,e,r)=>{for(;e!==r;)e.upcast||Pt(`Expected null or instance of ${r.name}, got an instance of ${e.name}`),t=e.upcast(t),e=e.baseClass;return t};function ae(t,e){if(null===e)return this.isReference&&Pt(`null is not a valid ${this.name}`),0;e.$$||Pt(`Cannot pass "${Fe(e)}" as a ${this.name}`),e.$$.ptr||Pt(`Cannot pass deleted object as a pointer of type ${this.name}`);var r=e.$$.ptrType.registeredClass;return ie(e.$$.ptr,r,this.registeredClass)}function se(t,e){var r;if(null===e)return this.isReference&&Pt(`null is not a valid ${this.name}`),this.isSmartPointer?(r=this.rawConstructor(),null!==t&&t.push(this.rawDestructor,r),r):0;e.$$||Pt(`Cannot pass "${Fe(e)}" as a ${this.name}`),e.$$.ptr||Pt(`Cannot pass deleted object as a pointer of type ${this.name}`),!this.isConst&&e.$$.ptrType.isConst&&Pt(`Cannot convert argument of type ${e.$$.smartPtrType?e.$$.smartPtrType.name:e.$$.ptrType.name} to parameter type ${this.name}`);var n=e.$$.ptrType.registeredClass;if(r=ie(e.$$.ptr,n,this.registeredClass),this.isSmartPointer)switch(void 0===e.$$.smartPtr&&Pt("Passing raw pointer to smart pointer is illegal"),this.sharingPolicy){case 0:e.$$.smartPtrType===this?r=e.$$.smartPtr:Pt(`Cannot convert argument of type ${e.$$.smartPtrType?e.$$.smartPtrType.name:e.$$.ptrType.name} to parameter type ${this.name}`);break;case 1:r=e.$$.smartPtr;break;case 2:if(e.$$.smartPtrType===this)r=e.$$.smartPtr;else{var o=e.clone();r=this.rawShare(r,Te.toHandle((()=>o.delete()))),null!==t&&t.push(this.rawDestructor,r)}break;default:Pt("Unsupporting sharing policy")}return r}function ue(t,e){if(null===e)return this.isReference&&Pt(`null is not a valid ${this.name}`),0;e.$$||Pt(`Cannot pass "${Fe(e)}" as a ${this.name}`),e.$$.ptr||Pt(`Cannot pass deleted object as a pointer of type ${this.name}`),e.$$.ptrType.isConst&&Pt(`Cannot convert argument of type ${e.$$.ptrType.name} to parameter type ${this.name}`);var r=e.$$.ptrType.registeredClass;return ie(e.$$.ptr,r,this.registeredClass)}function ce(t){return this.fromWireType(M[t>>2])}function le(t){return this.rawGetPointee&&(t=this.rawGetPointee(t)),t}function de(t){this.rawDestructor&&this.rawDestructor(t)}var he=t=>{null!==t&&t.delete()};function fe(t,e,r,n,o,i,a,s,u,c,l){this.name=t,this.registeredClass=e,this.isReference=r,this.isConst=n,this.isSmartPointer=o,this.pointeeType=i,this.sharingPolicy=a,this.rawGetPointee=s,this.rawConstructor=u,this.rawShare=c,this.rawDestructor=l,o||void 0!==e.baseClass?this.toWireType=se:n?(this.toWireType=ae,this.destructorFunction=null):(this.toWireType=ue,this.destructorFunction=null)}var pe=(t,e,r)=>{i.hasOwnProperty(t)||Tt("Replacing nonexistant public symbol"),void 0!==i[t].overloadTable&&void 0!==r?i[t].overloadTable[r]=e:(i[t]=e,i[t].argCount=r)},me=t=>P.get(t),ve=(t,e,r)=>t.includes("j")?((t,e,r)=>{var n=i["dynCall_"+t];return r&&r.length?n.apply(null,[e].concat(r)):n.call(null,e)})(t,e,r):me(e).apply(null,r),ye=(t,e)=>{var r,n,o,i=(t=Et(t)).includes("j")?(r=t,n=e,o=[],function(){return o.length=0,Object.assign(o,arguments),ve(r,n,o)}):me(e);return"function"!=typeof i&&Pt(`unknown function pointer with signature ${t}: ${e}`),i},ge=void 0,we=t=>{var e=Pr(t),r=Et(e);return Mr(e),r},be=(t,e)=>{var r=[],n={};throw e.forEach((function t(e){n[e]||Mt[e]||(kt[e]?kt[e].forEach(t):(r.push(e),n[e]=!0))})),new ge(`${t}: `+r.map(we).join([", "]))},Ee=t=>{for(;t.length;){var e=t.pop();t.pop()(e)}};function _e(t,e,r,n,o,i){var a=e.length;a<2&&Pt("argTypes array size mismatch! Must at least get return value and 'this' types!");for(var s=null!==e[1]&&null!==r,u=!1,c=1;c<e.length;++c)if(null!==e[c]&&void 0===e[c].destructorFunction){u=!0;break}var l="void"!==e[0].name,d=a-2,h=new Array(d),f=[],p=[];return function(){var r;arguments.length!==d&&Pt(`function ${t} called with ${arguments.length} arguments, expected ${d}`),p.length=0,f.length=s?2:1,f[0]=o,s&&(r=e[1].toWireType(p,this),f[1]=r);for(var i=0;i<d;++i)h[i]=e[i+2].toWireType(p,arguments[i]),f.push(h[i]);var a=n.apply(null,f);function c(t){if(u)Ee(p);else for(var n=s?1:2;n<e.length;n++){var o=1===n?r:h[n-2];null!==e[n].destructorFunction&&e[n].destructorFunction(o)}if(l)return e[0].fromWireType(t)}return c(a)}}var Me=(t,e)=>{for(var r=[],n=0;n<t;n++)r.push(M[e+4*n>>2]);return r};function ke(){this.allocated=[void 0],this.freelist=[]}var Ce=new ke,Pe=t=>{t>=Ce.reserved&&0==--Ce.get(t).refcount&&Ce.free(t)},$e=()=>{for(var t=0,e=Ce.reserved;e<Ce.allocated.length;++e)void 0!==Ce.allocated[e]&&++t;return t},Te={toValue:t=>(t||Pt("Cannot use deleted val. handle = "+t),Ce.get(t).value),toHandle:t=>{switch(t){case void 0:return 1;case null:return 2;case!0:return 3;case!1:return 4;default:return Ce.allocate({refcount:1,value:t})}}};function je(t){return this.fromWireType(_[t>>2])}var Se,Fe=t=>{if(null===t)return"null";var e=typeof t;return"object"===e||"array"===e||"function"===e?t.toString():""+t},De=(t,e)=>{switch(e){case 4:return function(t){return this.fromWireType(k[t>>2])};case 8:return function(t){return this.fromWireType(C[t>>3])};default:throw new T