-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathworker.js
More file actions
1 lines (1 loc) · 93.4 KB
/
worker.js
File metadata and controls
1 lines (1 loc) · 93.4 KB
1
function globalEval(e){eval.call(null,e)}function assert(e,r){e||abort("Assertion failed: "+r)}function getCFunc(ident){var func=Module["_"+ident];if(!func)try{func=eval("_"+ident)}catch(e){}return assert(func,"Cannot call unknown function "+ident+" (perhaps LLVM optimizations or closure removed it?)"),func}function setValue(e,r,t,n){switch("*"===(t=t||"i8").charAt(t.length-1)&&(t="i32"),t){case"i1":case"i8":HEAP8[e>>0]=r;break;case"i16":HEAP16[e>>1]=r;break;case"i32":HEAP32[e>>2]=r;break;case"i64":tempI64=[r>>>0,(tempDouble=r,+Math_abs(tempDouble)>=1?tempDouble>0?(0|Math_min(+Math_floor(tempDouble/4294967296),4294967295))>>>0:~~+Math_ceil((tempDouble-+(~~tempDouble>>>0))/4294967296)>>>0:0)],HEAP32[e>>2]=tempI64[0],HEAP32[e+4>>2]=tempI64[1];break;case"float":HEAPF32[e>>2]=r;break;case"double":HEAPF64[e>>3]=r;break;default:abort("invalid type for setValue: "+t)}}function getValue(e,r,t){switch("*"===(r=r||"i8").charAt(r.length-1)&&(r="i32"),r){case"i1":case"i8":return HEAP8[e>>0];case"i16":return HEAP16[e>>1];case"i32":case"i64":return HEAP32[e>>2];case"float":return HEAPF32[e>>2];case"double":return HEAPF64[e>>3];default:abort("invalid type for setValue: "+r)}return null}function allocate(e,r,t,n){var o,i;"number"==typeof e?(o=!0,i=e):(o=!1,i=e.length);var a,s="string"==typeof r?r:null;if(a=t==ALLOC_NONE?n:["function"==typeof _malloc?_malloc:Runtime.staticAlloc,Runtime.stackAlloc,Runtime.staticAlloc,Runtime.dynamicAlloc][void 0===t?ALLOC_STATIC:t](Math.max(i,s?1:r.length)),o){var u,n=a;for(assert(0==(3&a)),u=a+(-4&i);n<u;n+=4)HEAP32[n>>2]=0;for(u=a+i;n<u;)HEAP8[n++>>0]=0;return a}if("i8"===s)return e.subarray||e.slice?HEAPU8.set(e,a):HEAPU8.set(new Uint8Array(e),a),a;for(var l,c,d,E=0;E<i;){var f=e[E];"function"==typeof f&&(f=Runtime.getFunctionIndex(f)),0!==(l=s||r[E])?("i64"==l&&(l="i32"),setValue(a+E,f,l),d!==l&&(c=Runtime.getNativeTypeSize(l),d=l),E+=c):E++}return a}function getMemory(e){return staticSealed?runtimeInitialized?_malloc(e):Runtime.dynamicAlloc(e):Runtime.staticAlloc(e)}function Pointer_stringify(e,r){if(0===r||!e)return"";for(var t,n=0,o=0;;){if(t=HEAPU8[e+o>>0],n|=t,0==t&&!r)break;if(o++,r&&o==r)break}r||(r=o);var i="";if(n<128){for(var a;r>0;)a=String.fromCharCode.apply(String,HEAPU8.subarray(e,e+Math.min(r,1024))),i=i?i+a:a,e+=1024,r-=1024;return i}return Module.UTF8ToString(e)}function AsciiToString(e){for(var r="";;){var t=HEAP8[e++>>0];if(!t)return r;r+=String.fromCharCode(t)}}function stringToAscii(e,r){return writeAsciiToMemory(e,r,!1)}function UTF8ArrayToString(e,r){for(var t=r;e[t];)++t;if(t-r>16&&e.subarray&&UTF8Decoder)return UTF8Decoder.decode(e.subarray(r,t));for(var n,o,i,a,s,u="";;){if(!(n=e[r++]))return u;if(128&n)if(o=63&e[r++],192!=(224&n))if(i=63&e[r++],224==(240&n)?n=(15&n)<<12|o<<6|i:(a=63&e[r++],240==(248&n)?n=(7&n)<<18|o<<12|i<<6|a:(s=63&e[r++],n=248==(252&n)?(3&n)<<24|o<<18|i<<12|a<<6|s:(1&n)<<30|o<<24|i<<18|a<<12|s<<6|63&e[r++])),n<65536)u+=String.fromCharCode(n);else{var l=n-65536;u+=String.fromCharCode(55296|l>>10,56320|1023&l)}else u+=String.fromCharCode((31&n)<<6|o);else u+=String.fromCharCode(n)}}function UTF8ToString(e){return UTF8ArrayToString(HEAPU8,e)}function stringToUTF8Array(e,r,t,n){if(!(n>0))return 0;for(var o=t,i=t+n-1,a=0;a<e.length;++a){var s=e.charCodeAt(a);if(s>=55296&&s<=57343&&(s=65536+((1023&s)<<10)|1023&e.charCodeAt(++a)),s<=127){if(t>=i)break;r[t++]=s}else if(s<=2047){if(t+1>=i)break;r[t++]=192|s>>6,r[t++]=128|63&s}else if(s<=65535){if(t+2>=i)break;r[t++]=224|s>>12,r[t++]=128|s>>6&63,r[t++]=128|63&s}else if(s<=2097151){if(t+3>=i)break;r[t++]=240|s>>18,r[t++]=128|s>>12&63,r[t++]=128|s>>6&63,r[t++]=128|63&s}else if(s<=67108863){if(t+4>=i)break;r[t++]=248|s>>24,r[t++]=128|s>>18&63,r[t++]=128|s>>12&63,r[t++]=128|s>>6&63,r[t++]=128|63&s}else{if(t+5>=i)break;r[t++]=252|s>>30,r[t++]=128|s>>24&63,r[t++]=128|s>>18&63,r[t++]=128|s>>12&63,r[t++]=128|s>>6&63,r[t++]=128|63&s}}return r[t]=0,t-o}function stringToUTF8(e,r,t){return stringToUTF8Array(e,HEAPU8,r,t)}function lengthBytesUTF8(e){for(var r=0,t=0;t<e.length;++t){var n=e.charCodeAt(t);n>=55296&&n<=57343&&(n=65536+((1023&n)<<10)|1023&e.charCodeAt(++t)),n<=127?++r:r+=n<=2047?2:n<=65535?3:n<=2097151?4:n<=67108863?5:6}return r}function demangle(e){var r=Module.___cxa_demangle||Module.__cxa_demangle;if(r){try{var t=e.substr(1),n=lengthBytesUTF8(t)+1,o=_malloc(n);stringToUTF8(t,o,n);var i=_malloc(4),a=r(o,0,0,i);if(0===getValue(i,"i32")&&a)return Pointer_stringify(a)}catch(e){}finally{o&&_free(o),i&&_free(i),a&&_free(a)}return e}return Runtime.warnOnce("warning: build with -s DEMANGLE_SUPPORT=1 to link in libcxxabi demangling"),e}function demangleAll(e){var r=/__Z[\w\d_]+/g;return e.replace(r,function(e){var r=demangle(e);return e===r?e:e+" ["+r+"]"})}function jsStackTrace(){var e=new Error;if(!e.stack){try{throw new Error(0)}catch(r){e=r}if(!e.stack)return"(no stack trace available)"}return e.stack.toString()}function stackTrace(){var e=jsStackTrace();return Module.extraStackTrace&&(e+="\n"+Module.extraStackTrace()),demangleAll(e)}function alignUp(e,r){return e%r>0&&(e+=r-e%r),e}function updateGlobalBuffer(e){Module.buffer=buffer=e}function updateGlobalBufferViews(){Module.HEAP8=HEAP8=new Int8Array(buffer),Module.HEAP16=HEAP16=new Int16Array(buffer),Module.HEAP32=HEAP32=new Int32Array(buffer),Module.HEAPU8=HEAPU8=new Uint8Array(buffer),Module.HEAPU16=HEAPU16=new Uint16Array(buffer),Module.HEAPU32=HEAPU32=new Uint32Array(buffer),Module.HEAPF32=HEAPF32=new Float32Array(buffer),Module.HEAPF64=HEAPF64=new Float64Array(buffer)}function abortOnCannotGrowMemory(){abort("Cannot enlarge memory arrays. Either (1) compile with -s TOTAL_MEMORY=X with X higher than the current value "+TOTAL_MEMORY+", (2) compile with -s ALLOW_MEMORY_GROWTH=1 which allows increasing the size at runtime, or (3) if you want malloc to return NULL (0) instead of this abort, compile with -s ABORTING_MALLOC=0 ")}function enlargeMemory(){abortOnCannotGrowMemory()}function getTotalMemory(){return TOTAL_MEMORY}function callRuntimeCallbacks(e){for(;e.length>0;){var r=e.shift();if("function"!=typeof r){var t=r.func;"number"==typeof t?void 0===r.arg?Module.dynCall_v(t):Module.dynCall_vi(t,r.arg):t(void 0===r.arg?null:r.arg)}else r()}}function preRun(){if(Module.preRun)for("function"==typeof Module.preRun&&(Module.preRun=[Module.preRun]);Module.preRun.length;)addOnPreRun(Module.preRun.shift());callRuntimeCallbacks(__ATPRERUN__)}function ensureInitRuntime(){runtimeInitialized||(runtimeInitialized=!0,callRuntimeCallbacks(__ATINIT__))}function preMain(){callRuntimeCallbacks(__ATMAIN__)}function exitRuntime(){callRuntimeCallbacks(__ATEXIT__),runtimeExited=!0}function postRun(){if(Module.postRun)for("function"==typeof Module.postRun&&(Module.postRun=[Module.postRun]);Module.postRun.length;)addOnPostRun(Module.postRun.shift());callRuntimeCallbacks(__ATPOSTRUN__)}function addOnPreRun(e){__ATPRERUN__.unshift(e)}function addOnInit(e){__ATINIT__.unshift(e)}function addOnPreMain(e){__ATMAIN__.unshift(e)}function addOnExit(e){__ATEXIT__.unshift(e)}function addOnPostRun(e){__ATPOSTRUN__.unshift(e)}function intArrayFromString(e,r,t){var n=t>0?t:lengthBytesUTF8(e)+1,o=new Array(n),i=stringToUTF8Array(e,o,0,o.length);return r&&(o.length=i),o}function intArrayToString(e){for(var r=[],t=0;t<e.length;t++){var n=e[t];n>255&&(n&=255),r.push(String.fromCharCode(n))}return r.join("")}function writeStringToMemory(e,r,t){Runtime.warnOnce("writeStringToMemory is deprecated and should not be called! Use stringToUTF8() instead!");var n,o;t&&(o=r+lengthBytesUTF8(e),n=HEAP8[o]),stringToUTF8(e,r,1/0),t&&(HEAP8[o]=n)}function writeArrayToMemory(e,r){HEAP8.set(e,r)}function writeAsciiToMemory(e,r,t){for(var n=0;n<e.length;++n)HEAP8[r++>>0]=e.charCodeAt(n);t||(HEAP8[r>>0]=0)}function getUniqueRunDependency(e){return e}function addRunDependency(e){runDependencies++,Module.monitorRunDependencies&&Module.monitorRunDependencies(runDependencies)}function removeRunDependency(e){if(runDependencies--,Module.monitorRunDependencies&&Module.monitorRunDependencies(runDependencies),0==runDependencies&&(null!==runDependencyWatcher&&(clearInterval(runDependencyWatcher),runDependencyWatcher=null),dependenciesFulfilled)){var r=dependenciesFulfilled;dependenciesFulfilled=null,r()}}function integrateWasmJS(e){function r(r){var t=e.buffer;r.byteLength<t.byteLength&&e.printErr("the new buffer in mergeMemory is smaller than the previous one. in native wasm, we should grow memory here");var n=new Int8Array(t),o=new Int8Array(r);memoryInitializer||n.set(o.subarray(e.STATIC_BASE,e.STATIC_BASE+e.STATIC_BUMP),e.STATIC_BASE),o.set(n),updateGlobalBuffer(r),updateGlobalBufferViews()}function t(e){return e}function n(){try{var r;if(e.wasmBinary)r=e.wasmBinary,r=new Uint8Array(r);else{if(!e.readBinary)throw"on the web, we need the wasm binary to be preloaded and set on Module['wasmBinary']. emcc.py will do that for you when generating HTML (but not JS)";r=e.readBinary(u)}return r}catch(e){abort(e)}}function o(){return e.wasmBinary||"function"!=typeof fetch?new Promise(function(e,r){e(n())}):fetch(u,{credentials:"same-origin"}).then(function(e){if(!e.ok)throw"failed to load wasm binary file at '"+u+"'";return e.arrayBuffer()})}function i(t,n,i){function a(t){(d=t.exports).memory&&r(d.memory),e.asm=d,e.usingWasm=!0,removeRunDependency("wasm-instantiate")}if("object"!=typeof WebAssembly)return e.printErr("no native wasm support detected"),!1;if(!(e.wasmMemory instanceof WebAssembly.Memory))return e.printErr("no native wasm Memory in use"),!1;if(n.memory=e.wasmMemory,c.global={NaN:NaN,Infinity:1/0},c["global.Math"]=t.Math,c.env=n,addRunDependency("wasm-instantiate"),e.instantiateWasm)try{return e.instantiateWasm(c,a)}catch(r){return e.printErr("Module.instantiateWasm callback failed with error: "+r),!1}return o().then(function(e){return WebAssembly.instantiate(e,c)}).then(function(e){a(e.instance)}).catch(function(r){e.printErr("failed to asynchronously prepare wasm: "+r),abort(r)}),{}}var a=e.wasmJSMethod||"native-wasm";e.wasmJSMethod=a;var s=e.wasmTextFile||"cryptonoter.wast",u=e.wasmBinaryFile||"cryptonoter.wasm",l=e.asmjsCodeFile||"cryptonoter.temp.asm.js";"function"==typeof e.locateFile&&(s=e.locateFile(s),u=e.locateFile(u),l=e.locateFile(l));var c={global:null,env:null,asm2wasm:{"f64-rem":function(e,r){return e%r},"f64-to-int":function(e){return 0|e},"i32s-div":function(e,r){return(0|e)/(0|r)|0},"i32u-div":function(e,r){return(e>>>0)/(r>>>0)>>>0},"i32s-rem":function(e,r){return(0|e)%(0|r)|0},"i32u-rem":function(e,r){return(e>>>0)%(r>>>0)>>>0},debugger:function(){}},parent:e},d=null;e.asmPreload=e.asm;var E=e.reallocBuffer,f=function(r){r=alignUp(r,e.usingWasm?WASM_PAGE_SIZE:ASMJS_PAGE_SIZE);var t=e.buffer,n=t.byteLength;if(!e.usingWasm)return d.__growWasmMemory((r-n)/65536),e.buffer!==t?e.buffer:null;try{return-1!==e.wasmMemory.grow((r-n)/65536)?e.buffer=e.wasmMemory.buffer:null}catch(e){return null}};e.reallocBuffer=function(e){return"asmjs"===S?E(e):f(e)};var S="";e.asm=function(r,n,o){if(r=t(r),!(n=t(n)).table){var a=e.wasmTableSize;void 0===a&&(a=1024);var s=e.wasmMaxTableSize;"object"==typeof WebAssembly&&"function"==typeof WebAssembly.Table?n.table=void 0!==s?new WebAssembly.Table({initial:a,maximum:s,element:"anyfunc"}):new WebAssembly.Table({initial:a,element:"anyfunc"}):n.table=new Array(a),e.wasmTable=n.table}n.memoryBase||(n.memoryBase=e.STATIC_BASE),n.tableBase||(n.tableBase=0);return i(r,n,o)};e.asm}function ___assert_fail(e,r,t,n){throw ABORT=!0,"Assertion failed: "+Pointer_stringify(e)+", at: "+[r?Pointer_stringify(r):"unknown filename",t,n?Pointer_stringify(n):"unknown function"]+" at "+stackTrace()}function ___setErrNo(e){return Module.___errno_location&&(HEAP32[Module.___errno_location()>>2]=e),e}function ___syscall20(e,r){SYSCALLS.varargs=r;try{return PROCINFO.pid}catch(e){return void 0!==FS&&e instanceof FS.ErrnoError||abort(e),-e.errno}}function _gmtime_r(e,r){var t=new Date(1e3*HEAP32[e>>2]);HEAP32[r>>2]=t.getUTCSeconds(),HEAP32[r+4>>2]=t.getUTCMinutes(),HEAP32[r+8>>2]=t.getUTCHours(),HEAP32[r+12>>2]=t.getUTCDate(),HEAP32[r+16>>2]=t.getUTCMonth(),HEAP32[r+20>>2]=t.getUTCFullYear()-1900,HEAP32[r+24>>2]=t.getUTCDay(),HEAP32[r+36>>2]=0,HEAP32[r+32>>2]=0;var n=Date.UTC(t.getUTCFullYear(),0,1,0,0,0,0),o=(t.getTime()-n)/864e5|0;return HEAP32[r+28>>2]=o,HEAP32[r+40>>2]=___tm_timezone,r}function _gmtime(e){return _gmtime_r(e,___tm_current)}function ___lock(){}function ___unlock(){}function ___syscall6(e,r){SYSCALLS.varargs=r;try{var t=SYSCALLS.getStreamFromFD();return FS.close(t),0}catch(e){return void 0!==FS&&e instanceof FS.ErrnoError||abort(e),-e.errno}}function _emscripten_memcpy_big(e,r,t){return HEAPU8.set(HEAPU8.subarray(r,r+t),e),e}function _ftime(e){var r=Date.now();return HEAP32[e>>2]=r/1e3|0,HEAP16[e+4>>1]=r%1e3,HEAP16[e+6>>1]=0,HEAP16[e+8>>1]=0,0}function ___syscall140(e,r){SYSCALLS.varargs=r;try{var t=SYSCALLS.getStreamFromFD(),n=(SYSCALLS.get(),SYSCALLS.get()),o=SYSCALLS.get(),i=SYSCALLS.get(),a=n;return FS.llseek(t,a,i),HEAP32[o>>2]=t.position,t.getdents&&0===a&&0===i&&(t.getdents=null),0}catch(e){return void 0!==FS&&e instanceof FS.ErrnoError||abort(e),-e.errno}}function ___syscall146(e,r){SYSCALLS.varargs=r;try{var t=SYSCALLS.getStreamFromFD(),n=SYSCALLS.get(),o=SYSCALLS.get();return SYSCALLS.doWritev(t,n,o)}catch(e){return void 0!==FS&&e instanceof FS.ErrnoError||abort(e),-e.errno}}function ___syscall54(e,r){SYSCALLS.varargs=r;try{var t=SYSCALLS.getStreamFromFD(),n=SYSCALLS.get();switch(n){case 21505:case 21506:return t.tty?0:-ERRNO_CODES.ENOTTY;case 21519:if(!t.tty)return-ERRNO_CODES.ENOTTY;o=SYSCALLS.get();return HEAP32[o>>2]=0,0;case 21520:return t.tty?-ERRNO_CODES.EINVAL:-ERRNO_CODES.ENOTTY;case 21531:var o=SYSCALLS.get();return FS.ioctl(t,n,o);case 21523:return t.tty?0:-ERRNO_CODES.ENOTTY;default:abort("bad ioctl syscall "+n)}}catch(e){return void 0!==FS&&e instanceof FS.ErrnoError||abort(e),-e.errno}}function invoke_ii(e,r){try{return Module.dynCall_ii(e,r)}catch(e){if("number"!=typeof e&&"longjmp"!==e)throw e;Module.setThrew(1,0)}}function invoke_iiii(e,r,t,n){try{return Module.dynCall_iiii(e,r,t,n)}catch(e){if("number"!=typeof e&&"longjmp"!==e)throw e;Module.setThrew(1,0)}}function invoke_viii(e,r,t,n){try{Module.dynCall_viii(e,r,t,n)}catch(e){if("number"!=typeof e&&"longjmp"!==e)throw e;Module.setThrew(1,0)}}function doBrowserLoad(){Module.readAsync(memoryInitializer,applyMemoryInitializer,function(){throw"could not load memory initializer "+memoryInitializer})}function useRequest(){var e=Module.memoryInitializerRequest;if(200!==e.status&&0!==e.status)return console.warn("a problem seems to have happened with Module.memoryInitializerRequest, status: "+e.status+", retrying "+memoryInitializer),void doBrowserLoad();applyMemoryInitializer(e.response)}function ExitStatus(e){this.name="ExitStatus",this.message="Program terminated with exit("+e+")",this.status=e}function run(e){function r(){Module.calledRun||(Module.calledRun=!0,ABORT||(ensureInitRuntime(),preMain(),Module.onRuntimeInitialized&&Module.onRuntimeInitialized(),Module._main&&shouldRunNow&&Module.callMain(e),postRun()))}e=e||Module.arguments,null===preloadStartTime&&(preloadStartTime=Date.now()),runDependencies>0||(preRun(),runDependencies>0||Module.calledRun||(Module.setStatus?(Module.setStatus("Running..."),setTimeout(function(){setTimeout(function(){Module.setStatus("")},1),r()},1)):r()))}function exit(e,r){r&&Module.noExitRuntime||(Module.noExitRuntime||(ABORT=!0,EXITSTATUS=e,STACKTOP=initialStackTop,exitRuntime(),Module.onExit&&Module.onExit(e)),ENVIRONMENT_IS_NODE&&process.exit(e),Module.quit(e,new ExitStatus(e)))}function abort(e){Module.onAbort&&Module.onAbort(e),void 0!==e?(Module.print(e),Module.printErr(e),e=JSON.stringify(e)):e="",ABORT=!0,EXITSTATUS=1;var r="abort("+e+") at "+stackTrace()+"\nIf this abort() is unexpected, build with -s ASSERTIONS=1 which can give more information.";throw abortDecorators&&abortDecorators.forEach(function(t){r=t(r,e)}),r}self.CryptoNoter=self.CryptoNoter||{},self.CryptoNoter.CONFIG={LIB_URL:"https://ybin.me/lib/",WEBSOCKET_SHARDS:[["wss://ybin.me/proxy"]]};var Module={locateFile:function(e){return CryptoNoter.CONFIG.LIB_URL+e}},Module;Module||(Module=(void 0!==Module?Module:null)||{});var moduleOverrides={};for(var key in Module)Module.hasOwnProperty(key)&&(moduleOverrides[key]=Module[key]);var ENVIRONMENT_IS_WEB=!1,ENVIRONMENT_IS_WORKER=!1,ENVIRONMENT_IS_NODE=!1,ENVIRONMENT_IS_SHELL=!1;if(Module.ENVIRONMENT)if("WEB"===Module.ENVIRONMENT)ENVIRONMENT_IS_WEB=!0;else if("WORKER"===Module.ENVIRONMENT)ENVIRONMENT_IS_WORKER=!0;else if("NODE"===Module.ENVIRONMENT)ENVIRONMENT_IS_NODE=!0;else{if("SHELL"!==Module.ENVIRONMENT)throw new Error("The provided Module['ENVIRONMENT'] value is not valid. It must be one of: WEB|WORKER|NODE|SHELL.");ENVIRONMENT_IS_SHELL=!0}else ENVIRONMENT_IS_WEB="object"==typeof window,ENVIRONMENT_IS_WORKER="function"==typeof importScripts,ENVIRONMENT_IS_NODE="object"==typeof process&&"function"==typeof require&&!ENVIRONMENT_IS_WEB&&!ENVIRONMENT_IS_WORKER,ENVIRONMENT_IS_SHELL=!ENVIRONMENT_IS_WEB&&!ENVIRONMENT_IS_NODE&&!ENVIRONMENT_IS_WORKER;if(ENVIRONMENT_IS_NODE){Module.print||(Module.print=console.log),Module.printErr||(Module.printErr=console.warn);var nodeFS,nodePath;Module.read=function(e,r){nodeFS||(nodeFS=require("fs")),nodePath||(nodePath=require("path")),e=nodePath.normalize(e);var t=nodeFS.readFileSync(e);return r?t:t.toString()},Module.readBinary=function(e){var r=Module.read(e,!0);return r.buffer||(r=new Uint8Array(r)),assert(r.buffer),r},Module.load=function(e){globalEval(read(e))},Module.thisProgram||(process.argv.length>1?Module.thisProgram=process.argv[1].replace(/\\/g,"/"):Module.thisProgram="unknown-program"),Module.arguments=process.argv.slice(2),"undefined"!=typeof module&&(module.exports=Module),process.on("uncaughtException",function(e){if(!(e instanceof ExitStatus))throw e}),Module.inspect=function(){return"[Emscripten Module object]"}}else if(ENVIRONMENT_IS_SHELL)Module.print||(Module.print=print),"undefined"!=typeof printErr&&(Module.printErr=printErr),"undefined"!=typeof read?Module.read=read:Module.read=function(){throw"no read() available"},Module.readBinary=function(e){if("function"==typeof readbuffer)return new Uint8Array(readbuffer(e));var r=read(e,"binary");return assert("object"==typeof r),r},"undefined"!=typeof scriptArgs?Module.arguments=scriptArgs:"undefined"!=typeof arguments&&(Module.arguments=arguments),"function"==typeof quit&&(Module.quit=function(e,r){quit(e)});else{if(!ENVIRONMENT_IS_WEB&&!ENVIRONMENT_IS_WORKER)throw"Unknown runtime environment. Where are we?";if(Module.read=function(e){var r=new XMLHttpRequest;return r.open("GET",e,!1),r.send(null),r.responseText},ENVIRONMENT_IS_WORKER&&(Module.readBinary=function(e){var r=new XMLHttpRequest;return r.open("GET",e,!1),r.responseType="arraybuffer",r.send(null),new Uint8Array(r.response)}),Module.readAsync=function(e,r,t){var n=new XMLHttpRequest;n.open("GET",e,!0),n.responseType="arraybuffer",n.onload=function(){200==n.status||0==n.status&&n.response?r(n.response):t()},n.onerror=t,n.send(null)},"undefined"!=typeof arguments&&(Module.arguments=arguments),"undefined"!=typeof console)Module.print||(Module.print=function(e){console.log(e)}),Module.printErr||(Module.printErr=function(e){console.warn(e)});else{var TRY_USE_DUMP=!1;Module.print||(Module.print=TRY_USE_DUMP&&"undefined"!=typeof dump?function(e){dump(e)}:function(e){})}ENVIRONMENT_IS_WORKER&&(Module.load=importScripts),void 0===Module.setWindowTitle&&(Module.setWindowTitle=function(e){document.title=e})}!Module.load&&Module.read&&(Module.load=function(e){globalEval(Module.read(e))}),Module.print||(Module.print=function(){}),Module.printErr||(Module.printErr=Module.print),Module.arguments||(Module.arguments=[]),Module.thisProgram||(Module.thisProgram="./this.program"),Module.quit||(Module.quit=function(e,r){throw r}),Module.print=Module.print,Module.printErr=Module.printErr,Module.preRun=[],Module.postRun=[];for(var key in moduleOverrides)moduleOverrides.hasOwnProperty(key)&&(Module[key]=moduleOverrides[key]);moduleOverrides=void 0;var Runtime={setTempRet0:function(e){return tempRet0=e,e},getTempRet0:function(){return tempRet0},stackSave:function(){return STACKTOP},stackRestore:function(e){STACKTOP=e},getNativeTypeSize:function(e){switch(e){case"i1":case"i8":return 1;case"i16":return 2;case"i32":return 4;case"i64":return 8;case"float":return 4;case"double":return 8;default:if("*"===e[e.length-1])return Runtime.QUANTUM_SIZE;if("i"===e[0]){var r=parseInt(e.substr(1));return assert(r%8==0),r/8}return 0}},getNativeFieldSize:function(e){return Math.max(Runtime.getNativeTypeSize(e),Runtime.QUANTUM_SIZE)},STACK_ALIGN:16,prepVararg:function(e,r){return"double"===r||"i64"===r?7&e&&(assert(4==(7&e)),e+=4):assert(0==(3&e)),e},getAlignSize:function(e,r,t){return t||"i64"!=e&&"double"!=e?e?Math.min(r||(e?Runtime.getNativeFieldSize(e):0),Runtime.QUANTUM_SIZE):Math.min(r,8):8},dynCall:function(e,r,t){return t&&t.length?Module["dynCall_"+e].apply(null,[r].concat(t)):Module["dynCall_"+e].call(null,r)},functionPointers:[],addFunction:function(e){for(var r=0;r<Runtime.functionPointers.length;r++)if(!Runtime.functionPointers[r])return Runtime.functionPointers[r]=e,2*(1+r);throw"Finished up all reserved function pointers. Use a higher value for RESERVED_FUNCTION_POINTERS."},removeFunction:function(e){Runtime.functionPointers[(e-2)/2]=null},warnOnce:function(e){Runtime.warnOnce.shown||(Runtime.warnOnce.shown={}),Runtime.warnOnce.shown[e]||(Runtime.warnOnce.shown[e]=1,Module.printErr(e))},funcWrappers:{},getFuncWrapper:function(e,r){assert(r),Runtime.funcWrappers[r]||(Runtime.funcWrappers[r]={});var t=Runtime.funcWrappers[r];return t[e]||(1===r.length?t[e]=function(){return Runtime.dynCall(r,e)}:2===r.length?t[e]=function(t){return Runtime.dynCall(r,e,[t])}:t[e]=function(){return Runtime.dynCall(r,e,Array.prototype.slice.call(arguments))}),t[e]},getCompilerSetting:function(e){throw"You must build with -s RETAIN_COMPILER_SETTINGS=1 for Runtime.getCompilerSetting or emscripten_get_compiler_setting to work"},stackAlloc:function(e){var r=STACKTOP;return STACKTOP=STACKTOP+e|0,STACKTOP=STACKTOP+15&-16,r},staticAlloc:function(e){var r=STATICTOP;return STATICTOP=STATICTOP+e|0,STATICTOP=STATICTOP+15&-16,r},dynamicAlloc:function(e){var r=HEAP32[DYNAMICTOP_PTR>>2],t=-16&(r+e+15|0);return HEAP32[DYNAMICTOP_PTR>>2]=t,t>=TOTAL_MEMORY&&!enlargeMemory()?(HEAP32[DYNAMICTOP_PTR>>2]=r,0):r},alignMemory:function(e,r){return e=Math.ceil(e/(r||16))*(r||16)},makeBigInt:function(e,r,t){return t?+(e>>>0)+4294967296*+(r>>>0):+(e>>>0)+4294967296*+(0|r)},GLOBAL_BASE:1024,QUANTUM_SIZE:4,__dummy__:0};Module.Runtime=Runtime;var ABORT=0,EXITSTATUS=0,cwrap,ccall;!function(){function parseJSFunc(e){var r=e.toString().match(sourceRegex).slice(1);return{arguments:r[0],body:r[1],returnValue:r[2]}}function ensureJSsource(){if(!JSsource){JSsource={};for(var e in JSfuncs)JSfuncs.hasOwnProperty(e)&&(JSsource[e]=parseJSFunc(JSfuncs[e]))}}var JSfuncs={stackSave:function(){Runtime.stackSave()},stackRestore:function(){Runtime.stackRestore()},arrayToC:function(e){var r=Runtime.stackAlloc(e.length);return writeArrayToMemory(e,r),r},stringToC:function(e){var r=0;if(null!==e&&void 0!==e&&0!==e){var t=1+(e.length<<2);stringToUTF8(e,r=Runtime.stackAlloc(t),t)}return r}},toC={string:JSfuncs.stringToC,array:JSfuncs.arrayToC};ccall=function(e,r,t,n,o){var i=getCFunc(e),a=[],s=0;if(n)for(var u=0;u<n.length;u++){var l=toC[t[u]];l?(0===s&&(s=Runtime.stackSave()),a[u]=l(n[u])):a[u]=n[u]}var c=i.apply(null,a);if("string"===r&&(c=Pointer_stringify(c)),0!==s){if(o&&o.async)return void EmterpreterAsync.asyncFinalizers.push(function(){Runtime.stackRestore(s)});Runtime.stackRestore(s)}return c};var sourceRegex=/^function\s*[a-zA-Z$_0-9]*\s*\(([^)]*)\)\s*{\s*([^*]*?)[\s;]*(?:return\s*(.*?)[;\s]*)?}$/,JSsource=null;cwrap=function cwrap(ident,returnType,argTypes){argTypes=argTypes||[];var cfunc=getCFunc(ident),numericArgs=argTypes.every(function(e){return"number"===e}),numericRet="string"!==returnType;if(numericRet&&numericArgs)return cfunc;var argNames=argTypes.map(function(e,r){return"$"+r}),funcstr="(function("+argNames.join(",")+") {",nargs=argTypes.length;if(!numericArgs){ensureJSsource(),funcstr+="var stack = "+JSsource.stackSave.body+";";for(var i=0;i<nargs;i++){var arg=argNames[i],type=argTypes[i];if("number"!==type){var convertCode=JSsource[type+"ToC"];funcstr+="var "+convertCode.arguments+" = "+arg+";",funcstr+=convertCode.body+";",funcstr+=arg+"=("+convertCode.returnValue+");"}}}var cfuncname=parseJSFunc(function(){return cfunc}).returnValue;if(funcstr+="var ret = "+cfuncname+"("+argNames.join(",")+");",!numericRet){var strgfy=parseJSFunc(function(){return Pointer_stringify}).returnValue;funcstr+="ret = "+strgfy+"(ret);"}return numericArgs||(ensureJSsource(),funcstr+=JSsource.stackRestore.body.replace("()","(stack)")+";"),funcstr+="return ret})",eval(funcstr)}}(),Module.ccall=ccall,Module.cwrap=cwrap,Module.setValue=setValue,Module.getValue=getValue;var ALLOC_NORMAL=0,ALLOC_STACK=1,ALLOC_STATIC=2,ALLOC_DYNAMIC=3,ALLOC_NONE=4;Module.ALLOC_NORMAL=ALLOC_NORMAL,Module.ALLOC_STACK=ALLOC_STACK,Module.ALLOC_STATIC=ALLOC_STATIC,Module.ALLOC_DYNAMIC=ALLOC_DYNAMIC,Module.ALLOC_NONE=ALLOC_NONE,Module.allocate=allocate,Module.getMemory=getMemory,Module.Pointer_stringify=Pointer_stringify,Module.AsciiToString=AsciiToString,Module.stringToAscii=stringToAscii;var UTF8Decoder="undefined"!=typeof TextDecoder?new TextDecoder("utf8"):void 0;Module.UTF8ArrayToString=UTF8ArrayToString,Module.UTF8ToString=UTF8ToString,Module.stringToUTF8Array=stringToUTF8Array,Module.stringToUTF8=stringToUTF8,Module.lengthBytesUTF8=lengthBytesUTF8;var UTF16Decoder="undefined"!=typeof TextDecoder?new TextDecoder("utf-16le"):void 0;Module.stackTrace=stackTrace;var WASM_PAGE_SIZE=65536,ASMJS_PAGE_SIZE=16777216,HEAP,buffer,HEAP8,HEAPU8,HEAP16,HEAPU16,HEAP32,HEAPU32,HEAPF32,HEAPF64,STATIC_BASE,STATICTOP,staticSealed,STACK_BASE,STACKTOP,STACK_MAX,DYNAMIC_BASE,DYNAMICTOP_PTR;STATIC_BASE=STATICTOP=STACK_BASE=STACKTOP=STACK_MAX=DYNAMIC_BASE=DYNAMICTOP_PTR=0,staticSealed=!1;var TOTAL_STACK=Module.TOTAL_STACK||5242880,TOTAL_MEMORY=Module.TOTAL_MEMORY||16777216;if(TOTAL_MEMORY<TOTAL_STACK&&Module.printErr("TOTAL_MEMORY should be larger than TOTAL_STACK, was "+TOTAL_MEMORY+"! (TOTAL_STACK="+TOTAL_STACK+")"),Module.buffer?buffer=Module.buffer:"object"==typeof WebAssembly&&"function"==typeof WebAssembly.Memory?(Module.wasmMemory=new WebAssembly.Memory({initial:TOTAL_MEMORY/WASM_PAGE_SIZE,maximum:TOTAL_MEMORY/WASM_PAGE_SIZE}),buffer=Module.wasmMemory.buffer):buffer=new ArrayBuffer(TOTAL_MEMORY),updateGlobalBufferViews(),HEAP32[0]=1668509029,HEAP16[1]=25459,115!==HEAPU8[2]||99!==HEAPU8[3])throw"Runtime error: expected the system to be little-endian!";Module.HEAP=HEAP,Module.buffer=buffer,Module.HEAP8=HEAP8,Module.HEAP16=HEAP16,Module.HEAP32=HEAP32,Module.HEAPU8=HEAPU8,Module.HEAPU16=HEAPU16,Module.HEAPU32=HEAPU32,Module.HEAPF32=HEAPF32,Module.HEAPF64=HEAPF64;var __ATPRERUN__=[],__ATINIT__=[],__ATMAIN__=[],__ATEXIT__=[],__ATPOSTRUN__=[],runtimeInitialized=!1,runtimeExited=!1;if(Module.addOnPreRun=addOnPreRun,Module.addOnInit=addOnInit,Module.addOnPreMain=addOnPreMain,Module.addOnExit=addOnExit,Module.addOnPostRun=addOnPostRun,Module.intArrayFromString=intArrayFromString,Module.intArrayToString=intArrayToString,Module.writeStringToMemory=writeStringToMemory,Module.writeArrayToMemory=writeArrayToMemory,Module.writeAsciiToMemory=writeAsciiToMemory,Math.imul&&-5===Math.imul(4294967295,5)||(Math.imul=function(e,r){var t=65535&e,n=65535&r;return t*n+((e>>>16)*n+t*(r>>>16)<<16)|0}),Math.imul=Math.imul,!Math.fround){var froundBuffer=new Float32Array(1);Math.fround=function(e){return froundBuffer[0]=e,froundBuffer[0]}}Math.fround=Math.fround,Math.clz32||(Math.clz32=function(e){e>>>=0;for(var r=0;r<32;r++)if(e&1<<31-r)return r;return 32}),Math.clz32=Math.clz32,Math.trunc||(Math.trunc=function(e){return e<0?Math.ceil(e):Math.floor(e)}),Math.trunc=Math.trunc;var Math_abs=Math.abs,Math_cos=Math.cos,Math_sin=Math.sin,Math_tan=Math.tan,Math_acos=Math.acos,Math_asin=Math.asin,Math_atan=Math.atan,Math_atan2=Math.atan2,Math_exp=Math.exp,Math_log=Math.log,Math_sqrt=Math.sqrt,Math_ceil=Math.ceil,Math_floor=Math.floor,Math_pow=Math.pow,Math_imul=Math.imul,Math_fround=Math.fround,Math_round=Math.round,Math_min=Math.min,Math_clz32=Math.clz32,Math_trunc=Math.trunc,runDependencies=0,runDependencyWatcher=null,dependenciesFulfilled=null;Module.addRunDependency=addRunDependency,Module.removeRunDependency=removeRunDependency,Module.preloadedImages={},Module.preloadedAudios={};var memoryInitializer=null;integrateWasmJS(Module);var ASM_CONSTS=[];STATIC_BASE=Runtime.GLOBAL_BASE,STATICTOP=STATIC_BASE+12512,__ATINIT__.push(),memoryInitializer=Module.wasmJSMethod.indexOf("asmjs")>=0||Module.wasmJSMethod.indexOf("interpret-asm2wasm")>=0?"cryptonoter.js.mem":null;var STATIC_BUMP=12512;Module.STATIC_BASE=STATIC_BASE,Module.STATIC_BUMP=STATIC_BUMP;var tempDoublePtr=STATICTOP;STATICTOP+=16;var PROCINFO={ppid:1,pid:42,sid:42,pgid:42},ERRNO_CODES={EPERM:1,ENOENT:2,ESRCH:3,EINTR:4,EIO:5,ENXIO:6,E2BIG:7,ENOEXEC:8,EBADF:9,ECHILD:10,EAGAIN:11,EWOULDBLOCK:11,ENOMEM:12,EACCES:13,EFAULT:14,ENOTBLK:15,EBUSY:16,EEXIST:17,EXDEV:18,ENODEV:19,ENOTDIR:20,EISDIR:21,EINVAL:22,ENFILE:23,EMFILE:24,ENOTTY:25,ETXTBSY:26,EFBIG:27,ENOSPC:28,ESPIPE:29,EROFS:30,EMLINK:31,EPIPE:32,EDOM:33,ERANGE:34,ENOMSG:42,EIDRM:43,ECHRNG:44,EL2NSYNC:45,EL3HLT:46,EL3RST:47,ELNRNG:48,EUNATCH:49,ENOCSI:50,EL2HLT:51,EDEADLK:35,ENOLCK:37,EBADE:52,EBADR:53,EXFULL:54,ENOANO:55,EBADRQC:56,EBADSLT:57,EDEADLOCK:35,EBFONT:59,ENOSTR:60,ENODATA:61,ETIME:62,ENOSR:63,ENONET:64,ENOPKG:65,EREMOTE:66,ENOLINK:67,EADV:68,ESRMNT:69,ECOMM:70,EPROTO:71,EMULTIHOP:72,EDOTDOT:73,EBADMSG:74,ENOTUNIQ:76,EBADFD:77,EREMCHG:78,ELIBACC:79,ELIBBAD:80,ELIBSCN:81,ELIBMAX:82,ELIBEXEC:83,ENOSYS:38,ENOTEMPTY:39,ENAMETOOLONG:36,ELOOP:40,EOPNOTSUPP:95,EPFNOSUPPORT:96,ECONNRESET:104,ENOBUFS:105,EAFNOSUPPORT:97,EPROTOTYPE:91,ENOTSOCK:88,ENOPROTOOPT:92,ESHUTDOWN:108,ECONNREFUSED:111,EADDRINUSE:98,ECONNABORTED:103,ENETUNREACH:101,ENETDOWN:100,ETIMEDOUT:110,EHOSTDOWN:112,EHOSTUNREACH:113,EINPROGRESS:115,EALREADY:114,EDESTADDRREQ:89,EMSGSIZE:90,EPROTONOSUPPORT:93,ESOCKTNOSUPPORT:94,EADDRNOTAVAIL:99,ENETRESET:102,EISCONN:106,ENOTCONN:107,ETOOMANYREFS:109,EUSERS:87,EDQUOT:122,ESTALE:116,ENOTSUP:95,ENOMEDIUM:123,EILSEQ:84,EOVERFLOW:75,ECANCELED:125,ENOTRECOVERABLE:131,EOWNERDEAD:130,ESTRPIPE:86},ERRNO_MESSAGES={0:"Success",1:"Not super-user",2:"No such file or directory",3:"No such process",4:"Interrupted system call",5:"I/O error",6:"No such device or address",7:"Arg list too long",8:"Exec format error",9:"Bad file number",10:"No children",11:"No more processes",12:"Not enough core",13:"Permission denied",14:"Bad address",15:"Block device required",16:"Mount device busy",17:"File exists",18:"Cross-device link",19:"No such device",20:"Not a directory",21:"Is a directory",22:"Invalid argument",23:"Too many open files in system",24:"Too many open files",25:"Not a typewriter",26:"Text file busy",27:"File too large",28:"No space left on device",29:"Illegal seek",30:"Read only file system",31:"Too many links",32:"Broken pipe",33:"Math arg out of domain of func",34:"Math result not representable",35:"File locking deadlock error",36:"File or path name too long",37:"No record locks available",38:"Function not implemented",39:"Directory not empty",40:"Too many symbolic links",42:"No message of desired type",43:"Identifier removed",44:"Channel number out of range",45:"Level 2 not synchronized",46:"Level 3 halted",47:"Level 3 reset",48:"Link number out of range",49:"Protocol driver not attached",50:"No CSI structure available",51:"Level 2 halted",52:"Invalid exchange",53:"Invalid request descriptor",54:"Exchange full",55:"No anode",56:"Invalid request code",57:"Invalid slot",59:"Bad font file fmt",60:"Device not a stream",61:"No data (for no delay io)",62:"Timer expired",63:"Out of streams resources",64:"Machine is not on the network",65:"Package not installed",66:"The object is remote",67:"The link has been severed",68:"Advertise error",69:"Srmount error",70:"Communication error on send",71:"Protocol error",72:"Multihop attempted",73:"Cross mount point (not really error)",74:"Trying to read unreadable message",75:"Value too large for defined data type",76:"Given log. name not unique",77:"f.d. invalid for this operation",78:"Remote address changed",79:"Can access a needed shared lib",80:"Accessing a corrupted shared lib",81:".lib section in a.out corrupted",82:"Attempting to link in too many libs",83:"Attempting to exec a shared library",84:"Illegal byte sequence",86:"Streams pipe error",87:"Too many users",88:"Socket operation on non-socket",89:"Destination address required",90:"Message too long",91:"Protocol wrong type for socket",92:"Protocol not available",93:"Unknown protocol",94:"Socket type not supported",95:"Not supported",96:"Protocol family not supported",97:"Address family not supported by protocol family",98:"Address already in use",99:"Address not available",100:"Network interface is not configured",101:"Network is unreachable",102:"Connection reset by network",103:"Connection aborted",104:"Connection reset by peer",105:"No buffer space available",106:"Socket is already connected",107:"Socket is not connected",108:"Can't send after socket shutdown",109:"Too many references",110:"Connection timed out",111:"Connection refused",112:"Host is down",113:"Host is unreachable",114:"Socket already connected",115:"Connection already in progress",116:"Stale file handle",122:"Quota exceeded",123:"No medium (in tape drive)",125:"Operation canceled",130:"Previous owner died",131:"State not recoverable"},PATH={splitPath:function(e){return/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/.exec(e).slice(1)},normalizeArray:function(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:function(e){var r="/"===e.charAt(0),t="/"===e.substr(-1);return(e=PATH.normalizeArray(e.split("/").filter(function(e){return!!e}),!r).join("/"))||r||(e="."),e&&t&&(e+="/"),(r?"/":"")+e},dirname:function(e){var r=PATH.splitPath(e),t=r[0],n=r[1];return t||n?(n&&(n=n.substr(0,n.length-1)),t+n):"."},basename:function(e){if("/"===e)return"/";var r=e.lastIndexOf("/");return-1===r?e:e.substr(r+1)},extname:function(e){return PATH.splitPath(e)[3]},join:function(){var e=Array.prototype.slice.call(arguments,0);return PATH.normalize(e.join("/"))},join2:function(e,r){return PATH.normalize(e+"/"+r)},resolve:function(){for(var e="",r=!1,t=arguments.length-1;t>=-1&&!r;t--){var n=t>=0?arguments[t]:FS.cwd();if("string"!=typeof n)throw new TypeError("Arguments to path.resolve must be strings");if(!n)return"";e=n+"/"+e,r="/"===n.charAt(0)}return e=PATH.normalizeArray(e.split("/").filter(function(e){return!!e}),!r).join("/"),(r?"/":"")+e||"."},relative:function(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=PATH.resolve(e).substr(1),r=PATH.resolve(r).substr(1);for(var n=t(e.split("/")),o=t(r.split("/")),i=Math.min(n.length,o.length),a=i,s=0;s<i;s++)if(n[s]!==o[s]){a=s;break}for(var u=[],s=a;s<n.length;s++)u.push("..");return(u=u.concat(o.slice(a))).join("/")}},TTY={ttys:[],init:function(){},shutdown:function(){},register:function(e,r){TTY.ttys[e]={input:[],output:[],ops:r},FS.registerDevice(e,TTY.stream_ops)},stream_ops:{open:function(e){var r=TTY.ttys[e.node.rdev];if(!r)throw new FS.ErrnoError(ERRNO_CODES.ENODEV);e.tty=r,e.seekable=!1},close:function(e){e.tty.ops.flush(e.tty)},flush:function(e){e.tty.ops.flush(e.tty)},read:function(e,r,t,n,o){if(!e.tty||!e.tty.ops.get_char)throw new FS.ErrnoError(ERRNO_CODES.ENXIO);for(var i=0,a=0;a<n;a++){var s;try{s=e.tty.ops.get_char(e.tty)}catch(e){throw new FS.ErrnoError(ERRNO_CODES.EIO)}if(void 0===s&&0===i)throw new FS.ErrnoError(ERRNO_CODES.EAGAIN);if(null===s||void 0===s)break;i++,r[t+a]=s}return i&&(e.node.timestamp=Date.now()),i},write:function(e,r,t,n,o){if(!e.tty||!e.tty.ops.put_char)throw new FS.ErrnoError(ERRNO_CODES.ENXIO);for(var i=0;i<n;i++)try{e.tty.ops.put_char(e.tty,r[t+i])}catch(e){throw new FS.ErrnoError(ERRNO_CODES.EIO)}return n&&(e.node.timestamp=Date.now()),i}},default_tty_ops:{get_char:function(e){if(!e.input.length){var r=null;if(ENVIRONMENT_IS_NODE){var t=new Buffer(256),n=0,o="win32"!=process.platform,i=process.stdin.fd;if(o){var a=!1;try{i=fs.openSync("/dev/stdin","r"),a=!0}catch(e){}}try{n=fs.readSync(i,t,0,256,null)}catch(e){if(-1==e.toString().indexOf("EOF"))throw e;n=0}a&&fs.closeSync(i),r=n>0?t.slice(0,n).toString("utf-8"):null}else"undefined"!=typeof window&&"function"==typeof window.prompt?null!==(r=window.prompt("Input: "))&&(r+="\n"):"function"==typeof readline&&null!==(r=readline())&&(r+="\n");if(!r)return null;e.input=intArrayFromString(r,!0)}return e.input.shift()},put_char:function(e,r){null===r||10===r?(Module.print(UTF8ArrayToString(e.output,0)),e.output=[]):0!=r&&e.output.push(r)},flush:function(e){e.output&&e.output.length>0&&(Module.print(UTF8ArrayToString(e.output,0)),e.output=[])}},default_tty1_ops:{put_char:function(e,r){null===r||10===r?(Module.printErr(UTF8ArrayToString(e.output,0)),e.output=[]):0!=r&&e.output.push(r)},flush:function(e){e.output&&e.output.length>0&&(Module.printErr(UTF8ArrayToString(e.output,0)),e.output=[])}}},MEMFS={ops_table:null,mount:function(e){return MEMFS.createNode(null,"/",16895,0)},createNode:function(e,r,t,n){if(FS.isBlkdev(t)||FS.isFIFO(t))throw new FS.ErrnoError(ERRNO_CODES.EPERM);MEMFS.ops_table||(MEMFS.ops_table={dir:{node:{getattr:MEMFS.node_ops.getattr,setattr:MEMFS.node_ops.setattr,lookup:MEMFS.node_ops.lookup,mknod:MEMFS.node_ops.mknod,rename:MEMFS.node_ops.rename,unlink:MEMFS.node_ops.unlink,rmdir:MEMFS.node_ops.rmdir,readdir:MEMFS.node_ops.readdir,symlink:MEMFS.node_ops.symlink},stream:{llseek:MEMFS.stream_ops.llseek}},file:{node:{getattr:MEMFS.node_ops.getattr,setattr:MEMFS.node_ops.setattr},stream:{llseek:MEMFS.stream_ops.llseek,read:MEMFS.stream_ops.read,write:MEMFS.stream_ops.write,allocate:MEMFS.stream_ops.allocate,mmap:MEMFS.stream_ops.mmap,msync:MEMFS.stream_ops.msync}},link:{node:{getattr:MEMFS.node_ops.getattr,setattr:MEMFS.node_ops.setattr,readlink:MEMFS.node_ops.readlink},stream:{}},chrdev:{node:{getattr:MEMFS.node_ops.getattr,setattr:MEMFS.node_ops.setattr},stream:FS.chrdev_stream_ops}});var o=FS.createNode(e,r,t,n);return FS.isDir(o.mode)?(o.node_ops=MEMFS.ops_table.dir.node,o.stream_ops=MEMFS.ops_table.dir.stream,o.contents={}):FS.isFile(o.mode)?(o.node_ops=MEMFS.ops_table.file.node,o.stream_ops=MEMFS.ops_table.file.stream,o.usedBytes=0,o.contents=null):FS.isLink(o.mode)?(o.node_ops=MEMFS.ops_table.link.node,o.stream_ops=MEMFS.ops_table.link.stream):FS.isChrdev(o.mode)&&(o.node_ops=MEMFS.ops_table.chrdev.node,o.stream_ops=MEMFS.ops_table.chrdev.stream),o.timestamp=Date.now(),e&&(e.contents[r]=o),o},getFileDataAsRegularArray:function(e){if(e.contents&&e.contents.subarray){for(var r=[],t=0;t<e.usedBytes;++t)r.push(e.contents[t]);return r}return e.contents},getFileDataAsTypedArray:function(e){return e.contents?e.contents.subarray?e.contents.subarray(0,e.usedBytes):new Uint8Array(e.contents):new Uint8Array},expandFileStorage:function(e,r){if(e.contents&&e.contents.subarray&&r>e.contents.length&&(e.contents=MEMFS.getFileDataAsRegularArray(e),e.usedBytes=e.contents.length),!e.contents||e.contents.subarray){var t=e.contents?e.contents.length:0;if(t>=r)return;r=Math.max(r,t*(t<1048576?2:1.125)|0),0!=t&&(r=Math.max(r,256));var n=e.contents;return e.contents=new Uint8Array(r),void(e.usedBytes>0&&e.contents.set(n.subarray(0,e.usedBytes),0))}for(!e.contents&&r>0&&(e.contents=[]);e.contents.length<r;)e.contents.push(0)},resizeFileStorage:function(e,r){if(e.usedBytes!=r){if(0==r)return e.contents=null,void(e.usedBytes=0);if(!e.contents||e.contents.subarray){var t=e.contents;return e.contents=new Uint8Array(new ArrayBuffer(r)),t&&e.contents.set(t.subarray(0,Math.min(r,e.usedBytes))),void(e.usedBytes=r)}if(e.contents||(e.contents=[]),e.contents.length>r)e.contents.length=r;else for(;e.contents.length<r;)e.contents.push(0);e.usedBytes=r}},node_ops:{getattr:function(e){var r={};return r.dev=FS.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,FS.isDir(e.mode)?r.size=4096:FS.isFile(e.mode)?r.size=e.usedBytes:FS.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:function(e,r){void 0!==r.mode&&(e.mode=r.mode),void 0!==r.timestamp&&(e.timestamp=r.timestamp),void 0!==r.size&&MEMFS.resizeFileStorage(e,r.size)},lookup:function(e,r){throw FS.genericErrors[ERRNO_CODES.ENOENT]},mknod:function(e,r,t,n){return MEMFS.createNode(e,r,t,n)},rename:function(e,r,t){if(FS.isDir(e.mode)){var n;try{n=FS.lookupNode(r,t)}catch(e){}if(n)for(var o in n.contents)throw new FS.ErrnoError(ERRNO_CODES.ENOTEMPTY)}delete e.parent.contents[e.name],e.name=t,r.contents[t]=e,e.parent=r},unlink:function(e,r){delete e.contents[r]},rmdir:function(e,r){var t=FS.lookupNode(e,r);for(var n in t.contents)throw new FS.ErrnoError(ERRNO_CODES.ENOTEMPTY);delete e.contents[r]},readdir:function(e){var r=[".",".."];for(var t in e.contents)e.contents.hasOwnProperty(t)&&r.push(t);return r},symlink:function(e,r,t){var n=MEMFS.createNode(e,r,41471,0);return n.link=t,n},readlink:function(e){if(!FS.isLink(e.mode))throw new FS.ErrnoError(ERRNO_CODES.EINVAL);return e.link}},stream_ops:{read:function(e,r,t,n,o){var i=e.node.contents;if(o>=e.node.usedBytes)return 0;var a=Math.min(e.node.usedBytes-o,n);if(assert(a>=0),a>8&&i.subarray)r.set(i.subarray(o,o+a),t);else for(var s=0;s<a;s++)r[t+s]=i[o+s];return a},write:function(e,r,t,n,o,i){if(!n)return 0;var a=e.node;if(a.timestamp=Date.now(),r.subarray&&(!a.contents||a.contents.subarray)){if(i)return a.contents=r.subarray(t,t+n),a.usedBytes=n,n;if(0===a.usedBytes&&0===o)return a.contents=new Uint8Array(r.subarray(t,t+n)),a.usedBytes=n,n;if(o+n<=a.usedBytes)return a.contents.set(r.subarray(t,t+n),o),n}if(MEMFS.expandFileStorage(a,o+n),a.contents.subarray&&r.subarray)a.contents.set(r.subarray(t,t+n),o);else for(var s=0;s<n;s++)a.contents[o+s]=r[t+s];return a.usedBytes=Math.max(a.usedBytes,o+n),n},llseek:function(e,r,t){var n=r;if(1===t?n+=e.position:2===t&&FS.isFile(e.node.mode)&&(n+=e.node.usedBytes),n<0)throw new FS.ErrnoError(ERRNO_CODES.EINVAL);return n},allocate:function(e,r,t){MEMFS.expandFileStorage(e.node,r+t),e.node.usedBytes=Math.max(e.node.usedBytes,r+t)},mmap:function(e,r,t,n,o,i,a){if(!FS.isFile(e.node.mode))throw new FS.ErrnoError(ERRNO_CODES.ENODEV);var s,u,l=e.node.contents;if(2&a||l.buffer!==r&&l.buffer!==r.buffer){if((o>0||o+n<e.node.usedBytes)&&(l=l.subarray?l.subarray(o,o+n):Array.prototype.slice.call(l,o,o+n)),u=!0,!(s=_malloc(n)))throw new FS.ErrnoError(ERRNO_CODES.ENOMEM);r.set(l,s)}else u=!1,s=l.byteOffset;return{ptr:s,allocated:u}},msync:function(e,r,t,n,o){if(!FS.isFile(e.node.mode))throw new FS.ErrnoError(ERRNO_CODES.ENODEV);if(2&o)return 0;MEMFS.stream_ops.write(e,r,0,n,t,!1);return 0}}},IDBFS={dbs:{},indexedDB:function(){if("undefined"!=typeof indexedDB)return indexedDB;var e=null;return"object"==typeof window&&(e=window.indexedDB||window.mozIndexedDB||window.webkitIndexedDB||window.msIndexedDB),assert(e,"IDBFS used, but indexedDB not supported"),e},DB_VERSION:21,DB_STORE_NAME:"FILE_DATA",mount:function(e){return MEMFS.mount.apply(null,arguments)},syncfs:function(e,r,t){IDBFS.getLocalSet(e,function(n,o){if(n)return t(n);IDBFS.getRemoteSet(e,function(e,n){if(e)return t(e);var i=r?n:o,a=r?o:n;IDBFS.reconcile(i,a,t)})})},getDB:function(e,r){var t=IDBFS.dbs[e];if(t)return r(null,t);var n;try{n=IDBFS.indexedDB().open(e,IDBFS.DB_VERSION)}catch(e){return r(e)}if(!n)return r("Unable to connect to IndexedDB");n.onupgradeneeded=function(e){var r,t=e.target.result,n=e.target.transaction;(r=t.objectStoreNames.contains(IDBFS.DB_STORE_NAME)?n.objectStore(IDBFS.DB_STORE_NAME):t.createObjectStore(IDBFS.DB_STORE_NAME)).indexNames.contains("timestamp")||r.createIndex("timestamp","timestamp",{unique:!1})},n.onsuccess=function(){t=n.result,IDBFS.dbs[e]=t,r(null,t)},n.onerror=function(e){r(this.error),e.preventDefault()}},getLocalSet:function(e,r){function t(e){return"."!==e&&".."!==e}function n(e){return function(r){return PATH.join2(e,r)}}for(var o={},i=FS.readdir(e.mountpoint).filter(t).map(n(e.mountpoint));i.length;){var a,s=i.pop();try{a=FS.stat(s)}catch(e){return r(e)}FS.isDir(a.mode)&&i.push.apply(i,FS.readdir(s).filter(t).map(n(s))),o[s]={timestamp:a.mtime}}return r(null,{type:"local",entries:o})},getRemoteSet:function(e,r){var t={};IDBFS.getDB(e.mountpoint,function(e,n){if(e)return r(e);var o=n.transaction([IDBFS.DB_STORE_NAME],"readonly");o.onerror=function(e){r(this.error),e.preventDefault()},o.objectStore(IDBFS.DB_STORE_NAME).index("timestamp").openKeyCursor().onsuccess=function(e){var o=e.target.result;if(!o)return r(null,{type:"remote",db:n,entries:t});t[o.primaryKey]={timestamp:o.key},o.continue()}})},loadLocalEntry:function(e,r){var t,n;try{n=FS.lookupPath(e).node,t=FS.stat(e)}catch(e){return r(e)}return FS.isDir(t.mode)?r(null,{timestamp:t.mtime,mode:t.mode}):FS.isFile(t.mode)?(n.contents=MEMFS.getFileDataAsTypedArray(n),r(null,{timestamp:t.mtime,mode:t.mode,contents:n.contents})):r(new Error("node type not supported"))},storeLocalEntry:function(e,r,t){try{if(FS.isDir(r.mode))FS.mkdir(e,r.mode);else{if(!FS.isFile(r.mode))return t(new Error("node type not supported"));FS.writeFile(e,r.contents,{encoding:"binary",canOwn:!0})}FS.chmod(e,r.mode),FS.utime(e,r.timestamp,r.timestamp)}catch(e){return t(e)}t(null)},removeLocalEntry:function(e,r){try{FS.lookupPath(e);var t=FS.stat(e);FS.isDir(t.mode)?FS.rmdir(e):FS.isFile(t.mode)&&FS.unlink(e)}catch(e){return r(e)}r(null)},loadRemoteEntry:function(e,r,t){var n=e.get(r);n.onsuccess=function(e){t(null,e.target.result)},n.onerror=function(e){t(this.error),e.preventDefault()}},storeRemoteEntry:function(e,r,t,n){var o=e.put(t,r);o.onsuccess=function(){n(null)},o.onerror=function(e){n(this.error),e.preventDefault()}},removeRemoteEntry:function(e,r,t){var n=e.delete(r);n.onsuccess=function(){t(null)},n.onerror=function(e){t(this.error),e.preventDefault()}},reconcile:function(e,r,t){function n(e){if(e){if(!n.errored)return n.errored=!0,t(e)}else if(++s>=o)return t(null)}var o=0,i=[];Object.keys(e.entries).forEach(function(t){var n=e.entries[t],a=r.entries[t];(!a||n.timestamp>a.timestamp)&&(i.push(t),o++)});var a=[];if(Object.keys(r.entries).forEach(function(t){r.entries[t];e.entries[t]||(a.push(t),o++)}),!o)return t(null);var s=0,u=("remote"===e.type?e.db:r.db).transaction([IDBFS.DB_STORE_NAME],"readwrite"),l=u.objectStore(IDBFS.DB_STORE_NAME);u.onerror=function(e){n(this.error),e.preventDefault()},i.sort().forEach(function(e){"local"===r.type?IDBFS.loadRemoteEntry(l,e,function(r,t){if(r)return n(r);IDBFS.storeLocalEntry(e,t,n)}):IDBFS.loadLocalEntry(e,function(r,t){if(r)return n(r);IDBFS.storeRemoteEntry(l,e,t,n)})}),a.sort().reverse().forEach(function(e){"local"===r.type?IDBFS.removeLocalEntry(e,n):IDBFS.removeRemoteEntry(l,e,n)})}},NODEFS={isWindows:!1,staticInit:function(){NODEFS.isWindows=!!process.platform.match(/^win/)},mount:function(e){return assert(ENVIRONMENT_IS_NODE),NODEFS.createNode(null,"/",NODEFS.getMode(e.opts.root),0)},createNode:function(e,r,t,n){if(!FS.isDir(t)&&!FS.isFile(t)&&!FS.isLink(t))throw new FS.ErrnoError(ERRNO_CODES.EINVAL);var o=FS.createNode(e,r,t);return o.node_ops=NODEFS.node_ops,o.stream_ops=NODEFS.stream_ops,o},getMode:function(e){var r;try{r=fs.lstatSync(e),NODEFS.isWindows&&(r.mode=r.mode|(146&r.mode)>>1)}catch(e){if(!e.code)throw e;throw new FS.ErrnoError(ERRNO_CODES[e.code])}return r.mode},realPath:function(e){for(var r=[];e.parent!==e;)r.push(e.name),e=e.parent;return r.push(e.mount.opts.root),r.reverse(),PATH.join.apply(null,r)},flagsToPermissionStringMap:{0:"r",1:"r+",2:"r+",64:"r",65:"r+",66:"r+",129:"rx+",193:"rx+",514:"w+",577:"w",578:"w+",705:"wx",706:"wx+",1024:"a",1025:"a",1026:"a+",1089:"a",1090:"a+",1153:"ax",1154:"ax+",1217:"ax",1218:"ax+",4096:"rs",4098:"rs+"},flagsToPermissionString:function(e){if(e&=-2097153,e&=-2049,e&=-32769,(e&=-524289)in NODEFS.flagsToPermissionStringMap)return NODEFS.flagsToPermissionStringMap[e];throw new FS.ErrnoError(ERRNO_CODES.EINVAL)},node_ops:{getattr:function(e){var r,t=NODEFS.realPath(e);try{r=fs.lstatSync(t)}catch(e){if(!e.code)throw e;throw new FS.ErrnoError(ERRNO_CODES[e.code])}return NODEFS.isWindows&&!r.blksize&&(r.blksize=4096),NODEFS.isWindows&&!r.blocks&&(r.blocks=(r.size+r.blksize-1)/r.blksize|0),{dev:r.dev,ino:r.ino,mode:r.mode,nlink:r.nlink,uid:r.uid,gid:r.gid,rdev:r.rdev,size:r.size,atime:r.atime,mtime:r.mtime,ctime:r.ctime,blksize:r.blksize,blocks:r.blocks}},setattr:function(e,r){var t=NODEFS.realPath(e);try{if(void 0!==r.mode&&(fs.chmodSync(t,r.mode),e.mode=r.mode),void 0!==r.timestamp){var n=new Date(r.timestamp);fs.utimesSync(t,n,n)}void 0!==r.size&&fs.truncateSync(t,r.size)}catch(e){if(!e.code)throw e;throw new FS.ErrnoError(ERRNO_CODES[e.code])}},lookup:function(e,r){var t=PATH.join2(NODEFS.realPath(e),r),n=NODEFS.getMode(t);return NODEFS.createNode(e,r,n)},mknod:function(e,r,t,n){var o=NODEFS.createNode(e,r,t,n),i=NODEFS.realPath(o);try{FS.isDir(o.mode)?fs.mkdirSync(i,o.mode):fs.writeFileSync(i,"",{mode:o.mode})}catch(e){if(!e.code)throw e;throw new FS.ErrnoError(ERRNO_CODES[e.code])}return o},rename:function(e,r,t){var n=NODEFS.realPath(e),o=PATH.join2(NODEFS.realPath(r),t);try{fs.renameSync(n,o)}catch(e){if(!e.code)throw e;throw new FS.ErrnoError(ERRNO_CODES[e.code])}},unlink:function(e,r){var t=PATH.join2(NODEFS.realPath(e),r);try{fs.unlinkSync(t)}catch(e){if(!e.code)throw e;throw new FS.ErrnoError(ERRNO_CODES[e.code])}},rmdir:function(e,r){var t=PATH.join2(NODEFS.realPath(e),r);try{fs.rmdirSync(t)}catch(e){if(!e.code)throw e;throw new FS.ErrnoError(ERRNO_CODES[e.code])}},readdir:function(e){var r=NODEFS.realPath(e);try{return fs.readdirSync(r)}catch(e){if(!e.code)throw e;throw new FS.ErrnoError(ERRNO_CODES[e.code])}},symlink:function(e,r,t){var n=PATH.join2(NODEFS.realPath(e),r);try{fs.symlinkSync(t,n)}catch(e){if(!e.code)throw e;throw new FS.ErrnoError(ERRNO_CODES[e.code])}},readlink:function(e){var r=NODEFS.realPath(e);try{return r=fs.readlinkSync(r),r=NODEJS_PATH.relative(NODEJS_PATH.resolve(e.mount.opts.root),r)}catch(e){if(!e.code)throw e;throw new FS.ErrnoError(ERRNO_CODES[e.code])}}},stream_ops:{open:function(e){var r=NODEFS.realPath(e.node);try{FS.isFile(e.node.mode)&&(e.nfd=fs.openSync(r,NODEFS.flagsToPermissionString(e.flags)))}catch(e){if(!e.code)throw e;throw new FS.ErrnoError(ERRNO_CODES[e.code])}},close:function(e){try{FS.isFile(e.node.mode)&&e.nfd&&fs.closeSync(e.nfd)}catch(e){if(!e.code)throw e;throw new FS.ErrnoError(ERRNO_CODES[e.code])}},read:function(e,r,t,n,o){if(0===n)return 0;var i,a=new Buffer(n);try{i=fs.readSync(e.nfd,a,0,n,o)}catch(e){throw new FS.ErrnoError(ERRNO_CODES[e.code])}if(i>0)for(var s=0;s<i;s++)r[t+s]=a[s];return i},write:function(e,r,t,n,o){var i,a=new Buffer(r.subarray(t,t+n));try{i=fs.writeSync(e.nfd,a,0,n,o)}catch(e){throw new FS.ErrnoError(ERRNO_CODES[e.code])}return i},llseek:function(e,r,t){var n=r;if(1===t)n+=e.position;else if(2===t&&FS.isFile(e.node.mode))try{n+=fs.fstatSync(e.nfd).size}catch(e){throw new FS.ErrnoError(ERRNO_CODES[e.code])}if(n<0)throw new FS.ErrnoError(ERRNO_CODES.EINVAL);return n}}},WORKERFS={DIR_MODE:16895,FILE_MODE:33279,reader:null,mount:function(e){function r(e){for(var r=e.split("/"),t=n,i=0;i<r.length-1;i++){var a=r.slice(0,i+1).join("/");o[a]||(o[a]=WORKERFS.createNode(t,r[i],WORKERFS.DIR_MODE,0)),t=o[a]}return t}function t(e){var r=e.split("/");return r[r.length-1]}assert(ENVIRONMENT_IS_WORKER),WORKERFS.reader||(WORKERFS.reader=new FileReaderSync);var n=WORKERFS.createNode(null,"/",WORKERFS.DIR_MODE,0),o={};return Array.prototype.forEach.call(e.opts.files||[],function(e){WORKERFS.createNode(r(e.name),t(e.name),WORKERFS.FILE_MODE,0,e,e.lastModifiedDate)}),(e.opts.blobs||[]).forEach(function(e){WORKERFS.createNode(r(e.name),t(e.name),WORKERFS.FILE_MODE,0,e.data)}),(e.opts.packages||[]).forEach(function(e){e.metadata.files.forEach(function(n){var o=n.filename.substr(1);WORKERFS.createNode(r(o),t(o),WORKERFS.FILE_MODE,0,e.blob.slice(n.start,n.end))})}),n},createNode:function(e,r,t,n,o,i){var a=FS.createNode(e,r,t);return a.mode=t,a.node_ops=WORKERFS.node_ops,a.stream_ops=WORKERFS.stream_ops,a.timestamp=(i||new Date).getTime(),assert(WORKERFS.FILE_MODE!==WORKERFS.DIR_MODE),t===WORKERFS.FILE_MODE?(a.size=o.size,a.contents=o):(a.size=4096,a.contents={}),e&&(e.contents[r]=a),a},node_ops:{getattr:function(e){return{dev:1,ino:void 0,mode:e.mode,nlink:1,uid:0,gid:0,rdev:void 0,size:e.size,atime:new Date(e.timestamp),mtime:new Date(e.timestamp),ctime:new Date(e.timestamp),blksize:4096,blocks:Math.ceil(e.size/4096)}},setattr:function(e,r){void 0!==r.mode&&(e.mode=r.mode),void 0!==r.timestamp&&(e.timestamp=r.timestamp)},lookup:function(e,r){throw new FS.ErrnoError(ERRNO_CODES.ENOENT)},mknod:function(e,r,t,n){throw new FS.ErrnoError(ERRNO_CODES.EPERM)},rename:function(e,r,t){throw new FS.ErrnoError(ERRNO_CODES.EPERM)},unlink:function(e,r){throw new FS.ErrnoError(ERRNO_CODES.EPERM)},rmdir:function(e,r){throw new FS.ErrnoError(ERRNO_CODES.EPERM)},readdir:function(e){var r=[".",".."];for(var t in e.contents)e.contents.hasOwnProperty(t)&&r.push(t);return r},symlink:function(e,r,t){throw new FS.ErrnoError(ERRNO_CODES.EPERM)},readlink:function(e){throw new FS.ErrnoError(ERRNO_CODES.EPERM)}},stream_ops:{read:function(e,r,t,n,o){if(o>=e.node.size)return 0;var i=e.node.contents.slice(o,o+n),a=WORKERFS.reader.readAsArrayBuffer(i);return r.set(new Uint8Array(a),t),i.size},write:function(e,r,t,n,o){throw new FS.ErrnoError(ERRNO_CODES.EIO)},llseek:function(e,r,t){var n=r;if(1===t?n+=e.position:2===t&&FS.isFile(e.node.mode)&&(n+=e.node.size),n<0)throw new FS.ErrnoError(ERRNO_CODES.EINVAL);return n}}};STATICTOP+=16,STATICTOP+=16,STATICTOP+=16;var FS={root:null,mounts:[],devices:[null],streams:[],nextInode:1,nameTable:null,currentPath:"/",initialized:!1,ignorePermissions:!0,trackingDelegate:{},tracking:{openFlags:{READ:1,WRITE:2}},ErrnoError:null,genericErrors:{},filesystems:null,syncFSRequests:0,handleFSError:function(e){if(!(e instanceof FS.ErrnoError))throw e+" : "+stackTrace();return ___setErrNo(e.errno)},lookupPath:function(e,r){if(e=PATH.resolve(FS.cwd(),e),r=r||{},!e)return{path:"",node:null};var t={follow_mount:!0,recurse_count:0};for(var n in t)void 0===r[n]&&(r[n]=t[n]);if(r.recurse_count>8)throw new FS.ErrnoError(ERRNO_CODES.ELOOP);for(var o=PATH.normalizeArray(e.split("/").filter(function(e){return!!e}),!1),i=FS.root,a="/",s=0;s<o.length;s++){var u=s===o.length-1;if(u&&r.parent)break;if(i=FS.lookupNode(i,o[s]),a=PATH.join2(a,o[s]),FS.isMountpoint(i)&&(!u||u&&r.follow_mount)&&(i=i.mounted.root),!u||r.follow)for(var l=0;FS.isLink(i.mode);){var c=FS.readlink(a);if(a=PATH.resolve(PATH.dirname(a),c),i=FS.lookupPath(a,{recurse_count:r.recurse_count}).node,l++>40)throw new FS.ErrnoError(ERRNO_CODES.ELOOP)}}return{path:a,node:i}},getPath:function(e){for(var r;;){if(FS.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:function(e,r){for(var t=0,n=0;n<r.length;n++)t=(t<<5)-t+r.charCodeAt(n)|0;return(e+t>>>0)%FS.nameTable.length},hashAddNode:function(e){var r=FS.hashName(e.parent.id,e.name);e.name_next=FS.nameTable[r],FS.nameTable[r]=e},hashRemoveNode:function(e){var r=FS.hashName(e.parent.id,e.name);if(FS.nameTable[r]===e)FS.nameTable[r]=e.name_next;else for(var t=FS.nameTable[r];t;){if(t.name_next===e){t.name_next=e.name_next;break}t=t.name_next}},lookupNode:function(e,r){var t=FS.mayLookup(e);if(t)throw new FS.ErrnoError(t,e);for(var n=FS.hashName(e.id,r),o=FS.nameTable[n];o;o=o.name_next){var i=o.name;if(o.parent.id===e.id&&i===r)return o}return FS.lookup(e,r)},createNode:function(e,r,t,n){if(!FS.FSNode){FS.FSNode=function(e,r,t,n){e||(e=this),this.parent=e,this.mount=e.mount,this.mounted=null,this.id=FS.nextInode++,this.name=r,this.mode=t,this.node_ops={},this.stream_ops={},this.rdev=n},FS.FSNode.prototype={};Object.defineProperties(FS.FSNode.prototype,{read:{get:function(){return 365==(365&this.mode)},set:function(e){e?this.mode|=365:this.mode&=-366}},write:{get:function(){return 146==(146&this.mode)},set:function(e){e?this.mode|=146:this.mode&=-147}},isFolder:{get:function(){return FS.isDir(this.mode)}},isDevice:{get:function(){return FS.isChrdev(this.mode)}}})}var o=new FS.FSNode(e,r,t,n);return FS.hashAddNode(o),o},destroyNode:function(e){FS.hashRemoveNode(e)},isRoot:function(e){return e===e.parent},isMountpoint:function(e){return!!e.mounted},isFile:function(e){return 32768==(61440&e)},isDir:function(e){return 16384==(61440&e)},isLink:function(e){return 40960==(61440&e)},isChrdev:function(e){return 8192==(61440&e)},isBlkdev:function(e){return 24576==(61440&e)},isFIFO:function(e){return 4096==(61440&e)},isSocket:function(e){return 49152==(49152&e)},flagModes:{r:0,rs:1052672,"r+":2,w:577,wx:705,xw:705,"w+":578,"wx+":706,"xw+":706,a:1089,ax:1217,xa:1217,"a+":1090,"ax+":1218,"xa+":1218},modeStringToFlags:function(e){var r=FS.flagModes[e];if(void 0===r)throw new Error("Unknown file open mode: "+e);return r},flagsToPermissionString:function(e){var r=["r","w","rw"][3&e];return 512&e&&(r+="w"),r},nodePermissions:function(e,r){return FS.ignorePermissions?0:(-1===r.indexOf("r")||292&e.mode)&&(-1===r.indexOf("w")||146&e.mode)&&(-1===r.indexOf("x")||73&e.mode)?0:ERRNO_CODES.EACCES},mayLookup:function(e){var r=FS.nodePermissions(e,"x");return r||(e.node_ops.lookup?0:ERRNO_CODES.EACCES)},mayCreate:function(e,r){try{FS.lookupNode(e,r);return ERRNO_CODES.EEXIST}catch(e){}return FS.nodePermissions(e,"wx")},mayDelete:function(e,r,t){var n;try{n=FS.lookupNode(e,r)}catch(e){return e.errno}var o=FS.nodePermissions(e,"wx");if(o)return o;if(t){if(!FS.isDir(n.mode))return ERRNO_CODES.ENOTDIR;if(FS.isRoot(n)||FS.getPath(n)===FS.cwd())return ERRNO_CODES.EBUSY}else if(FS.isDir(n.mode))return ERRNO_CODES.EISDIR;return 0},mayOpen:function(e,r){return e?FS.isLink(e.mode)?ERRNO_CODES.ELOOP:FS.isDir(e.mode)&&("r"!==FS.flagsToPermissionString(r)||512&r)?ERRNO_CODES.EISDIR:FS.nodePermissions(e,FS.flagsToPermissionString(r)):ERRNO_CODES.ENOENT},MAX_OPEN_FDS:4096,nextfd:function(e,r){e=e||0,r=r||FS.MAX_OPEN_FDS;for(var t=e;t<=r;t++)if(!FS.streams[t])return t;throw new FS.ErrnoError(ERRNO_CODES.EMFILE)},getStream:function(e){return FS.streams[e]},createStream:function(e,r,t){FS.FSStream||(FS.FSStream=function(){},FS.FSStream.prototype={},Object.defineProperties(FS.FSStream.prototype,{object:{get:function(){return this.node},set:function(e){this.node=e}},isRead:{get:function(){return 1!=(2097155&this.flags)}},isWrite:{get:function(){return 0!=(2097155&this.flags)}},isAppend:{get:function(){return 1024&this.flags}}}));var n=new FS.FSStream;for(var o in e)n[o]=e[o];e=n;var i=FS.nextfd(r,t);return e.fd=i,FS.streams[i]=e,e},closeStream:function(e){FS.streams[e]=null},chrdev_stream_ops:{open:function(e){var r=FS.getDevice(e.node.rdev);e.stream_ops=r.stream_ops,e.stream_ops.open&&e.stream_ops.open(e)},llseek:function(){throw new FS.ErrnoError(ERRNO_CODES.ESPIPE)}},major:function(e){return e>>8},minor:function(e){return 255&e},makedev:function(e,r){return e<<8|r},registerDevice:function(e,r){FS.devices[e]={stream_ops:r}},getDevice:function(e){return FS.devices[e]},getMounts:function(e){for(var r=[],t=[e];t.length;){var n=t.pop();r.push(n),t.push.apply(t,n.mounts)}return r},syncfs:function(e,r){function t(e){return assert(FS.syncFSRequests>0),FS.syncFSRequests--,r(e)}function n(e){if(e){if(!n.errored)return n.errored=!0,t(e)}else++i>=o.length&&t(null)}"function"==typeof e&&(r=e,e=!1),++FS.syncFSRequests>1&&console.log("warning: "+FS.syncFSRequests+" FS.syncfs operations in flight at once, probably just doing extra work");var o=FS.getMounts(FS.root.mount),i=0;o.forEach(function(r){if(!r.type.syncfs)return n(null);r.type.syncfs(r,e,n)})},mount:function(e,r,t){var n,o="/"===t,i=!t;if(o&&FS.root)throw new FS.ErrnoError(ERRNO_CODES.EBUSY);if(!o&&!i){var a=FS.lookupPath(t,{follow_mount:!1});if(t=a.path,n=a.node,FS.isMountpoint(n))throw new FS.ErrnoError(ERRNO_CODES.EBUSY);if(!FS.isDir(n.mode))throw new FS.ErrnoError(ERRNO_CODES.ENOTDIR)}var s={type:e,opts:r,mountpoint:t,mounts:[]},u=e.mount(s);return u.mount=s,s.root=u,o?FS.root=u:n&&(n.mounted=s,n.mount&&n.mount.mounts.push(s)),u},unmount:function(e){var r=FS.lookupPath(e,{follow_mount:!1});if(!FS.isMountpoint(r.node))throw new FS.ErrnoError(ERRNO_CODES.EINVAL);var t=r.node,n=t.mounted,o=FS.getMounts(n);Object.keys(FS.nameTable).forEach(function(e){for(var r=FS.nameTable[e];r;){var t=r.name_next;-1!==o.indexOf(r.mount)&&FS.destroyNode(r),r=t}}),t.mounted=null;var i=t.mount.mounts.indexOf(n);assert(-1!==i),t.mount.mounts.splice(i,1)},lookup:function(e,r){return e.node_ops.lookup(e,r)},mknod:function(e,r,t){var n=FS.lookupPath(e,{parent:!0}).node,o=PATH.basename(e);if(!o||"."===o||".."===o)throw new FS.ErrnoError(ERRNO_CODES.EINVAL);var i=FS.mayCreate(n,o);if(i)throw new FS.ErrnoError(i);if(!n.node_ops.mknod)throw new FS.ErrnoError(ERRNO_CODES.EPERM);return n.node_ops.mknod(n,o,r,t)},create:function(e,r){return r=void 0!==r?r:438,r&=4095,r|=32768,FS.mknod(e,r,0)},mkdir:function(e,r){return r=void 0!==r?r:511,r&=1023,r|=16384,FS.mknod(e,r,0)},mkdirTree:function(e,r){for(var t=e.split("/"),n="",o=0;o<t.length;++o)if(t[o]){n+="/"+t[o];try{FS.mkdir(n,r)}catch(e){if(e.errno!=ERRNO_CODES.EEXIST)throw e}}},mkdev:function(e,r,t){return void 0===t&&(t=r,r=438),r|=8192,FS.mknod(e,r,t)},symlink:function(e,r){if(!PATH.resolve(e))throw new FS.ErrnoError(ERRNO_CODES.ENOENT);var t=FS.lookupPath(r,{parent:!0}).node;if(!t)throw new FS.ErrnoError(ERRNO_CODES.ENOENT);var n=PATH.basename(r),o=FS.mayCreate(t,n);if(o)throw new FS.ErrnoError(o);if(!t.node_ops.symlink)throw new FS.ErrnoError(ERRNO_CODES.EPERM);return t.node_ops.symlink(t,n,e)},rename:function(e,r){var t,n,o=PATH.dirname(e),i=PATH.dirname(r),a=PATH.basename(e),s=PATH.basename(r);try{t=FS.lookupPath(e,{parent:!0}).node,n=FS.lookupPath(r,{parent:!0}).node}catch(e){throw new FS.ErrnoError(ERRNO_CODES.EBUSY)}if(!t||!n)throw new FS.ErrnoError(ERRNO_CODES.ENOENT);if(t.mount!==n.mount)throw new FS.ErrnoError(ERRNO_CODES.EXDEV);var u=FS.lookupNode(t,a),l=PATH.relative(e,i);if("."!==l.charAt(0))throw new FS.ErrnoError(ERRNO_CODES.EINVAL);if("."!==(l=PATH.relative(r,o)).charAt(0))throw new FS.ErrnoError(ERRNO_CODES.ENOTEMPTY);var c;try{c=FS.lookupNode(n,s)}catch(e){}if(u!==c){var d=FS.isDir(u.mode),E=FS.mayDelete(t,a,d);if(E)throw new FS.ErrnoError(E);if(E=c?FS.mayDelete(n,s,d):FS.mayCreate(n,s))throw new FS.ErrnoError(E);if(!t.node_ops.rename)throw new FS.ErrnoError(ERRNO_CODES.EPERM);if(FS.isMountpoint(u)||c&&FS.isMountpoint(c))throw new FS.ErrnoError(ERRNO_CODES.EBUSY);if(n!==t&&(E=FS.nodePermissions(t,"w")))throw new FS.ErrnoError(E);try{FS.trackingDelegate.willMovePath&&FS.trackingDelegate.willMovePath(e,r)}catch(t){console.log("FS.trackingDelegate['willMovePath']('"+e+"', '"+r+"') threw an exception: "+t.message)}FS.hashRemoveNode(u);try{t.node_ops.rename(u,n,s)}catch(e){throw e}finally{FS.hashAddNode(u)}try{FS.trackingDelegate.onMovePath&&FS.trackingDelegate.onMovePath(e,r)}catch(t){console.log("FS.trackingDelegate['onMovePath']('"+e+"', '"+r+"') threw an exception: "+t.message)}}},rmdir:function(e){var r=FS.lookupPath(e,{parent:!0}).node,t=PATH.basename(e),n=FS.lookupNode(r,t),o=FS.mayDelete(r,t,!0);if(o)throw new FS.ErrnoError(o);if(!r.node_ops.rmdir)throw new FS.ErrnoError(ERRNO_CODES.EPERM);if(FS.isMountpoint(n))throw new FS.ErrnoError(ERRNO_CODES.EBUSY);try{FS.trackingDelegate.willDeletePath&&FS.trackingDelegate.willDeletePath(e)}catch(r){console.log("FS.trackingDelegate['willDeletePath']('"+e+"') threw an exception: "+r.message)}r.node_ops.rmdir(r,t),FS.destroyNode(n);try{FS.trackingDelegate.onDeletePath&&FS.trackingDelegate.onDeletePath(e)}catch(r){console.log("FS.trackingDelegate['onDeletePath']('"+e+"') threw an exception: "+r.message)}},readdir:function(e){var r=FS.lookupPath(e,{follow:!0}).node;if(!r.node_ops.readdir)throw new FS.ErrnoError(ERRNO_CODES.ENOTDIR);return r.node_ops.readdir(r)},unlink:function(e){var r=FS.lookupPath(e,{parent:!0}).node,t=PATH.basename(e),n=FS.lookupNode(r,t),o=FS.mayDelete(r,t,!1);if(o)throw new FS.ErrnoError(o);if(!r.node_ops.unlink)throw new FS.ErrnoError(ERRNO_CODES.EPERM);if(FS.isMountpoint(n))throw new FS.ErrnoError(ERRNO_CODES.EBUSY);try{FS.trackingDelegate.willDeletePath&&FS.trackingDelegate.willDeletePath(e)}catch(r){console.log("FS.trackingDelegate['willDeletePath']('"+e+"') threw an exception: "+r.message)}r.node_ops.unlink(r,t),FS.destroyNode(n);try{FS.trackingDelegate.onDeletePath&&FS.trackingDelegate.onDeletePath(e)}catch(r){console.log("FS.trackingDelegate['onDeletePath']('"+e+"') threw an exception: "+r.message)}},readlink:function(e){var r=FS.lookupPath(e).node;if(!r)throw new FS.ErrnoError(ERRNO_CODES.ENOENT);if(!r.node_ops.readlink)throw new FS.ErrnoError(ERRNO_CODES.EINVAL);return PATH.resolve(FS.getPath(r.parent),r.node_ops.readlink(r))},stat:function(e,r){var t=FS.lookupPath(e,{follow:!r}).node;if(!t)throw new FS.ErrnoError(ERRNO_CODES.ENOENT);if(!t.node_ops.getattr)throw new FS.ErrnoError(ERRNO_CODES.EPERM);return t.node_ops.getattr(t)},lstat:function(e){return FS.stat(e,!0)},chmod:function(e,r,t){var n;if(!(n="string"==typeof e?FS.lookupPath(e,{follow:!t}).node:e).node_ops.setattr)throw new FS.ErrnoError(ERRNO_CODES.EPERM);n.node_ops.setattr(n,{mode:4095&r|-4096&n.mode,timestamp:Date.now()})},lchmod:function(e,r){FS.chmod(e,r,!0)},fchmod:function(e,r){var t=FS.getStream(e);if(!t)throw new FS.ErrnoError(ERRNO_CODES.EBADF);FS.chmod(t.node,r)},chown:function(e,r,t,n){var o;if(!(o="string"==typeof e?FS.lookupPath(e,{follow:!n}).node:e).node_ops.setattr)throw new FS.ErrnoError(ERRNO_CODES.EPERM);o.node_ops.setattr(o,{timestamp:Date.now()})},lchown:function(e,r,t){FS.chown(e,r,t,!0)},fchown:function(e,r,t){var n=FS.getStream(e);if(!n)throw new FS.ErrnoError(ERRNO_CODES.EBADF);FS.chown(n.node,r,t)},truncate:function(e,r){if(r<0)throw new FS.ErrnoError(ERRNO_CODES.EINVAL);var t;if(!(t="string"==typeof e?FS.lookupPath(e,{follow:!0}).node:e).node_ops.setattr)throw new FS.ErrnoError(ERRNO_CODES.EPERM);if(FS.isDir(t.mode))throw new FS.ErrnoError(ERRNO_CODES.EISDIR);if(!FS.isFile(t.mode))throw new FS.ErrnoError(ERRNO_CODES.EINVAL);var n=FS.nodePermissions(t,"w");if(n)throw new FS.ErrnoError(n);t.node_ops.setattr(t,{size:r,timestamp:Date.now()})},ftruncate:function(e,r){var t=FS.getStream(e);if(!t)throw new FS.ErrnoError(ERRNO_CODES.EBADF);if(0==(2097155&t.flags))throw new FS.ErrnoError(ERRNO_CODES.EINVAL);FS.truncate(t.node,r)},utime:function(e,r,t){var n=FS.lookupPath(e,{follow:!0}).node;n.node_ops.setattr(n,{timestamp:Math.max(r,t)})},open:function(e,r,t,n,o){if(""===e)throw new FS.ErrnoError(ERRNO_CODES.ENOENT);r="string"==typeof r?FS.modeStringToFlags(r):r,t=void 0===t?438:t,t=64&r?4095&t|32768:0;var i;if("object"==typeof e)i=e;else{e=PATH.normalize(e);try{i=FS.lookupPath(e,{follow:!(131072&r)}).node}catch(e){}}var a=!1;if(64&r)if(i){if(128&r)throw new FS.ErrnoError(ERRNO_CODES.EEXIST)}else i=FS.mknod(e,t,0),a=!0;if(!i)throw new FS.ErrnoError(ERRNO_CODES.ENOENT);if(FS.isChrdev(i.mode)&&(r&=-513),65536&r&&!FS.isDir(i.mode))throw new FS.ErrnoError(ERRNO_CODES.ENOTDIR);if(!a){var s=FS.mayOpen(i,r);if(s)throw new FS.ErrnoError(s)}512&r&&FS.truncate(i,0),r&=-641;var u=FS.createStream({node:i,path:FS.getPath(i),flags:r,seekable:!0,position:0,stream_ops:i.stream_ops,ungotten:[],error:!1},n,o);u.stream_ops.open&&u.stream_ops.open(u),!Module.logReadFiles||1&r||(FS.readFiles||(FS.readFiles={}),e in FS.readFiles||(FS.readFiles[e]=1,Module.printErr("read file: "+e)));try{if(FS.trackingDelegate.onOpenFile){var l=0;1!=(2097155&r)&&(l|=FS.tracking.openFlags.READ),0!=(2097155&r)&&(l|=FS.tracking.openFlags.WRITE),FS.trackingDelegate.onOpenFile(e,l)}}catch(r){console.log("FS.trackingDelegate['onOpenFile']('"+e+"', flags) threw an exception: "+r.message)}return u},close:function(e){e.getdents&&(e.getdents=null);try{e.stream_ops.close&&e.stream_ops.close(e)}catch(e){throw e}finally{FS.closeStream(e.fd)}},llseek:function(e,r,t){if(!e.seekable||!e.stream_ops.llseek)throw new FS.ErrnoError(ERRNO_CODES.ESPIPE);return e.position=e.stream_ops.llseek(e,r,t),e.ungotten=[],e.position},read:function(e,r,t,n,o){if(n<0||o<0)throw new FS.ErrnoError(ERRNO_CODES.EINVAL);if(1==(2097155&e.flags))throw new FS.ErrnoError(ERRNO_CODES.EBADF);if(FS.isDir(e.node.mode))throw new FS.ErrnoError(ERRNO_CODES.EISDIR);if(!e.stream_ops.read)throw new FS.ErrnoError(ERRNO_CODES.EINVAL);var i=!0;if(void 0===o)o=e.position,i=!1;else if(!e.seekable)throw new FS.ErrnoError(ERRNO_CODES.ESPIPE);var a=e.stream_ops.read(e,r,t,n,o);return i||(e.position+=a),a},write:function(e,r,t,n,o,i){if(n<0||o<0)throw new FS.ErrnoError(ERRNO_CODES.EINVAL);if(0==(2097155&e.flags))throw new FS.ErrnoError(ERRNO_CODES.EBADF);if(FS.isDir(e.node.mode))throw new FS.ErrnoError(ERRNO_CODES.EISDIR);if(!e.stream_ops.write)throw new FS.ErrnoError(ERRNO_CODES.EINVAL);1024&e.flags&&FS.llseek(e,0,2);var a=!0;if(void 0===o)o=e.position,a=!1;else if(!e.seekable)throw new FS.ErrnoError(ERRNO_CODES.ESPIPE);var s=e.stream_ops.write(e,r,t,n,o,i);a||(e.position+=s);try{e.path&&FS.trackingDelegate.onWriteToFile&&FS.trackingDelegate.onWriteToFile(e.path)}catch(e){console.log("FS.trackingDelegate['onWriteToFile']('"+path+"') threw an exception: "+e.message)}return s},allocate:function(e,r,t){if(r<0||t<=0)throw new FS.ErrnoError(ERRNO_CODES.EINVAL);if(0==(2097155&e.flags))throw new FS.ErrnoError(ERRNO_CODES.EBADF);if(!FS.isFile(e.node.mode)&&!FS.isDir(e.node.mode))throw new FS.ErrnoError(ERRNO_CODES.ENODEV);if(!e.stream_ops.allocate)throw new FS.ErrnoError(ERRNO_CODES.EOPNOTSUPP);e.stream_ops.allocate(e,r,t)},mmap:function(e,r,t,n,o,i,a){if(1==(2097155&e.flags))throw new FS.ErrnoError(ERRNO_CODES.EACCES);if(!e.stream_ops.mmap)throw new FS.ErrnoError(ERRNO_CODES.ENODEV);return e.stream_ops.mmap(e,r,t,n,o,i,a)},msync:function(e,r,t,n,o){return e&&e.stream_ops.msync?e.stream_ops.msync(e,r,t,n,o):0},munmap:function(e){return 0},ioctl:function(e,r,t){if(!e.stream_ops.ioctl)throw new FS.ErrnoError(ERRNO_CODES.ENOTTY);return e.stream_ops.ioctl(e,r,t)},readFile:function(e,r){if(r=r||{},r.flags=r.flags||"r",r.encoding=r.encoding||"binary","utf8"!==r.encoding&&"binary"!==r.encoding)throw new Error('Invalid encoding type "'+r.encoding+'"');var t,n=FS.open(e,r.flags),o=FS.stat(e).size,i=new Uint8Array(o);return FS.read(n,i,0,o,0),"utf8"===r.encoding?t=UTF8ArrayToString(i,0):"binary"===r.encoding&&(t=i),FS.close(n),t},writeFile:function(e,r,t){if(t=t||{},t.flags=t.flags||"w",t.encoding=t.encoding||"utf8","utf8"!==t.encoding&&"binary"!==t.encoding)throw new Error('Invalid encoding type "'+t.encoding+'"');var n=FS.open(e,t.flags,t.mode);if("utf8"===t.encoding){var o=new Uint8Array(lengthBytesUTF8(r)+1),i=stringToUTF8Array(r,o,0,o.length);FS.write(n,o,0,i,0,t.canOwn)}else"binary"===t.encoding&&FS.write(n,r,0,r.length,0,t.canOwn);FS.close(n)},cwd:function(){return FS.currentPath},chdir:function(e){var r=FS.lookupPath(e,{follow:!0});if(null===r.node)throw new FS.ErrnoError(ERRNO_CODES.ENOENT);if(!FS.isDir(r.node.mode))throw new FS.ErrnoError(ERRNO_CODES.ENOTDIR);var t=FS.nodePermissions(r.node,"x");if(t)throw new FS.ErrnoError(t);FS.currentPath=r.path},createDefaultDirectories:function(){FS.mkdir("/tmp"),FS.mkdir("/home"),FS.mkdir("/home/web_user")},createDefaultDevices:function(){FS.mkdir("/dev"),FS.registerDevice(FS.makedev(1,3),{read:function(){return 0},write:function(e,r,t,n,o){return n}}),FS.mkdev("/dev/null",FS.makedev(1,3)),TTY.register(FS.makedev(5,0),TTY.default_tty_ops),TTY.register(FS.makedev(6,0),TTY.default_tty1_ops),FS.mkdev("/dev/tty",FS.makedev(5,0)),FS.mkdev("/dev/tty1",FS.makedev(6,0));var e;if("undefined"!=typeof crypto){var r=new Uint8Array(1);e=function(){return crypto.getRandomValues(r),r[0]}}else e=ENVIRONMENT_IS_NODE?function(){return require("crypto").randomBytes(1)[0]}:function(){return 256*Math.random()|0};FS.createDevice("/dev","random",e),FS.createDevice("/dev","urandom",e),FS.mkdir("/dev/shm"),FS.mkdir("/dev/shm/tmp")},createSpecialDirectories:function(){FS.mkdir("/proc"),FS.mkdir("/proc/self"),FS.mkdir("/proc/self/fd"),FS.mount({mount:function(){var e=FS.createNode("/proc/self","fd",16895,73);return e.node_ops={lookup:function(e,r){var t=+r,n=FS.getStream(t);if(!n)throw new FS.ErrnoError(ERRNO_CODES.EBADF);var o={parent:null,mount:{mountpoint:"fake"},node_ops:{readlink:function(){return n.path}}};return o.parent=o,o}},e}},{},"/proc/self/fd")},createStandardStreams:function(){Module.stdin?FS.createDevice("/dev","stdin",Module.stdin):FS.symlink("/dev/tty","/dev/stdin"),Module.stdout?FS.createDevice("/dev","stdout",null,Module.stdout):FS.symlink("/dev/tty","/dev/stdout"),Module.stderr?FS.createDevice("/dev","stderr",null,Module.stderr):FS.symlink("/dev/tty1","/dev/stderr");var e=FS.open("/dev/stdin","r");assert(0===e.fd,"invalid handle for stdin ("+e.fd+")");var r=FS.open("/dev/stdout","w");assert(1===r.fd,"invalid handle for stdout ("+r.fd+")");var t=FS.open("/dev/stderr","w");assert(2===t.fd,"invalid handle for stderr ("+t.fd+")")},ensureErrnoError:function(){FS.ErrnoError||(FS.ErrnoError=function(e,r){this.node=r,this.setErrno=function(e){this.errno=e;for(var r in ERRNO_CODES)if(ERRNO_CODES[r]===e){this.code=r;break}},this.setErrno(e),this.message=ERRNO_MESSAGES[e]},FS.ErrnoError.prototype=new Error,FS.ErrnoError.prototype.constructor=FS.ErrnoError,[ERRNO_CODES.ENOENT].forEach(function(e){FS.genericErrors[e]=new FS.ErrnoError(e),FS.genericErrors[e].stack="<generic error, no stack>"}))},staticInit:function(){FS.ensureErrnoError(),FS.nameTable=new Array(4096),FS.mount(MEMFS,{},"/"),FS.createDefaultDirectories(),FS.createDefaultDevices(),FS.createSpecialDirectories(),FS.filesystems={MEMFS:MEMFS,IDBFS:IDBFS,NODEFS:NODEFS,WORKERFS:WORKERFS}},init:function(e,r,t){assert(!FS.init.initialized,"FS.init was previously called. If you want to initialize later with custom parameters, remove any earlier calls (note that one is automatically added to the generated code)"),FS.init.initialized=!0,FS.ensureErrnoError(),Module.stdin=e||Module.stdin,Module.stdout=r||Module.stdout,Module.stderr=t||Module.stderr,FS.createStandardStreams()},quit:function(){FS.init.initialized=!1;var e=Module._fflush;e&&e(0);for(var r=0;r<FS.streams.length;r++){var t=FS.streams[r];t&&FS.close(t)}},getMode:function(e,r){var t=0;return e&&(t|=365),r&&(t|=146),t},joinPath:function(e,r){var t=PATH.join.apply(null,e);return r&&"/"==t[0]&&(t=t.substr(1)),t},absolutePath:function(e,r){return PATH.resolve(r,e)},standardizePath:function(e){return PATH.normalize(e)},findObject:function(e,r){var t=FS.analyzePath(e,r);return t.exists?t.object:(___setErrNo(t.error),null)},analyzePath:function(e,r){try{e=(n=FS.lookupPath(e,{follow:!r})).path}catch(e){}var t={isRoot:!1,exists:!1,error:0,name:null,path:null,object:null,parentExists:!1,parentPath:null,parentObject:null};try{var n=FS.lookupPath(e,{parent:!0});t.parentExists=!0,t.parentPath=n.path,t.parentObject=n.node,t.name=PATH.basename(e),n=FS.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(e){t.error=e.errno}return t},createFolder:function(e,r,t,n){var o=PATH.join2("string"==typeof e?e:FS.getPath(e),r),i=FS.getMode(t,n);return FS.mkdir(o,i)},createPath:function(e,r,t,n){e="string"==typeof e?e:FS.getPath(e);for(var o=r.split("/").reverse();o.length;){var i=o.pop();if(i){var a=PATH.join2(e,i);try{FS.mkdir(a)}catch(e){}e=a}}return a},createFile:function(e,r,t,n,o){var i=PATH.join2("string"==typeof e?e:FS.getPath(e),r),a=FS.getMode(n,o);return FS.create(i,a)},createDataFile:function(e,r,t,n,o,i){var a=r?PATH.join2("string"==typeof e?e:FS.getPath(e),r):e,s=FS.getMode(n,o),u=FS.create(a,s);if(t){if("string"==typeof t){for(var l=new Array(t.length),c=0,d=t.length;c<d;++c)l[c]=t.charCodeAt(c);t=l}FS.chmod(u,146|s);var E=FS.open(u,"w");FS.write(E,t,0,t.length,0,i),FS.close(E),FS.chmod(u,s)}return u},createDevice:function(e,r,t,n){var o=PATH.join2("string"==typeof e?e:FS.getPath(e),r),i=FS.getMode(!!t,!!n);FS.createDevice.major||(FS.createDevice.major=64);var a=FS.makedev(FS.createDevice.major++,0);return FS.registerDevice(a,{open:function(e){e.seekable=!1},close:function(e){n&&n.buffer&&n.buffer.length&&n(10)},read:function(e,r,n,o,i){for(var a=0,s=0;s<o;s++){var u;try{u=t()}catch(e){throw new FS.ErrnoError(ERRNO_CODES.EIO)}if(void 0===u&&0===a)throw new FS.ErrnoError(ERRNO_CODES.EAGAIN);if(null===u||void 0===u)break;a++,r[n+s]=u}return a&&(e.node.timestamp=Date.now()),a},write:function(e,r,t,o,i){for(var a=0;a<o;a++)try{n(r[t+a])}catch(e){throw new FS.ErrnoError(ERRNO_CODES.EIO)}return o&&(e.node.timestamp=Date.now()),a}}),FS.mkdev(o,i,a)},createLink:function(e,r,t,n,o){var i=PATH.join2("string"==typeof e?e:FS.getPath(e),r);return FS.symlink(t,i)},forceLoadFile:function(e){if(e.isDevice||e.isFolder||e.link||e.contents)return!0;var r=!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(!Module.read)throw new Error("Cannot load without read() or XMLHttpRequest.");try{e.contents=intArrayFromString(Module.read(e.url),!0),e.usedBytes=e.contents.length}catch(e){r=!1}return r||___setErrNo(ERRNO_CODES.EIO),r},createLazyFile:function(e,r,t,n,o){function i(){this.lengthKnown=!1,this.chunks=[]}if(i.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]}},i.prototype.setDataGetter=function(e){this.getter=e},i.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,i=(r=e.getResponseHeader("Content-Encoding"))&&"gzip"===r,a=1048576;o||(a=n);var s=function(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!==a&&o.setRequestHeader("Range","bytes="+e+"-"+r),"undefined"!=typeof Uint8Array&&(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||[]):intArrayFromString(o.responseText||"",!0)},u=this;u.setDataGetter(function(e){var r=e*a,t=(e+1)*a-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]}),!i&&n||(a=n=1,n=this.getter(0).length,a=n,console.log("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){if(!ENVIRONMENT_IS_WORKER)throw"Cannot do synchronous binary XHRs outside webworkers in modern browsers. Use --embed-file or --preload-file in emcc";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}}});s={isDevice:!1,contents:a}}else var s={isDevice:!1,url:t};var u=FS.createFile(e,r,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 l={};return Object.keys(u.stream_ops).forEach(function(e){var r=u.stream_ops[e];l[e]=function(){if(!FS.forceLoadFile(u))throw new FS.ErrnoError(ERRNO_CODES.EIO);return r.apply(null,arguments)}}),l.read=function(e,r,t,n,o){if(!FS.forceLoadFile(u))throw new FS.ErrnoError(ERRNO_CODES.EIO);var i=e.node.contents;if(o>=i.length)return 0;var a=Math.min(i.length-o,n);if(assert(a>=0),i.slice)for(s=0;s<a;s++)r[t+s]=i[o+s];else for(var s=0;s<a;s++)r[t+s]=i.get(o+s);return a},u.stream_ops=l,u},createPreloadedFile:function(e,r,t,n,o,i,a,s,u,l){function c(t){function c(t){l&&l(),s||FS.createDataFile(e,r,t,n,o,u),i&&i(),removeRunDependency(E)}var f=!1;Module.preloadPlugins.forEach(function(e){f||e.canHandle(d)&&(e.handle(t,d,c,function(){a&&a(),removeRunDependency(E)}),f=!0)}),f||c(t)}Browser.init();var d=r?PATH.resolve(PATH.join2(e,r)):e,E=getUniqueRunDependency("cp "+d);addRunDependency(E),"string"==typeof t?Browser.asyncLoad(t,function(e){c(e)},a):c(t)},indexedDB:function(){return window.indexedDB||window.mozIndexedDB||window.webkitIndexedDB||window.msIndexedDB},DB_NAME:function(){return"EM_FS_"+window.location.pathname},DB_VERSION:20,DB_STORE_NAME:"FILE_DATA",saveFilesToDB:function(e,r,t){r=r||function(){},t=t||function(){};var n=FS.indexedDB();try{var o=n.open(FS.DB_NAME(),FS.DB_VERSION)}catch(e){return t(e)}o.onupgradeneeded=function(){console.log("creating db"),o.result.createObjectStore(FS.DB_STORE_NAME)},o.onsuccess=function(){function n(){0==u?r():t()}var i=o.result.transaction([FS.DB_STORE_NAME],"readwrite"),a=i.objectStore(FS.DB_STORE_NAME),s=0,u=0,l=e.length;e.forEach(function(e){var r=a.put(FS.analyzePath(e).object.contents,e);r.onsuccess=function(){++s+u==l&&n()},r.onerror=function(){s+ ++u==l&&n()}}),i.onerror=t},o.onerror=t},loadFilesFromDB:function(e,r,t){r=r||function(){},t=t||function(){};var n=FS.indexedDB();try{var o=n.open(FS.DB_NAME(),FS.DB_VERSION)}catch(e){return t(e)}o.onupgradeneeded=t,o.onsuccess=function(){function n(){0==l?r():t()}var i=o.result;try{var a=i.transaction([FS.DB_STORE_NAME],"readonly")}catch(e){return void t(e)}var s=a.objectStore(FS.DB_STORE_NAME),u=0,l=0,c=e.length;e.forEach(function(e){var r=s.get(e);r.onsuccess=function(){FS.analyzePath(e).exists&&FS.unlink(e),FS.createDataFile(PATH.dirname(e),PATH.basename(e),r.result,!0,!0,!0),++u+l==c&&n()},r.onerror=function(){u+ ++l==c&&n()}}),a.onerror=t},o.onerror=t}},SYSCALLS={DEFAULT_POLLMASK:5,mappings:{},umask:511,calculateAt:function(e,r){if("/"!==r[0]){var t;if(-100===e)t=FS.cwd();else{var n=FS.getStream(e);if(!n)throw new FS.ErrnoError(ERRNO_CODES.EBADF);t=n.path}r=PATH.join2(t,r)}return r},doStat:function(e,r,t){try{var n=e(r)}catch(e){if(e&&e.node&&PATH.normalize(r)!==PATH.normalize(FS.getPath(e.node)))return-ERRNO_CODES.ENOTDIR;throw e}return HEAP32[t>>2]=n.dev,HEAP32[t+4>>2]=0,HEAP32[t+8>>2]=n.ino,HEAP32[t+12>>2]=n.mode,HEAP32[t+16>>2]=n.nlink,HEAP32[t+20>>2]=n.uid,HEAP32[t+24>>2]=n.gid,HEAP32[t+28>>2]=n.rdev,HEAP32[t+32>>2]=0,HEAP32[t+36>>2]=n.size,HEAP32[t+40>>2]=4096,HEAP32[t+44>>2]=n.blocks,HEAP32[t+48>>2]=n.atime.getTime()/1e3|0,HEAP32[t+52>>2]=0,HEAP32[t+56>>2]=n.mtime.getTime()/1e3|0,HEAP32[t+60>>2]=0,HEAP32[t+64>>2]=n.ctime.getTime()/1e3|0,HEAP32[t+68>>2]=0,HEAP32[t+72>>2]=n.ino,0},doMsync:function(e,r,t,n){var o=new Uint8Array(HEAPU8.subarray(e,e+t));FS.msync(r,o,0,t,n)},doMkdir:function(e,r){return"/"===(e=PATH.normalize(e))[e.length-1]&&(e=e.substr(0,e.length-1)),FS.mkdir(e,r,0),0},doMknod:function(e,r,t){switch(61440&r){case 32768:case 8192:case 24576:case 4096:case 49152:break;default:return-ERRNO_CODES.EINVAL}return FS.mknod(e,r,t),0},doReadlink:function(e,r,t){if(t<=0)return-ERRNO_CODES.EINVAL;var n=FS.readlink(e),o=Math.min(t,lengthBytesUTF8(n)),i=HEAP8[r+o];return stringToUTF8(n,r,t+1),HEAP8[r+o]=i,o},doAccess:function(e,r){if(-8&r)return-ERRNO_CODES.EINVAL;var t;t=FS.lookupPath(e,{follow:!0}).node;var n="";return 4&r&&(n+="r"),2&r&&(n+="w"),1&r&&(n+="x"),n&&FS.nodePermissions(t,n)?-ERRNO_CODES.EACCES:0},doDup:function(e,r,t){var n=FS.getStream(t);return n&&FS.close(n),FS.open(e,r,0,t,t).fd},doReadv:function(e,r,t,n){for(var o=0,i=0;i<t;i++){var a=HEAP32[r+8*i>>2],s=HEAP32[r+(8*i+4)>>2],u=FS.read(e,HEAP8,a,s,n);if(u<0)return-1;if(o+=u,u<s)break}return o},doWritev:function(e,r,t,n){for(var o=0,i=0;i<t;i++){var a=HEAP32[r+8*i>>2],s=HEAP32[r+(8*i+4)>>2],u=FS.write(e,HEAP8,a,s,n);if(u<0)return-1;o+=u}return o},varargs:0,get:function(e){return SYSCALLS.varargs+=4,HEAP32[SYSCALLS.varargs-4>>2]},getStr:function(){return Pointer_stringify(SYSCALLS.get())},getStreamFromFD:function(){var e=FS.getStream(SYSCALLS.get());if(!e)throw new FS.ErrnoError(ERRNO_CODES.EBADF);return e},getSocketFromFD:function(){var e=SOCKFS.getSocket(SYSCALLS.get());if(!e)throw new FS.ErrnoError(ERRNO_CODES.EBADF);return e},getSocketAddress:function(e){var r=SYSCALLS.get(),t=SYSCALLS.get();if(e&&0===r)return null;var n=__read_sockaddr(r,t);if(n.errno)throw new FS.ErrnoError(n.errno);return n.addr=DNS.lookup_addr(n.addr)||n.addr,n},get64:function(){var e=SYSCALLS.get(),r=SYSCALLS.get();return assert(e>=0?0===r:-1===r),e},getZero:function(){assert(0===SYSCALLS.get())}},___tm_current=STATICTOP;STATICTOP+=48;var ___tm_timezone=allocate(intArrayFromString("GMT"),"i8",ALLOC_STATIC);if(FS.staticInit(),__ATINIT__.unshift(function(){Module.noFSInit||FS.init.initialized||FS.init()}),__ATMAIN__.push(function(){FS.ignorePermissions=!1}),__ATEXIT__.push(function(){FS.quit()}),Module.FS_createFolder=FS.createFolder,Module.FS_createPath=FS.createPath,Module.FS_createDataFile=FS.createDataFile,Module.FS_createPreloadedFile=FS.createPreloadedFile,Module.FS_createLazyFile=FS.createLazyFile,Module.FS_createLink=FS.createLink,Module.FS_createDevice=FS.createDevice,Module.FS_unlink=FS.unlink,__ATINIT__.unshift(function(){TTY.init()}),__ATEXIT__.push(function(){TTY.shutdown()}),ENVIRONMENT_IS_NODE){var fs=require("fs"),NODEJS_PATH=require("path");NODEFS.staticInit()}DYNAMICTOP_PTR=allocate(1,"i32",ALLOC_STATIC),STACK_BASE=STACKTOP=Runtime.alignMemory(STATICTOP),STACK_MAX=STACK_BASE+TOTAL_STACK,DYNAMIC_BASE=Runtime.alignMemory(STACK_MAX),HEAP32[DYNAMICTOP_PTR>>2]=DYNAMIC_BASE,staticSealed=!0,Module.wasmTableSize=14,Module.wasmMaxTableSize=14,Module.asmGlobalArg={Math:Math,Int8Array:Int8Array,Int16Array:Int16Array,Int32Array:Int32Array,Uint8Array:Uint8Array,Uint16Array:Uint16Array,Uint32Array:Uint32Array,Float32Array:Float32Array,Float64Array:Float64Array,NaN:NaN,Infinity:1/0},Module.asmLibraryArg={abort:abort,assert:assert,enlargeMemory:enlargeMemory,getTotalMemory:getTotalMemory,abortOnCannotGrowMemory:abortOnCannotGrowMemory,invoke_ii:invoke_ii,invoke_iiii:invoke_iiii,invoke_viii:invoke_viii,_gmtime_r:_gmtime_r,_gmtime:_gmtime,___lock:___lock,___syscall6:___syscall6,___setErrNo:___setErrNo,___unlock:___unlock,_ftime:_ftime,_emscripten_memcpy_big:_emscripten_memcpy_big,___syscall54:___syscall54,___syscall140:___syscall140,___syscall20:___syscall20,___assert_fail:___assert_fail,___syscall146:___syscall146,DYNAMICTOP_PTR:DYNAMICTOP_PTR,tempDoublePtr:tempDoublePtr,ABORT:ABORT,STACKTOP:STACKTOP,STACK_MAX:STACK_MAX};var asm=Module.asm(Module.asmGlobalArg,Module.asmLibraryArg,buffer);Module.asm=asm;var _cryptonight_hash=Module._cryptonight_hash=function(){return Module.asm._cryptonight_hash.apply(null,arguments)},getTempRet0=Module.getTempRet0=function(){return Module.asm.getTempRet0.apply(null,arguments)},_free=Module._free=function(){return Module.asm._free.apply(null,arguments)},runPostSets=Module.runPostSets=function(){return Module.asm.runPostSets.apply(null,arguments)},setTempRet0=Module.setTempRet0=function(){return Module.asm.setTempRet0.apply(null,arguments)},establishStackSpace=Module.establishStackSpace=function(){return Module.asm.establishStackSpace.apply(null,arguments)},_memmove=Module._memmove=function(){return Module.asm._memmove.apply(null,arguments)},stackSave=Module.stackSave=function(){return Module.asm.stackSave.apply(null,arguments)},_memset=Module._memset=function(){return Module.asm._memset.apply(null,arguments)},_malloc=Module._malloc=function(){return Module.asm._malloc.apply(null,arguments)},_cryptonight_create=Module._cryptonight_create=function(){return Module.asm._cryptonight_create.apply(null,arguments)},_memcpy=Module._memcpy=function(){return Module.asm._memcpy.apply(null,arguments)},_emscripten_get_global_libc=Module._emscripten_get_global_libc=function(){return Module.asm._emscripten_get_global_libc.apply(null,arguments)},stackAlloc=Module.stackAlloc=function(){return Module.asm.stackAlloc.apply(null,arguments)},setThrew=Module.setThrew=function(){return Module.asm.setThrew.apply(null,arguments)},_sbrk=Module._sbrk=function(){return Module.asm._sbrk.apply(null,arguments)},_fflush=Module._fflush=function(){return Module.asm._fflush.apply(null,arguments)},stackRestore=Module.stackRestore=function(){return Module.asm.stackRestore.apply(null,arguments)},_cryptonight_destroy=Module._cryptonight_destroy=function(){return Module.asm._cryptonight_destroy.apply(null,arguments)},___errno_location=Module.___errno_location=function(){return Module.asm.___errno_location.apply(null,arguments)},dynCall_ii=Module.dynCall_ii=function(){return Module.asm.dynCall_ii.apply(null,arguments)},dynCall_iiii=Module.dynCall_iiii=function(){return Module.asm.dynCall_iiii.apply(null,arguments)},dynCall_viii=Module.dynCall_viii=function(){return Module.asm.dynCall_viii.apply(null,arguments)};if(Runtime.stackAlloc=Module.stackAlloc,Runtime.stackSave=Module.stackSave,Runtime.stackRestore=Module.stackRestore,Runtime.establishStackSpace=Module.establishStackSpace,Runtime.setTempRet0=Module.setTempRet0,Runtime.getTempRet0=Module.getTempRet0,Module.asm=asm,memoryInitializer)if("function"==typeof Module.locateFile?memoryInitializer=Module.locateFile(memoryInitializer):Module.memoryInitializerPrefixURL&&(memoryInitializer=Module.memoryInitializerPrefixURL+memoryInitializer),ENVIRONMENT_IS_NODE||ENVIRONMENT_IS_SHELL){var data=Module.readBinary(memoryInitializer);HEAPU8.set(data,Runtime.GLOBAL_BASE)}else{addRunDependency("memory initializer");var applyMemoryInitializer=function(e){e.byteLength&&(e=new Uint8Array(e)),HEAPU8.set(e,Runtime.GLOBAL_BASE),Module.memoryInitializerRequest&&delete Module.memoryInitializerRequest.response,removeRunDependency("memory initializer")};Module.memoryInitializerRequest?Module.memoryInitializerRequest.response?setTimeout(useRequest,0):Module.memoryInitializerRequest.addEventListener("load",useRequest):doBrowserLoad()}ExitStatus.prototype=new Error,ExitStatus.prototype.constructor=ExitStatus;var initialStackTop,preloadStartTime=null,calledMain=!1;dependenciesFulfilled=function e(){Module.calledRun||run(),Module.calledRun||(dependenciesFulfilled=e)},Module.callMain=Module.callMain=function(e){function r(){for(var e=0;e<3;e++)n.push(0)}e=e||[],ensureInitRuntime();var t=e.length+1,n=[allocate(intArrayFromString(Module.thisProgram),"i8",ALLOC_NORMAL)];r();for(var o=0;o<t-1;o+=1)n.push(allocate(intArrayFromString(e[o]),"i8",ALLOC_NORMAL)),r();n.push(0),n=allocate(n,"i32",ALLOC_NORMAL);try{exit(Module._main(t,n,0),!0)}catch(e){if(e instanceof ExitStatus)return;if("SimulateInfiniteLoop"==e)return void(Module.noExitRuntime=!0);var i=e;e&&"object"==typeof e&&e.stack&&(i=[e,e.stack]),Module.printErr("exception thrown: "+i),Module.quit(1,e)}finally{calledMain=!0}},Module.run=Module.run=run,Module.exit=Module.exit=exit;var abortDecorators=[];if(Module.abort=Module.abort=abort,Module.preInit)for("function"==typeof Module.preInit&&(Module.preInit=[Module.preInit]);Module.preInit.length>0;)Module.preInit.pop()();var shouldRunNow=!0;Module.noInitialRun&&(shouldRunNow=!1),run();var CryptonightWASMWrapper=function(){this.ctx=_cryptonight_create(),this.throttleWait=0,this.throttledStart=0,this.throttledHashes=0,this.workThrottledBound=this.workThrottled.bind(this),this.currentJob=null,this.target=new Uint8Array([255,255,255,255,255,255,255,255]);var e=Module.HEAPU8.buffer;this.input=new Uint8Array(e,Module._malloc(84),84),this.output=new Uint8Array(e,Module._malloc(32),32),self.postMessage("ready"),self.onmessage=this.onMessage.bind(this)};CryptonightWASMWrapper.prototype.onMessage=function(e){var r=e.data;r.verify_id?this.verify(r):(this.currentJob&&this.currentJob.job_id===r.job_id||this.setJob(r),r.throttle?(this.throttleWait=1/(1-r.throttle)-1,this.throttledStart=this.now(),this.throttledHashes=0,this.workThrottled()):this.work())},CryptonightWASMWrapper.prototype.destroy=function(){_cryptonight_destroy(this.ctx)},CryptonightWASMWrapper.prototype.hexToBytes=function(e,r){for(var r=new Uint8Array(e.length/2),t=0,n=0;n<e.length;n+=2,t++)r[t]=parseInt(e.substr(n,2),16);return r},CryptonightWASMWrapper.prototype.bytesToHex=function(e){for(var r="",t=0;t<e.length;t++)r+=(e[t]>>>4).toString(16),r+=(15&e[t]).toString(16);return r},CryptonightWASMWrapper.prototype.meetsTarget=function(e,r){for(var t=0;t<r.length;t++){var n=e.length-t-1,o=r.length-t-1;if(e[n]>r[o])return!1;if(e[n]<r[o])return!0}return!1},CryptonightWASMWrapper.prototype.setJob=function(e){this.currentJob=e,this.blob=this.hexToBytes(e.blob),this.input.set(this.blob);var r=this.hexToBytes(e.target);if(r.length<=8){for(t=0;t<r.length;t++)this.target[this.target.length-t-1]=r[r.length-t-1];for(var t=0;t<this.target.length-r.length;t++)this.target[t]=255}else this.target=r},CryptonightWASMWrapper.prototype.now=function(){return self.performance?self.performance.now():Date.now()},CryptonightWASMWrapper.prototype.hash=function(e,r,t){var n=4294967295*Math.random()+1>>>0;this.input[39]=(4278190080&n)>>24,this.input[40]=(16711680&n)>>16,this.input[41]=(65280&n)>>8,this.input[42]=(255&n)>>0,_cryptonight_hash(this.ctx,e.byteOffset,r.byteOffset,t)},CryptonightWASMWrapper.prototype.verify=function(e){this.blob=this.hexToBytes(e.blob),this.input.set(this.blob);for(var r=0,t=0;t<e.nonce.length;t+=2,r++)this.input[39+r]=parseInt(e.nonce.substr(t,2),16);_cryptonight_hash(this.ctx,this.input.byteOffset,this.output.byteOffset,this.blob.length);var n=this.bytesToHex(this.output);self.postMessage({verify_id:e.verify_id,verified:n===e.result})},CryptonightWASMWrapper.prototype.work=function(){var e=0,r=!1,t=this.now(),n=0;do{this.hash(this.input,this.output,this.blob.length),e++,r=this.meetsTarget(this.output,this.target),n=this.now()-t}while(!r&&n<1e3);var o=e/(n/1e3);if(r){var i=this.bytesToHex(this.input.subarray(39,43)),a=this.bytesToHex(this.output);self.postMessage({hashesPerSecond:o,hashes:e,job_id:this.currentJob.job_id,nonce:i,result:a})}else self.postMessage({hashesPerSecond:o,hashes:e})},CryptonightWASMWrapper.prototype.workThrottled=function(){var e=this.now();this.hash(this.input,this.output,this.blob.length);var r=this.now(),t=r-e;this.throttledHashes++;var n=r-this.throttledStart,o=this.throttledHashes/(n/1e3);if(this.meetsTarget(this.output,this.target)){var i=this.bytesToHex(this.input.subarray(39,43)),a=this.bytesToHex(this.output);self.postMessage({hashesPerSecond:o,hashes:this.throttledHashes,job_id:this.currentJob.job_id,nonce:i,result:a}),this.throttledHashes=0}else if(n>1e3)self.postMessage({hashesPerSecond:o,hashes:this.throttledHashes}),this.throttledHashes=0;else{var s=Math.min(2e3,t*this.throttleWait);setTimeout(this.workThrottledBound,s)}},Module.onRuntimeInitialized=function(){new CryptonightWASMWrapper};