1 line
88 KiB
JavaScript
1 line
88 KiB
JavaScript
var proxyMarker=Symbol("Comlink.proxy"),createEndpoint=Symbol("Comlink.endpoint"),releaseProxy=Symbol("Comlink.releaseProxy"),finalizer=Symbol("Comlink.finalizer"),throwMarker=Symbol("Comlink.thrown"),isObject=val=>"object"==typeof val&&null!==val||"function"==typeof val,proxyTransferHandler={canHandle:val=>isObject(val)&&val[proxyMarker],serialize(obj){var{port1,port2}=new MessageChannel;return expose(obj,port1),[port2,[port2]]},deserialize(port){return port.start(),wrap(port)}},throwTransferHandler={canHandle:value=>isObject(value)&&throwMarker in value,serialize(_ref){_ref=_ref.value,_ref=_ref instanceof Error?{isError:!0,value:{message:_ref.message,name:_ref.name,stack:_ref.stack}}:{isError:!1,value:_ref};return[_ref,[]]},deserialize(serialized){if(serialized.isError)throw Object.assign(new Error(serialized.value.message),serialized.value);throw serialized.value}},transferHandlers=new Map([["proxy",proxyTransferHandler],["throw",throwTransferHandler]]);function isAllowedOrigin(allowedOrigins,origin){for(var allowedOrigin of allowedOrigins){if(origin===allowedOrigin||"*"===allowedOrigin)return!0;if(allowedOrigin instanceof RegExp&&allowedOrigin.test(origin))return!0}return!1}function expose(obj){var ep=1<arguments.length&&void 0!==arguments[1]?arguments[1]:globalThis,allowedOrigins=2<arguments.length&&void 0!==arguments[2]?arguments[2]:["*"];ep.addEventListener("message",function callback(ev){if(ev&&ev.data)if(isAllowedOrigin(allowedOrigins,ev.origin)){var{id,type,path}=Object.assign({path:[]},ev.data),argumentList=(ev.data.argumentList||[]).map(fromWireValue);try{var parent=path.slice(0,-1).reduce((obj,prop)=>obj[prop],obj),rawValue=path.reduce((obj,prop)=>obj[prop],obj);switch(type){case"GET":returnValue=rawValue;break;case"SET":parent[path.slice(-1)[0]]=fromWireValue(ev.data.value),returnValue=!0;break;case"APPLY":returnValue=rawValue.apply(parent,argumentList);break;case"CONSTRUCT":var returnValue=proxy(new rawValue(...argumentList));break;case"ENDPOINT":var{port1,port2}=new MessageChannel;expose(obj,port2),returnValue=transfer(port1,[port1]);break;case"RELEASE":returnValue=void 0;break;default:return}}catch(value){returnValue={value:value,[throwMarker]:0}}Promise.resolve(returnValue).catch(value=>({value:value,[throwMarker]:0})).then(returnValue=>{var[returnValue,transferables]=toWireValue(returnValue);ep.postMessage(Object.assign(Object.assign({},returnValue),{id:id}),transferables),"RELEASE"===type&&(ep.removeEventListener("message",callback),closeEndPoint(ep),finalizer in obj)&&"function"==typeof obj[finalizer]&&obj[finalizer]()}).catch(error=>{var[wireValue,transferables]=toWireValue({value:new TypeError("Unserializable return value"),[throwMarker]:0});ep.postMessage(Object.assign(Object.assign({},wireValue),{id:id}),transferables)})}else console.warn("Invalid origin '".concat(ev.origin,"' for comlink proxy"))}),ep.start&&ep.start()}function isMessagePort(endpoint){return"MessagePort"===endpoint.constructor.name}function closeEndPoint(endpoint){isMessagePort(endpoint)&&endpoint.close()}function wrap(ep,target){var pendingListeners=new Map;return ep.addEventListener("message",function(ev){ev=ev.data;if(ev&&ev.id){var resolver=pendingListeners.get(ev.id);if(resolver)try{resolver(ev)}finally{pendingListeners.delete(ev.id)}}}),createProxy(ep,pendingListeners,[],target)}function throwIfProxyReleased(isReleased){if(isReleased)throw new Error("Proxy has been released and is not useable")}function releaseEndpoint(ep){return requestResponseMessage(ep,new Map,{type:"RELEASE"}).then(()=>{closeEndPoint(ep)})}var proxyCounter=new WeakMap,proxyFinalizers="FinalizationRegistry"in globalThis&&new FinalizationRegistry(ep=>{var newCount=(proxyCounter.get(ep)||0)-1;proxyCounter.set(ep,newCount),0==newCount&&releaseEndpoint(ep)});function registerProxy(proxy,ep){var newCount=(proxyCounter.get(ep)||0)+1;proxyCounter.set(ep,newCount),proxyFinalizers&&proxyFinalizers.register(proxy,ep,proxy)}function unregisterProxy(proxy){proxyFinalizers&&proxyFinalizers.unregister(proxy)}function createProxy(ep,pendingListeners){var path=2<arguments.length&&void 0!==arguments[2]?arguments[2]:[],isProxyReleased=!1,proxy=new Proxy(3<arguments.length&&void 0!==arguments[3]?arguments[3]:function(){},{get(_target,prop){var r;return throwIfProxyReleased(isProxyReleased),prop===releaseProxy?()=>{unregisterProxy(proxy),releaseEndpoint(ep),pendingListeners.clear(),isProxyReleased=!0}:"then"===prop?0===path.length?{then:()=>proxy}:(r=requestResponseMessage(ep,pendingListeners,{type:"GET",path:path.map(p=>p.toString())}).then(fromWireValue)).then.bind(r):createProxy(ep,pendingListeners,[...path,prop])},set(_target,prop,rawValue){throwIfProxyReleased(isProxyReleased);var[rawValue,transferables]=toWireValue(rawValue);return requestResponseMessage(ep,pendingListeners,{type:"SET",path:[...path,prop].map(p=>p.toString()),value:rawValue},transferables).then(fromWireValue)},apply(_target,_thisArg,rawArgumentList){throwIfProxyReleased(isProxyReleased);var last=path[path.length-1];return last===createEndpoint?requestResponseMessage(ep,pendingListeners,{type:"ENDPOINT"}).then(fromWireValue):"bind"===last?createProxy(ep,pendingListeners,path.slice(0,-1)):([last,rawArgumentList]=processArguments(rawArgumentList),requestResponseMessage(ep,pendingListeners,{type:"APPLY",path:path.map(p=>p.toString()),argumentList:last},rawArgumentList).then(fromWireValue))},construct(_target,rawArgumentList){throwIfProxyReleased(isProxyReleased);var[rawArgumentList,transferables]=processArguments(rawArgumentList);return requestResponseMessage(ep,pendingListeners,{type:"CONSTRUCT",path:path.map(p=>p.toString()),argumentList:rawArgumentList},transferables).then(fromWireValue)}});return registerProxy(proxy,ep),proxy}function myFlat(arr){return Array.prototype.concat.apply([],arr)}function processArguments(argumentList){argumentList=argumentList.map(toWireValue);return[argumentList.map(v=>v[0]),myFlat(argumentList.map(v=>v[1]))]}var transferCache=new WeakMap;function transfer(obj,transfers){return transferCache.set(obj,transfers),obj}function proxy(obj){return Object.assign(obj,{[proxyMarker]:!0})}function toWireValue(value){for(var[name,handler]of transferHandlers){var transferables;if(handler.canHandle(value))return[handler,transferables]=handler.serialize(value),[{type:"HANDLER",name:name,value:handler},transferables]}return[{type:"RAW",value:value},transferCache.get(value)||[]]}function fromWireValue(value){switch(value.type){case"HANDLER":return transferHandlers.get(value.name).deserialize(value.value);case"RAW":return value.value}}function requestResponseMessage(ep,pendingListeners,msg,transfers){return new Promise(resolve=>{var id=generateUUID();pendingListeners.set(id,resolve),ep.start&&ep.start(),ep.postMessage(Object.assign({id:id},msg),transfers)})}function generateUUID(){return new Array(4).fill(0).map(()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16)).join("-")}var TYPE_MAP={32768:"FILE",16384:"DIR",40960:"SYMBOLIC_LINK",49152:"SOCKET",8192:"CHARACTER_DEVICE",24576:"BLOCK_DEVICE",4096:"NAMED_PIPE"};class ArchiveReader{constructor(wasmModule){this._wasmModule=wasmModule,this._runCode=wasmModule.runCode,this._file=null,this._passphrase=null,this._locale="en_US.UTF-8"}async open(file){null!==this._file&&(console.warn("Closing previous file"),this.close());file=await this._loadFile(file);this._fileLength=file.length,this._filePtr=file.ptr}close(){this._runCode.closeArchive(this._archive),this._wasmModule._free(this._filePtr),this._file=null,this._filePtr=null,this._archive=null}hasEncryptedData(){this._archive=this._runCode.openArchive(this._filePtr,this._fileLength,this._passphrase,this._locale),this._runCode.getNextEntry(this._archive);var status=this._runCode.hasEncryptedEntries(this._archive);return 0!==status&&(0<status||null)}setPassphrase(passphrase){this._passphrase=passphrase}setLocale(locale){this._locale=locale}entries(){var _this=this,skipExtraction=0<arguments.length&&void 0!==arguments[0]&&arguments[0],except=1<arguments.length&&void 0!==arguments[1]?arguments[1]:null;return function*(){for(_this._archive=_this._runCode.openArchive(_this._filePtr,_this._fileLength,_this._passphrase,_this._locale);;){if(0===(entry=_this._runCode.getNextEntry(_this._archive)))break;var entry={size:_this._runCode.getEntrySize(entry),path:_this._runCode.getEntryName(entry),type:TYPE_MAP[_this._runCode.getEntryType(entry)],lastModified:_this._runCode.getEntryLastModified(entry),ref:entry};if("FILE"===entry.type&&(fileName=entry.path.split("/"),entry.fileName=fileName[fileName.length-1]),skipExtraction&&except!==entry.path)_this._runCode.skipEntry(_this._archive);else{var fileName=_this._runCode.getFileData(_this._archive,entry.size);if(fileName<0)throw new Error(_this._runCode.getError(_this._archive));entry.fileData=_this._wasmModule.HEAPU8.slice(fileName,fileName+entry.size),_this._wasmModule._free(fileName)}yield entry}}()}async _loadFile(file){var file=await file.arrayBuffer(),file=new Uint8Array(file),filePtr=this._runCode.malloc(file.length);return this._wasmModule.HEAPU8.set(file,filePtr),{ptr:filePtr,length:file.length}}}class ArchiveWriter{constructor(wasmModule){this._wasmModule=wasmModule,this._runCode=wasmModule.runCode,this._passphrase=null,this._locale="en_US.UTF-8"}async write(files,compression,format){var file,pathname,passphrase=3<arguments.length&&void 0!==arguments[3]?arguments[3]:null,totalSize=files.reduce((acc,_ref2)=>{_ref2=_ref2.file;return acc+_ref2.size+128},0)+128,bufferPtr=this._runCode.malloc(totalSize),outputSizePtr=this._runCode.malloc(this._runCode.sizeOfSizeT()),newArchive=this._runCode.startArchiveWrite(compression,format,bufferPtr,totalSize,outputSizePtr,passphrase);for({file,pathname}of files){var fileData=await this._loadFile(file);this._runCode.writeArchiveFile(newArchive,pathname||file.name,fileData.length,fileData.ptr),this._runCode.free(fileData.ptr)}compression=this._runCode.finishArchiveWrite(newArchive,outputSizePtr);if(compression<0)throw new Error(this._runCode.getError(newArchive));return this._wasmModule.HEAPU8.slice(bufferPtr,bufferPtr+compression)}async _loadFile(file){var file=await file.arrayBuffer(),file=new Uint8Array(file),filePtr=this._runCode.malloc(file.length);return this._wasmModule.HEAPU8.set(file,filePtr),{ptr:filePtr,length:file.length}}}var libarchive=(()=>{var _scriptDir=import.meta.url;return async function(){var readyPromiseResolve,readyPromiseReject,require,fs,nodePath,read_,readBinary,readAsync,moduleArg=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},Module=moduleArg,moduleOverrides=(Module.ready=new Promise((resolve,reject)=>{readyPromiseResolve=resolve,readyPromiseReject=reject}),Object.assign({},Module)),thisProgram="./this.program",quit_=(status,toThrow)=>{throw toThrow},ENVIRONMENT_IS_WEB="object"==typeof window,ENVIRONMENT_IS_WORKER="function"==typeof importScripts,ENVIRONMENT_IS_NODE="object"==typeof process&&"object"==typeof process.versions&&"string"==typeof process.versions.node,scriptDirectory="";ENVIRONMENT_IS_NODE?(createRequire=(await import("module"))["createRequire"],require=createRequire(import.meta.url),fs=require("fs"),nodePath=require("path"),scriptDirectory=ENVIRONMENT_IS_WORKER?nodePath.dirname(scriptDirectory)+"/":require("url").fileURLToPath(new URL("./",import.meta.url)),read_=(filename,binary)=>(filename=isFileURI(filename)?new URL(filename):nodePath.normalize(filename),fs.readFileSync(filename,binary?void 0:"utf8")),readBinary=filename=>{filename=read_(filename,!0);return filename=filename.buffer?filename:new Uint8Array(filename)},readAsync=function(filename,onload,onerror){var binary=!(3<arguments.length&&void 0!==arguments[3])||arguments[3];filename=isFileURI(filename)?new URL(filename):nodePath.normalize(filename),fs.readFile(filename,binary?void 0:"utf8",(err,data)=>{err?onerror(err):onload(binary?data.buffer:data)})},!Module.thisProgram&&1<process.argv.length&&(thisProgram=process.argv[1].replace(/\\/g,"/")),process.argv.slice(2),quit_=(status,toThrow)=>{throw process.exitCode=status,toThrow},Module.inspect=()=>"[Emscripten Module object]"):(ENVIRONMENT_IS_WEB||ENVIRONMENT_IS_WORKER)&&(ENVIRONMENT_IS_WORKER?scriptDirectory=self.location.href:"undefined"!=typeof document&&document.currentScript&&(scriptDirectory=document.currentScript.src),scriptDirectory=0!==(scriptDirectory=_scriptDir?_scriptDir:scriptDirectory).indexOf("blob:")?scriptDirectory.substr(0,scriptDirectory.replace(/[?#].*/,"").lastIndexOf("/")+1):"",read_=url=>{var xhr=new XMLHttpRequest;return xhr.open("GET",url,!1),xhr.send(null),xhr.responseText},ENVIRONMENT_IS_WORKER&&(readBinary=url=>{var xhr=new XMLHttpRequest;return xhr.open("GET",url,!1),xhr.responseType="arraybuffer",xhr.send(null),new Uint8Array(xhr.response)}),readAsync=(url,onload,onerror)=>{var xhr=new XMLHttpRequest;xhr.open("GET",url,!0),xhr.responseType="arraybuffer",xhr.onload=()=>{200==xhr.status||0==xhr.status&&xhr.response?onload(xhr.response):onerror()},xhr.onerror=onerror,xhr.send(null)});var wasmBinary,wasmMemory,HEAP8,HEAPU8,HEAP16,HEAP32,HEAPU32,out=Module.print||console.log.bind(console),err=Module.printErr||console.error.bind(console),ABORT=(Object.assign(Module,moduleOverrides),Module.arguments&&Module.arguments,Module.thisProgram&&(thisProgram=Module.thisProgram),Module.quit&&(quit_=Module.quit),Module.wasmBinary&&(wasmBinary=Module.wasmBinary),"object"!=typeof WebAssembly&&abort("no native wasm support detected"),!1);function assert(condition,text){condition||abort(text)}function updateMemoryViews(){var b=wasmMemory.buffer;Module.HEAP8=HEAP8=new Int8Array(b),Module.HEAP16=HEAP16=new Int16Array(b),Module.HEAPU8=HEAPU8=new Uint8Array(b),Module.HEAPU16=new Uint16Array(b),Module.HEAP32=HEAP32=new Int32Array(b),Module.HEAPU32=HEAPU32=new Uint32Array(b),Module.HEAPF32=new Float32Array(b),Module.HEAPF64=new Float64Array(b)}var __ATPRERUN__=[],__ATINIT__=[],__ATPOSTRUN__=[];function preRun(){if(Module.preRun)for("function"==typeof Module.preRun&&(Module.preRun=[Module.preRun]);Module.preRun.length;)cb=Module.preRun.shift(),__ATPRERUN__.unshift(cb);var cb;callRuntimeCallbacks(__ATPRERUN__)}function postRun(){if(Module.postRun)for("function"==typeof Module.postRun&&(Module.postRun=[Module.postRun]);Module.postRun.length;)cb=Module.postRun.shift(),__ATPOSTRUN__.unshift(cb);var cb;callRuntimeCallbacks(__ATPOSTRUN__)}var runDependencies=0,dependenciesFulfilled=null;function addRunDependency(){var _Module$monitorRunDep;runDependencies++,null!=(_Module$monitorRunDep=Module.monitorRunDependencies)&&_Module$monitorRunDep.call(Module,runDependencies)}function removeRunDependency(){var _Module$monitorRunDep2;runDependencies--,null!=(_Module$monitorRunDep2=Module.monitorRunDependencies)&&_Module$monitorRunDep2.call(Module,runDependencies),0==runDependencies&&dependenciesFulfilled&&(_Module$monitorRunDep2=dependenciesFulfilled,dependenciesFulfilled=null,_Module$monitorRunDep2())}function abort(what){null!=(_Module$onAbort=Module.onAbort)&&_Module$onAbort.call(Module,what),err(what="Aborted("+what+")"),ABORT=!0,what+=". Build with -sASSERTIONS for more info.";var _Module$onAbort=new WebAssembly.RuntimeError(what);throw readyPromiseReject(_Module$onAbort),_Module$onAbort}var wasmBinaryFile,createRequire,tempDouble,tempI64,isDataURI=filename=>filename.startsWith("data:application/octet-stream;base64,"),isFileURI=filename=>filename.startsWith("file://");function getBinarySync(file){if(file==wasmBinaryFile&&wasmBinary)return new Uint8Array(wasmBinary);if(readBinary)return readBinary(file);throw"both async and sync fetching of the wasm failed"}function instantiateArrayBuffer(binaryFile,imports,receiver){return function(binaryFile){if(!wasmBinary&&(ENVIRONMENT_IS_WEB||ENVIRONMENT_IS_WORKER)){if("function"==typeof fetch&&!isFileURI(binaryFile))return fetch(binaryFile,{credentials:"same-origin"}).then(response=>{if(response.ok)return response.arrayBuffer();throw"failed to load wasm binary file at '"+binaryFile+"'"}).catch(()=>getBinarySync(binaryFile));if(readAsync)return new Promise((resolve,reject)=>{readAsync(binaryFile,response=>resolve(new Uint8Array(response)),reject)})}return Promise.resolve().then(()=>getBinarySync(binaryFile))}(binaryFile).then(binary=>WebAssembly.instantiate(binary,imports)).then(instance=>instance).then(receiver,reason=>{err("failed to asynchronously prepare wasm: ".concat(reason)),abort(reason)})}function ExitStatus(status){this.name="ExitStatus",this.message="Program terminated with exit(".concat(status,")"),this.status=status}Module.locateFile?isDataURI(wasmBinaryFile="libarchive.wasm")||(createRequire=wasmBinaryFile,wasmBinaryFile=Module.locateFile?Module.locateFile(createRequire,scriptDirectory):scriptDirectory+createRequire):wasmBinaryFile=new URL("libarchive.wasm",import.meta.url).href;var callRuntimeCallbacks=callbacks=>{for(;0<callbacks.length;)callbacks.shift()(Module)},noExitRuntime=Module.noExitRuntime||!0,PATH={isAbs:path=>"/"===path.charAt(0),splitPath:filename=>{return/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/.exec(filename).slice(1)},normalizeArray:(parts,allowAboveRoot)=>{for(var up=0,i=parts.length-1;0<=i;i--){var last=parts[i];"."===last?parts.splice(i,1):".."===last?(parts.splice(i,1),up++):up&&(parts.splice(i,1),up--)}if(allowAboveRoot)for(;up;up--)parts.unshift("..");return parts},normalize:path=>{var isAbsolute=PATH.isAbs(path),trailingSlash="/"===path.substr(-1);return(path=(path=PATH.normalizeArray(path.split("/").filter(p=>!!p),!isAbsolute).join("/"))||isAbsolute?path:".")&&trailingSlash&&(path+="/"),(isAbsolute?"/":"")+path},dirname:path=>{var path=PATH.splitPath(path),root=path[0],path=path[1];return root||path?root+(path=path&&path.substr(0,path.length-1)):"."},basename:path=>{var lastSlash;return"/"===path?"/":-1===(lastSlash=(path=(path=PATH.normalize(path)).replace(/\/$/,"")).lastIndexOf("/"))?path:path.substr(lastSlash+1)},join:function(){var paths=Array.prototype.slice.call(arguments);return PATH.normalize(paths.join("/"))},join2:(l,r)=>PATH.normalize(l+"/"+r)},initRandomFill=()=>{if("object"==typeof crypto&&"function"==typeof crypto.getRandomValues)return view=>crypto.getRandomValues(view);if(ENVIRONMENT_IS_NODE)try{var randomBytes,crypto_module=require("crypto");return crypto_module.randomFillSync?view=>crypto_module.randomFillSync(view):(randomBytes=crypto_module.randomBytes,view=>(view.set(randomBytes(view.byteLength)),view))}catch(e){}abort("initRandomDevice")},randomFill=view=>(randomFill=initRandomFill())(view),PATH_FS={resolve:function(){for(var resolvedPath="",resolvedAbsolute=!1,i=arguments.length-1;-1<=i&&!resolvedAbsolute;i--){var path=0<=i?arguments[i]:FS.cwd();if("string"!=typeof path)throw new TypeError("Arguments to path.resolve must be strings");if(!path)return"";resolvedPath=path+"/"+resolvedPath,resolvedAbsolute=PATH.isAbs(path)}return(resolvedAbsolute?"/":"")+(resolvedPath=PATH.normalizeArray(resolvedPath.split("/").filter(p=>!!p),!resolvedAbsolute).join("/"))||"."},relative:(from,to)=>{function trim(arr){for(var start=0;start<arr.length&&""===arr[start];start++);for(var end=arr.length-1;0<=end&&""===arr[end];end--);return end<start?[]:arr.slice(start,end-start+1)}from=PATH_FS.resolve(from).substr(1),to=PATH_FS.resolve(to).substr(1);for(var fromParts=trim(from.split("/")),toParts=trim(to.split("/")),length=Math.min(fromParts.length,toParts.length),samePartsLength=length,i=0;i<length;i++)if(fromParts[i]!==toParts[i]){samePartsLength=i;break}for(var outputParts=[],i=samePartsLength;i<fromParts.length;i++)outputParts.push("..");return(outputParts=outputParts.concat(toParts.slice(samePartsLength))).join("/")}},UTF8Decoder="undefined"!=typeof TextDecoder?new TextDecoder("utf8"):void 0,UTF8ArrayToString=(heapOrArray,idx,maxBytesToRead)=>{for(var endIdx=idx+maxBytesToRead,endPtr=idx;heapOrArray[endPtr]&&!(endIdx<=endPtr);)++endPtr;if(16<endPtr-idx&&heapOrArray.buffer&&UTF8Decoder)return UTF8Decoder.decode(heapOrArray.subarray(idx,endPtr));for(var str="";idx<endPtr;){var u2,u1,u0=heapOrArray[idx++];128&u0?(u1=63&heapOrArray[idx++],192==(224&u0)?str+=String.fromCharCode((31&u0)<<6|u1):(u2=63&heapOrArray[idx++],(u0=224==(240&u0)?(15&u0)<<12|u1<<6|u2:(7&u0)<<18|u1<<12|u2<<6|63&heapOrArray[idx++])<65536?str+=String.fromCharCode(u0):(u1=u0-65536,str+=String.fromCharCode(55296|u1>>10,56320|1023&u1)))):str+=String.fromCharCode(u0)}return str},FS_stdin_getChar_buffer=[],lengthBytesUTF8=str=>{for(var len=0,i=0;i<str.length;++i){var c=str.charCodeAt(i);c<=127?len++:c<=2047?len+=2:55296<=c&&c<=57343?(len+=4,++i):len+=3}return len},stringToUTF8Array=(str,heap,outIdx,maxBytesToWrite)=>{if(!(0<maxBytesToWrite))return 0;for(var startIdx=outIdx,endIdx=outIdx+maxBytesToWrite-1,i=0;i<str.length;++i){var u=str.charCodeAt(i);if((u=55296<=u&&u<=57343?65536+((1023&u)<<10)|1023&str.charCodeAt(++i):u)<=127){if(endIdx<=outIdx)break;heap[outIdx++]=u}else{if(u<=2047){if(endIdx<=outIdx+1)break;heap[outIdx++]=192|u>>6}else{if(u<=65535){if(endIdx<=outIdx+2)break;heap[outIdx++]=224|u>>12}else{if(endIdx<=outIdx+3)break;heap[outIdx++]=240|u>>18,heap[outIdx++]=128|u>>12&63}heap[outIdx++]=128|u>>6&63}heap[outIdx++]=128|63&u}}return heap[outIdx]=0,outIdx-startIdx};function intArrayFromString(stringy,dontAddNull,length){length=0<length?length:lengthBytesUTF8(stringy)+1,length=new Array(length),stringy=stringToUTF8Array(stringy,length,0,length.length);return dontAddNull&&(length.length=stringy),length}var TTY={ttys:[],init(){},shutdown(){},register(dev,ops){TTY.ttys[dev]={input:[],output:[],ops:ops},FS.registerDevice(dev,TTY.stream_ops)},stream_ops:{open(stream){var tty=TTY.ttys[stream.node.rdev];if(!tty)throw new FS.ErrnoError(43);stream.tty=tty,stream.seekable=!1},close(stream){stream.tty.ops.fsync(stream.tty)},fsync(stream){stream.tty.ops.fsync(stream.tty)},read(stream,buffer,offset,length,pos){if(!stream.tty||!stream.tty.ops.get_char)throw new FS.ErrnoError(60);for(var result,bytesRead=0,i=0;i<length;i++){try{result=stream.tty.ops.get_char(stream.tty)}catch(e){throw new FS.ErrnoError(29)}if(void 0===result&&0===bytesRead)throw new FS.ErrnoError(6);if(null==result)break;bytesRead++,buffer[offset+i]=result}return bytesRead&&(stream.node.timestamp=Date.now()),bytesRead},write(stream,buffer,offset,length,pos){if(!stream.tty||!stream.tty.ops.put_char)throw new FS.ErrnoError(60);try{for(var i=0;i<length;i++)stream.tty.ops.put_char(stream.tty,buffer[offset+i])}catch(e){throw new FS.ErrnoError(29)}return length&&(stream.node.timestamp=Date.now()),i}},default_tty_ops:{get_char(tty){if(!FS_stdin_getChar_buffer.length){var result=null;if(ENVIRONMENT_IS_NODE){var buf=Buffer.alloc(256),bytesRead=0,fd=process.stdin.fd;try{bytesRead=fs.readSync(fd,buf)}catch(e){if(!e.toString().includes("EOF"))throw e;bytesRead=0}result=0<bytesRead?buf.slice(0,bytesRead).toString("utf-8"):null}else"undefined"!=typeof window&&"function"==typeof window.prompt?null!==(result=window.prompt("Input: "))&&(result+="\n"):"function"==typeof readline&&null!==(result=readline())&&(result+="\n");if(!result)return null;FS_stdin_getChar_buffer=intArrayFromString(result,!0)}return FS_stdin_getChar_buffer.shift()},put_char(tty,val){null===val||10===val?(out(UTF8ArrayToString(tty.output,0)),tty.output=[]):0!=val&&tty.output.push(val)},fsync(tty){tty.output&&0<tty.output.length&&(out(UTF8ArrayToString(tty.output,0)),tty.output=[])},ioctl_tcgets(tty){return{c_iflag:25856,c_oflag:5,c_cflag:191,c_lflag:35387,c_cc:[3,28,127,21,4,0,1,0,17,19,26,0,18,15,23,22,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]}},ioctl_tcsets(tty,optional_actions,data){return 0},ioctl_tiocgwinsz(tty){return[24,80]}},default_tty1_ops:{put_char(tty,val){null===val||10===val?(err(UTF8ArrayToString(tty.output,0)),tty.output=[]):0!=val&&tty.output.push(val)},fsync(tty){tty.output&&0<tty.output.length&&(err(UTF8ArrayToString(tty.output,0)),tty.output=[])}}},mmapAlloc=size=>{abort()},MEMFS={ops_table:null,mount(mount){return MEMFS.createNode(null,"/",16895,0)},createNode(parent,name,mode,dev){if(FS.isBlkdev(mode)||FS.isFIFO(mode))throw new FS.ErrnoError(63);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}});mode=FS.createNode(parent,name,mode,dev);return FS.isDir(mode.mode)?(mode.node_ops=MEMFS.ops_table.dir.node,mode.stream_ops=MEMFS.ops_table.dir.stream,mode.contents={}):FS.isFile(mode.mode)?(mode.node_ops=MEMFS.ops_table.file.node,mode.stream_ops=MEMFS.ops_table.file.stream,mode.usedBytes=0,mode.contents=null):FS.isLink(mode.mode)?(mode.node_ops=MEMFS.ops_table.link.node,mode.stream_ops=MEMFS.ops_table.link.stream):FS.isChrdev(mode.mode)&&(mode.node_ops=MEMFS.ops_table.chrdev.node,mode.stream_ops=MEMFS.ops_table.chrdev.stream),mode.timestamp=Date.now(),parent&&(parent.contents[name]=mode,parent.timestamp=mode.timestamp),mode},getFileDataAsTypedArray(node){return node.contents?node.contents.subarray?node.contents.subarray(0,node.usedBytes):new Uint8Array(node.contents):new Uint8Array(0)},expandFileStorage(node,newCapacity){var prevCapacity=node.contents?node.contents.length:0;newCapacity<=prevCapacity||(newCapacity=Math.max(newCapacity,prevCapacity*(prevCapacity<1048576?2:1.125)>>>0),0!=prevCapacity&&(newCapacity=Math.max(newCapacity,256)),prevCapacity=node.contents,node.contents=new Uint8Array(newCapacity),0<node.usedBytes&&node.contents.set(prevCapacity.subarray(0,node.usedBytes),0))},resizeFileStorage(node,newSize){var oldContents;node.usedBytes!=newSize&&(0==newSize?(node.contents=null,node.usedBytes=0):(oldContents=node.contents,node.contents=new Uint8Array(newSize),oldContents&&node.contents.set(oldContents.subarray(0,Math.min(newSize,node.usedBytes))),node.usedBytes=newSize))},node_ops:{getattr(node){var attr={};return attr.dev=FS.isChrdev(node.mode)?node.id:1,attr.ino=node.id,attr.mode=node.mode,attr.nlink=1,attr.uid=0,attr.gid=0,attr.rdev=node.rdev,FS.isDir(node.mode)?attr.size=4096:FS.isFile(node.mode)?attr.size=node.usedBytes:FS.isLink(node.mode)?attr.size=node.link.length:attr.size=0,attr.atime=new Date(node.timestamp),attr.mtime=new Date(node.timestamp),attr.ctime=new Date(node.timestamp),attr.blksize=4096,attr.blocks=Math.ceil(attr.size/attr.blksize),attr},setattr(node,attr){void 0!==attr.mode&&(node.mode=attr.mode),void 0!==attr.timestamp&&(node.timestamp=attr.timestamp),void 0!==attr.size&&MEMFS.resizeFileStorage(node,attr.size)},lookup(parent,name){throw FS.genericErrors[44]},mknod(parent,name,mode,dev){return MEMFS.createNode(parent,name,mode,dev)},rename(old_node,new_dir,new_name){if(FS.isDir(old_node.mode)){var new_node;try{new_node=FS.lookupNode(new_dir,new_name)}catch(e){}if(new_node)for(var i in new_node.contents)throw new FS.ErrnoError(55)}delete old_node.parent.contents[old_node.name],old_node.parent.timestamp=Date.now(),old_node.name=new_name,new_dir.contents[new_name]=old_node,new_dir.timestamp=old_node.parent.timestamp,old_node.parent=new_dir},unlink(parent,name){delete parent.contents[name],parent.timestamp=Date.now()},rmdir(parent,name){for(var i in FS.lookupNode(parent,name).contents)throw new FS.ErrnoError(55);delete parent.contents[name],parent.timestamp=Date.now()},readdir(node){var key,entries=[".",".."];for(key of Object.keys(node.contents))entries.push(key);return entries},symlink(parent,newname,oldpath){parent=MEMFS.createNode(parent,newname,41471,0);return parent.link=oldpath,parent},readlink(node){if(FS.isLink(node.mode))return node.link;throw new FS.ErrnoError(28)}},stream_ops:{read(stream,buffer,offset,length,position){var contents=stream.node.contents;if(position>=stream.node.usedBytes)return 0;var size=Math.min(stream.node.usedBytes-position,length);if(8<size&&contents.subarray)buffer.set(contents.subarray(position,position+size),offset);else for(var i=0;i<size;i++)buffer[offset+i]=contents[position+i];return size},write(stream,buffer,offset,length,position,canOwn){if(buffer.buffer===HEAP8.buffer&&(canOwn=!1),!length)return 0;var node=stream.node;if(node.timestamp=Date.now(),buffer.subarray&&(!node.contents||node.contents.subarray)){if(canOwn)return node.contents=buffer.subarray(offset,offset+length),node.usedBytes=length;if(0===node.usedBytes&&0===position)return node.contents=buffer.slice(offset,offset+length),node.usedBytes=length;if(position+length<=node.usedBytes)return node.contents.set(buffer.subarray(offset,offset+length),position),length}if(MEMFS.expandFileStorage(node,position+length),node.contents.subarray&&buffer.subarray)node.contents.set(buffer.subarray(offset,offset+length),position);else for(var i=0;i<length;i++)node.contents[position+i]=buffer[offset+i];return node.usedBytes=Math.max(node.usedBytes,position+length),length},llseek(stream,offset,whence){if(1===whence?offset+=stream.position:2===whence&&FS.isFile(stream.node.mode)&&(offset+=stream.node.usedBytes),offset<0)throw new FS.ErrnoError(28);return offset},allocate(stream,offset,length){MEMFS.expandFileStorage(stream.node,offset+length),stream.node.usedBytes=Math.max(stream.node.usedBytes,offset+length)},mmap(stream,length,position,prot,flags){if(!FS.isFile(stream.node.mode))throw new FS.ErrnoError(43);var ptr,allocated,stream=stream.node.contents;if(2&flags||stream.buffer!==HEAP8.buffer){if((0<position||position+length<stream.length)&&(stream=stream.subarray?stream.subarray(position,position+length):Array.prototype.slice.call(stream,position,position+length)),allocated=!0,!(ptr=mmapAlloc()))throw new FS.ErrnoError(48);HEAP8.set(stream,ptr)}else allocated=!1,ptr=stream.byteOffset;return{ptr:ptr,allocated:allocated}},msync(stream,buffer,offset,length,mmapFlags){return MEMFS.stream_ops.write(stream,buffer,0,length,offset,!1),0}}},preloadPlugins=Module.preloadPlugins||[],FS_getMode=(canRead,canWrite)=>{var mode=0;return canRead&&(mode|=365),canWrite&&(mode|=146),mode},FS={root:null,mounts:[],devices:{},streams:[],nextInode:1,nameTable:null,currentPath:"/",initialized:!1,ignorePermissions:!0,ErrnoError:null,genericErrors:{},filesystems:null,syncFSRequests:0,lookupPath(path){var opts=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{};if(!(path=PATH_FS.resolve(path)))return{path:"",node:null};if(8<(opts=Object.assign({follow_mount:!0,recurse_count:0},opts)).recurse_count)throw new FS.ErrnoError(32);for(var parts=path.split("/").filter(p=>!!p),current=FS.root,current_path="/",i=0;i<parts.length;i++){var islast=i===parts.length-1;if(islast&&opts.parent)break;if(current=FS.lookupNode(current,parts[i]),current_path=PATH.join2(current_path,parts[i]),!FS.isMountpoint(current)||islast&&!opts.follow_mount||(current=current.mounted.root),!islast||opts.follow)for(var count=0;FS.isLink(current.mode);){var link=FS.readlink(current_path),current_path=PATH_FS.resolve(PATH.dirname(current_path),link),current=FS.lookupPath(current_path,{recurse_count:opts.recurse_count+1}).node;if(40<count++)throw new FS.ErrnoError(32)}}return{path:current_path,node:current}},getPath(node){for(var path,mount;;){if(FS.isRoot(node))return mount=node.mount.mountpoint,path?"/"!==mount[mount.length-1]?"".concat(mount,"/").concat(path):mount+path:mount;path=path?"".concat(node.name,"/").concat(path):node.name,node=node.parent}},hashName(parentid,name){for(var hash=0,i=0;i<name.length;i++)hash=(hash<<5)-hash+name.charCodeAt(i)|0;return(parentid+hash>>>0)%FS.nameTable.length},hashAddNode(node){var hash=FS.hashName(node.parent.id,node.name);node.name_next=FS.nameTable[hash],FS.nameTable[hash]=node},hashRemoveNode(node){var hash=FS.hashName(node.parent.id,node.name);if(FS.nameTable[hash]===node)FS.nameTable[hash]=node.name_next;else for(var current=FS.nameTable[hash];current;){if(current.name_next===node){current.name_next=node.name_next;break}current=current.name_next}},lookupNode(parent,name){var errCode=FS.mayLookup(parent);if(errCode)throw new FS.ErrnoError(errCode,parent);for(var errCode=FS.hashName(parent.id,name),node=FS.nameTable[errCode];node;node=node.name_next){var nodeName=node.name;if(node.parent.id===parent.id&&nodeName===name)return node}return FS.lookup(parent,name)},createNode(parent,name,mode,rdev){parent=new FS.FSNode(parent,name,mode,rdev);return FS.hashAddNode(parent),parent},destroyNode(node){FS.hashRemoveNode(node)},isRoot(node){return node===node.parent},isMountpoint(node){return!!node.mounted},isFile(mode){return 32768==(61440&mode)},isDir(mode){return 16384==(61440&mode)},isLink(mode){return 40960==(61440&mode)},isChrdev(mode){return 8192==(61440&mode)},isBlkdev(mode){return 24576==(61440&mode)},isFIFO(mode){return 4096==(61440&mode)},isSocket(mode){return 49152==(49152&mode)},flagsToPermissionString(flag){var perms=["r","w","rw"][3&flag];return 512&flag&&(perms+="w"),perms},nodePermissions(node,perms){return FS.ignorePermissions||(!perms.includes("r")||292&node.mode)&&(!perms.includes("w")||146&node.mode)&&(!perms.includes("x")||73&node.mode)?0:2},mayLookup(dir){var errCode=FS.nodePermissions(dir,"x");return errCode||(dir.node_ops.lookup?0:2)},mayCreate(dir,name){try{FS.lookupNode(dir,name);return 20}catch(e){}return FS.nodePermissions(dir,"wx")},mayDelete(dir,name,isdir){var node;try{node=FS.lookupNode(dir,name)}catch(e){return e.errno}name=FS.nodePermissions(dir,"wx");if(name)return name;if(isdir){if(!FS.isDir(node.mode))return 54;if(FS.isRoot(node)||FS.getPath(node)===FS.cwd())return 10}else if(FS.isDir(node.mode))return 31;return 0},mayOpen(node,flags){return node?FS.isLink(node.mode)?32:FS.isDir(node.mode)&&("r"!==FS.flagsToPermissionString(flags)||512&flags)?31:FS.nodePermissions(node,FS.flagsToPermissionString(flags)):44},MAX_OPEN_FDS:4096,nextfd(){for(var fd=0;fd<=FS.MAX_OPEN_FDS;fd++)if(!FS.streams[fd])return fd;throw new FS.ErrnoError(33)},getStreamChecked(fd){fd=FS.getStream(fd);if(fd)return fd;throw new FS.ErrnoError(8)},getStream:fd=>FS.streams[fd],createStream(stream){var fd=1<arguments.length&&void 0!==arguments[1]?arguments[1]:-1;return FS.FSStream||(FS.FSStream=function(){this.shared={}},FS.FSStream.prototype={},Object.defineProperties(FS.FSStream.prototype,{object:{get(){return this.node},set(val){this.node=val}},isRead:{get(){return 1!=(2097155&this.flags)}},isWrite:{get(){return 0!=(2097155&this.flags)}},isAppend:{get(){return 1024&this.flags}},flags:{get(){return this.shared.flags},set(val){this.shared.flags=val}},position:{get(){return this.shared.position},set(val){this.shared.position=val}}})),stream=Object.assign(new FS.FSStream,stream),-1==fd&&(fd=FS.nextfd()),stream.fd=fd,FS.streams[fd]=stream},closeStream(fd){FS.streams[fd]=null},chrdev_stream_ops:{open(stream){var device=FS.getDevice(stream.node.rdev);stream.stream_ops=device.stream_ops,null!=stream.stream_ops.open&&stream.stream_ops.open(stream)},llseek(){throw new FS.ErrnoError(70)}},major:dev=>dev>>8,minor:dev=>255&dev,makedev:(ma,mi)=>ma<<8|mi,registerDevice(dev,ops){FS.devices[dev]={stream_ops:ops}},getDevice:dev=>FS.devices[dev],getMounts(mount){for(var mounts=[],check=[mount];check.length;){var m=check.pop();mounts.push(m),check.push.apply(check,m.mounts)}return mounts},syncfs(populate,callback){"function"==typeof populate&&(callback=populate,populate=!1),FS.syncFSRequests++,1<FS.syncFSRequests&&err("warning: ".concat(FS.syncFSRequests," FS.syncfs operations in flight at once, probably just doing extra work"));var mounts=FS.getMounts(FS.root.mount),completed=0;function doCallback(errCode){return FS.syncFSRequests--,callback(errCode)}function done(errCode){if(errCode)return done.errored?void 0:(done.errored=!0,doCallback(errCode));++completed>=mounts.length&&doCallback(null)}mounts.forEach(mount=>{if(!mount.type.syncfs)return done(null);mount.type.syncfs(mount,populate,done)})},mount(type,opts,mountpoint){var node,root="/"===mountpoint,pseudo=!mountpoint;if(root&&FS.root)throw new FS.ErrnoError(10);if(!root&&!pseudo){pseudo=FS.lookupPath(mountpoint,{follow_mount:!1});if(mountpoint=pseudo.path,node=pseudo.node,FS.isMountpoint(node))throw new FS.ErrnoError(10);if(!FS.isDir(node.mode))throw new FS.ErrnoError(54)}pseudo={type:type,opts:opts,mountpoint:mountpoint,mounts:[]},opts=type.mount(pseudo);return(opts.mount=pseudo).root=opts,root?FS.root=opts:node&&(node.mounted=pseudo,node.mount)&&node.mount.mounts.push(pseudo),opts},unmount(mountpoint){mountpoint=FS.lookupPath(mountpoint,{follow_mount:!1});if(!FS.isMountpoint(mountpoint.node))throw new FS.ErrnoError(28);var mountpoint=mountpoint.node,mount=mountpoint.mounted,mounts=FS.getMounts(mount),mount=(Object.keys(FS.nameTable).forEach(hash=>{for(var current=FS.nameTable[hash];current;){var next=current.name_next;mounts.includes(current.mount)&&FS.destroyNode(current),current=next}}),mountpoint.mounted=null,mountpoint.mount.mounts.indexOf(mount));mountpoint.mount.mounts.splice(mount,1)},lookup(parent,name){return parent.node_ops.lookup(parent,name)},mknod(path,mode,dev){var parent=FS.lookupPath(path,{parent:!0}).node,path=PATH.basename(path);if(!path||"."===path||".."===path)throw new FS.ErrnoError(28);var errCode=FS.mayCreate(parent,path);if(errCode)throw new FS.ErrnoError(errCode);if(parent.node_ops.mknod)return parent.node_ops.mknod(parent,path,mode,dev);throw new FS.ErrnoError(63)},create(path,mode){return FS.mknod(path,mode=(mode=void 0!==mode?mode:438)&4095|32768,0)},mkdir(path,mode){return FS.mknod(path,mode=(mode=void 0!==mode?mode:511)&1023|16384,0)},mkdirTree(path,mode){for(var dirs=path.split("/"),d="",i=0;i<dirs.length;++i)if(dirs[i]){d+="/"+dirs[i];try{FS.mkdir(d,mode)}catch(e){if(20!=e.errno)throw e}}},mkdev(path,mode,dev){return void 0===dev&&(dev=mode,mode=438),FS.mknod(path,mode|=8192,dev)},symlink(oldpath,newpath){if(!PATH_FS.resolve(oldpath))throw new FS.ErrnoError(44);var parent=FS.lookupPath(newpath,{parent:!0}).node;if(!parent)throw new FS.ErrnoError(44);var newpath=PATH.basename(newpath),errCode=FS.mayCreate(parent,newpath);if(errCode)throw new FS.ErrnoError(errCode);if(parent.node_ops.symlink)return parent.node_ops.symlink(parent,newpath,oldpath);throw new FS.ErrnoError(63)},rename(old_path,new_path){var old_dirname=PATH.dirname(old_path),new_dirname=PATH.dirname(new_path),old_name=PATH.basename(old_path),new_name=PATH.basename(new_path),lookup=FS.lookupPath(old_path,{parent:!0}),lookup=lookup.node,new_dir=FS.lookupPath(new_path,{parent:!0}).node;if(!lookup||!new_dir)throw new FS.ErrnoError(44);if(lookup.mount!==new_dir.mount)throw new FS.ErrnoError(75);var new_node,old_node=FS.lookupNode(lookup,old_name),old_path=PATH_FS.relative(old_path,new_dirname);if("."!==old_path.charAt(0))throw new FS.ErrnoError(28);if("."!==(old_path=PATH_FS.relative(new_path,old_dirname)).charAt(0))throw new FS.ErrnoError(55);try{new_node=FS.lookupNode(new_dir,new_name)}catch(e){}if(old_node!==new_node){new_dirname=FS.isDir(old_node.mode),new_path=FS.mayDelete(lookup,old_name,new_dirname);if(new_path)throw new FS.ErrnoError(new_path);if(new_path=new_node?FS.mayDelete(new_dir,new_name,new_dirname):FS.mayCreate(new_dir,new_name))throw new FS.ErrnoError(new_path);if(!lookup.node_ops.rename)throw new FS.ErrnoError(63);if(FS.isMountpoint(old_node)||new_node&&FS.isMountpoint(new_node))throw new FS.ErrnoError(10);if(new_dir!==lookup&&(new_path=FS.nodePermissions(lookup,"w")))throw new FS.ErrnoError(new_path);FS.hashRemoveNode(old_node);try{lookup.node_ops.rename(old_node,new_dir,new_name)}catch(e){throw e}finally{FS.hashAddNode(old_node)}}},rmdir(path){var parent=FS.lookupPath(path,{parent:!0}).node,path=PATH.basename(path),node=FS.lookupNode(parent,path),errCode=FS.mayDelete(parent,path,!0);if(errCode)throw new FS.ErrnoError(errCode);if(!parent.node_ops.rmdir)throw new FS.ErrnoError(63);if(FS.isMountpoint(node))throw new FS.ErrnoError(10);parent.node_ops.rmdir(parent,path),FS.destroyNode(node)},readdir(path){path=FS.lookupPath(path,{follow:!0}).node;if(path.node_ops.readdir)return path.node_ops.readdir(path);throw new FS.ErrnoError(54)},unlink(path){var parent=FS.lookupPath(path,{parent:!0}).node;if(!parent)throw new FS.ErrnoError(44);var path=PATH.basename(path),node=FS.lookupNode(parent,path),errCode=FS.mayDelete(parent,path,!1);if(errCode)throw new FS.ErrnoError(errCode);if(!parent.node_ops.unlink)throw new FS.ErrnoError(63);if(FS.isMountpoint(node))throw new FS.ErrnoError(10);parent.node_ops.unlink(parent,path),FS.destroyNode(node)},readlink(path){path=FS.lookupPath(path).node;if(!path)throw new FS.ErrnoError(44);if(path.node_ops.readlink)return PATH_FS.resolve(FS.getPath(path.parent),path.node_ops.readlink(path));throw new FS.ErrnoError(28)},stat(path,dontFollow){path=FS.lookupPath(path,{follow:!dontFollow}).node;if(!path)throw new FS.ErrnoError(44);if(path.node_ops.getattr)return path.node_ops.getattr(path);throw new FS.ErrnoError(63)},lstat(path){return FS.stat(path,!0)},chmod(path,mode,dontFollow){if(!(dontFollow="string"==typeof path?FS.lookupPath(path,{follow:!dontFollow}).node:path).node_ops.setattr)throw new FS.ErrnoError(63);dontFollow.node_ops.setattr(dontFollow,{mode:4095&mode|-4096&dontFollow.mode,timestamp:Date.now()})},lchmod(path,mode){FS.chmod(path,mode,!0)},fchmod(fd,mode){fd=FS.getStreamChecked(fd);FS.chmod(fd.node,mode)},chown(path,uid,gid,dontFollow){if(!(dontFollow="string"==typeof path?FS.lookupPath(path,{follow:!dontFollow}).node:path).node_ops.setattr)throw new FS.ErrnoError(63);dontFollow.node_ops.setattr(dontFollow,{timestamp:Date.now()})},lchown(path,uid,gid){FS.chown(path,uid,gid,!0)},fchown(fd,uid,gid){fd=FS.getStreamChecked(fd);FS.chown(fd.node,uid,gid)},truncate(path,len){if(len<0)throw new FS.ErrnoError(28);if(!(path="string"==typeof path?FS.lookupPath(path,{follow:!0}).node:path).node_ops.setattr)throw new FS.ErrnoError(63);if(FS.isDir(path.mode))throw new FS.ErrnoError(31);if(!FS.isFile(path.mode))throw new FS.ErrnoError(28);var errCode=FS.nodePermissions(path,"w");if(errCode)throw new FS.ErrnoError(errCode);path.node_ops.setattr(path,{size:len,timestamp:Date.now()})},ftruncate(fd,len){fd=FS.getStreamChecked(fd);if(0==(2097155&fd.flags))throw new FS.ErrnoError(28);FS.truncate(fd.node,len)},utime(path,atime,mtime){path=FS.lookupPath(path,{follow:!0}).node;path.node_ops.setattr(path,{timestamp:Math.max(atime,mtime)})},open(path,flags,mode){if(""===path)throw new FS.ErrnoError(44);if(mode=void 0===mode?438:mode,mode=64&(flags="string"==typeof flags?(str=>{var flags={r:0,"r+":2,w:577,"w+":578,a:1089,"a+":1090}[str];if(void 0===flags)throw new Error("Unknown file open mode: ".concat(str));return flags})(flags):flags)?4095&mode|32768:0,"object"==typeof path)node=path;else{path=PATH.normalize(path);try{var node=FS.lookupPath(path,{follow:!(131072&flags)}).node}catch(e){}}var created=!1;if(64&flags)if(node){if(128&flags)throw new FS.ErrnoError(20)}else node=FS.mknod(path,mode,0),created=!0;if(!node)throw new FS.ErrnoError(44);if(FS.isChrdev(node.mode)&&(flags&=-513),65536&flags&&!FS.isDir(node.mode))throw new FS.ErrnoError(54);if(!created){mode=FS.mayOpen(node,flags);if(mode)throw new FS.ErrnoError(mode)}512&flags&&!created&&FS.truncate(node,0),flags&=-131713;mode=FS.createStream({node:node,path:FS.getPath(node),flags:flags,seekable:!0,position:0,stream_ops:node.stream_ops,ungotten:[],error:!1});return mode.stream_ops.open&&mode.stream_ops.open(mode),!Module.logReadFiles||1&flags||(FS.readFiles||(FS.readFiles={}),path in FS.readFiles)||(FS.readFiles[path]=1),mode},close(stream){if(FS.isClosed(stream))throw new FS.ErrnoError(8);stream.getdents&&(stream.getdents=null);try{stream.stream_ops.close&&stream.stream_ops.close(stream)}catch(e){throw e}finally{FS.closeStream(stream.fd)}stream.fd=null},isClosed(stream){return null===stream.fd},llseek(stream,offset,whence){if(FS.isClosed(stream))throw new FS.ErrnoError(8);if(!stream.seekable||!stream.stream_ops.llseek)throw new FS.ErrnoError(70);if(0!=whence&&1!=whence&&2!=whence)throw new FS.ErrnoError(28);return stream.position=stream.stream_ops.llseek(stream,offset,whence),stream.ungotten=[],stream.position},read(stream,buffer,offset,length,position){if(length<0||position<0)throw new FS.ErrnoError(28);if(FS.isClosed(stream))throw new FS.ErrnoError(8);if(1==(2097155&stream.flags))throw new FS.ErrnoError(8);if(FS.isDir(stream.node.mode))throw new FS.ErrnoError(31);if(!stream.stream_ops.read)throw new FS.ErrnoError(28);var seeking=void 0!==position;if(seeking){if(!stream.seekable)throw new FS.ErrnoError(70)}else position=stream.position;buffer=stream.stream_ops.read(stream,buffer,offset,length,position);return seeking||(stream.position+=buffer),buffer},write(stream,buffer,offset,length,position,canOwn){if(length<0||position<0)throw new FS.ErrnoError(28);if(FS.isClosed(stream))throw new FS.ErrnoError(8);if(0==(2097155&stream.flags))throw new FS.ErrnoError(8);if(FS.isDir(stream.node.mode))throw new FS.ErrnoError(31);if(!stream.stream_ops.write)throw new FS.ErrnoError(28);stream.seekable&&1024&stream.flags&&FS.llseek(stream,0,2);var seeking=void 0!==position;if(seeking){if(!stream.seekable)throw new FS.ErrnoError(70)}else position=stream.position;buffer=stream.stream_ops.write(stream,buffer,offset,length,position,canOwn);return seeking||(stream.position+=buffer),buffer},allocate(stream,offset,length){if(FS.isClosed(stream))throw new FS.ErrnoError(8);if(offset<0||length<=0)throw new FS.ErrnoError(28);if(0==(2097155&stream.flags))throw new FS.ErrnoError(8);if(!FS.isFile(stream.node.mode)&&!FS.isDir(stream.node.mode))throw new FS.ErrnoError(43);if(!stream.stream_ops.allocate)throw new FS.ErrnoError(138);stream.stream_ops.allocate(stream,offset,length)},mmap(stream,length,position,prot,flags){if(0!=(2&prot)&&0==(2&flags)&&2!=(2097155&stream.flags))throw new FS.ErrnoError(2);if(1==(2097155&stream.flags))throw new FS.ErrnoError(2);if(stream.stream_ops.mmap)return stream.stream_ops.mmap(stream,length,position,prot,flags);throw new FS.ErrnoError(43)},msync(stream,buffer,offset,length,mmapFlags){return stream.stream_ops.msync?stream.stream_ops.msync(stream,buffer,offset,length,mmapFlags):0},munmap:stream=>0,ioctl(stream,cmd,arg){if(stream.stream_ops.ioctl)return stream.stream_ops.ioctl(stream,cmd,arg);throw new FS.ErrnoError(59)},readFile(path){var ret,opts=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{};if(opts.flags=opts.flags||0,opts.encoding=opts.encoding||"binary","utf8"!==opts.encoding&&"binary"!==opts.encoding)throw new Error('Invalid encoding type "'.concat(opts.encoding,'"'));var stream=FS.open(path,opts.flags),length=FS.stat(path).size,buf=new Uint8Array(length);return FS.read(stream,buf,0,length,0),"utf8"===opts.encoding?ret=UTF8ArrayToString(buf,0):"binary"===opts.encoding&&(ret=buf),FS.close(stream),ret},writeFile(path,data){var opts=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{},stream=(opts.flags=opts.flags||577,FS.open(path,opts.flags,opts.mode));if("string"==typeof data){var buf=new Uint8Array(lengthBytesUTF8(data)+1),actualNumBytes=stringToUTF8Array(data,buf,0,buf.length);FS.write(stream,buf,0,actualNumBytes,void 0,opts.canOwn)}else{if(!ArrayBuffer.isView(data))throw new Error("Unsupported data type");FS.write(stream,data,0,data.byteLength,void 0,opts.canOwn)}FS.close(stream)},cwd:()=>FS.currentPath,chdir(path){path=FS.lookupPath(path,{follow:!0});if(null===path.node)throw new FS.ErrnoError(44);if(!FS.isDir(path.node.mode))throw new FS.ErrnoError(54);var errCode=FS.nodePermissions(path.node,"x");if(errCode)throw new FS.ErrnoError(errCode);FS.currentPath=path.path},createDefaultDirectories(){FS.mkdir("/tmp"),FS.mkdir("/home"),FS.mkdir("/home/web_user")},createDefaultDevices(){FS.mkdir("/dev"),FS.registerDevice(FS.makedev(1,3),{read:()=>0,write:(stream,buffer,offset,length,pos)=>length}),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 randomBuffer=new Uint8Array(1024),randomLeft=0,randomByte=()=>(0===randomLeft&&(randomLeft=randomFill(randomBuffer).byteLength),randomBuffer[--randomLeft]);FS.createDevice("/dev","random",randomByte),FS.createDevice("/dev","urandom",randomByte),FS.mkdir("/dev/shm"),FS.mkdir("/dev/shm/tmp")},createSpecialDirectories(){FS.mkdir("/proc");var proc_self=FS.mkdir("/proc/self");FS.mkdir("/proc/self/fd"),FS.mount({mount(){var node=FS.createNode(proc_self,"fd",16895,73);return node.node_ops={lookup(parent,name){var stream=FS.getStreamChecked(+name),name={parent:null,mount:{mountpoint:"fake"},node_ops:{readlink:()=>stream.path}};return name.parent=name}},node}},{},"/proc/self/fd")},createStandardStreams(){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"),FS.open("/dev/stdin",0),FS.open("/dev/stdout",1),FS.open("/dev/stderr",1)},ensureErrnoError(){FS.ErrnoError||(FS.ErrnoError=function(errno,node){this.name="ErrnoError",this.node=node,this.setErrno=function(errno){this.errno=errno},this.setErrno(errno),this.message="FS error"},FS.ErrnoError.prototype=new Error,FS.ErrnoError.prototype.constructor=FS.ErrnoError,[44].forEach(code=>{FS.genericErrors[code]=new FS.ErrnoError(code),FS.genericErrors[code].stack="<generic error, no stack>"}))},staticInit(){FS.ensureErrnoError(),FS.nameTable=new Array(4096),FS.mount(MEMFS,{},"/"),FS.createDefaultDirectories(),FS.createDefaultDevices(),FS.createSpecialDirectories(),FS.filesystems={MEMFS:MEMFS}},init(input,output,error){FS.init.initialized=!0,FS.ensureErrnoError(),Module.stdin=input||Module.stdin,Module.stdout=output||Module.stdout,Module.stderr=error||Module.stderr,FS.createStandardStreams()},quit(){FS.init.initialized=!1;for(var i=0;i<FS.streams.length;i++){var stream=FS.streams[i];stream&&FS.close(stream)}},findObject(path,dontResolveLastLink){path=FS.analyzePath(path,dontResolveLastLink);return path.exists?path.object:null},analyzePath(path,dontResolveLastLink){try{path=(lookup=FS.lookupPath(path,{follow:!dontResolveLastLink})).path}catch(e){}var ret={isRoot:!1,exists:!1,error:0,name:null,path:null,object:null,parentExists:!1,parentPath:null,parentObject:null};try{var lookup=FS.lookupPath(path,{parent:!0});ret.parentExists=!0,ret.parentPath=lookup.path,ret.parentObject=lookup.node,ret.name=PATH.basename(path),lookup=FS.lookupPath(path,{follow:!dontResolveLastLink}),ret.exists=!0,ret.path=lookup.path,ret.object=lookup.node,ret.name=lookup.node.name,ret.isRoot="/"===lookup.path}catch(e){ret.error=e.errno}return ret},createPath(parent,path,canRead,canWrite){parent="string"==typeof parent?parent:FS.getPath(parent);for(var parts=path.split("/").reverse();parts.length;){var part=parts.pop();if(part){var current=PATH.join2(parent,part);try{FS.mkdir(current)}catch(e){}parent=current}}return current},createFile(parent,name,properties,canRead,canWrite){parent=PATH.join2("string"==typeof parent?parent:FS.getPath(parent),name),name=FS_getMode(canRead,canWrite);return FS.create(parent,name)},createDataFile(parent,name,data,canRead,canWrite,canOwn){var path=name,name=(parent&&(parent="string"==typeof parent?parent:FS.getPath(parent),path=name?PATH.join2(parent,name):parent),FS_getMode(canRead,canWrite)),parent=FS.create(path,name);if(data){if("string"==typeof data){for(var arr=new Array(data.length),i=0,len=data.length;i<len;++i)arr[i]=data.charCodeAt(i);data=arr}FS.chmod(parent,146|name);canRead=FS.open(parent,577);FS.write(canRead,data,0,data.length,0,canOwn),FS.close(canRead),FS.chmod(parent,name)}},createDevice(parent,name,input,output){var parent=PATH.join2("string"==typeof parent?parent:FS.getPath(parent),name),name=FS_getMode(!!input,!!output),dev=(FS.createDevice.major||(FS.createDevice.major=64),FS.makedev(FS.createDevice.major++,0));return FS.registerDevice(dev,{open(stream){stream.seekable=!1},close(stream){var _output$buffer;null!=output&&null!=(_output$buffer=output.buffer)&&_output$buffer.length&&output(10)},read(stream,buffer,offset,length,pos){for(var result,bytesRead=0,i=0;i<length;i++){try{result=input()}catch(e){throw new FS.ErrnoError(29)}if(void 0===result&&0===bytesRead)throw new FS.ErrnoError(6);if(null==result)break;bytesRead++,buffer[offset+i]=result}return bytesRead&&(stream.node.timestamp=Date.now()),bytesRead},write(stream,buffer,offset,length,pos){for(var i=0;i<length;i++)try{output(buffer[offset+i])}catch(e){throw new FS.ErrnoError(29)}return length&&(stream.node.timestamp=Date.now()),i}}),FS.mkdev(parent,name,dev)},forceLoadFile(obj){if(obj.isDevice||obj.isFolder||obj.link||obj.contents)return!0;if("undefined"!=typeof XMLHttpRequest)throw new Error("Lazy loading should have been performed (contents set) in createLazyFile, but it was not. Lazy loading only works in web workers. Use --embed-file or --preload-file in emcc on the main thread.");if(!read_)throw new Error("Cannot load without read() or XMLHttpRequest.");try{obj.contents=intArrayFromString(read_(obj.url),!0),obj.usedBytes=obj.contents.length}catch(e){throw new FS.ErrnoError(29)}},createLazyFile(parent,name,url,canRead,canWrite){function LazyUint8Array(){this.lengthKnown=!1,this.chunks=[]}if(LazyUint8Array.prototype.get=function(idx){var chunkOffset;if(!(idx>this.length-1||idx<0))return chunkOffset=idx%this.chunkSize,idx=idx/this.chunkSize|0,this.getter(idx)[chunkOffset]},LazyUint8Array.prototype.setDataGetter=function(getter){this.getter=getter},LazyUint8Array.prototype.cacheLength=function(){var xhr=new XMLHttpRequest;if(xhr.open("HEAD",url,!1),xhr.send(null),!(200<=xhr.status&&xhr.status<300||304===xhr.status))throw new Error("Couldn't load "+url+". Status: "+xhr.status);var header,datalength=Number(xhr.getResponseHeader("Content-length")),hasByteServing=(header=xhr.getResponseHeader("Accept-Ranges"))&&"bytes"===header,xhr=(header=xhr.getResponseHeader("Content-Encoding"))&&"gzip"===header,chunkSize=1048576,lazyArray=(hasByteServing||(chunkSize=datalength),this);lazyArray.setDataGetter(chunkNum=>{var start=chunkNum*chunkSize,end=(chunkNum+1)*chunkSize-1,end=Math.min(end,datalength-1);if(void 0===lazyArray.chunks[chunkNum]&&(lazyArray.chunks[chunkNum]=((from,to)=>{if(to<from)throw new Error("invalid range ("+from+", "+to+") or no bytes requested!");if(datalength-1<to)throw new Error("only "+datalength+" bytes available! programmer error!");var xhr=new XMLHttpRequest;if(xhr.open("GET",url,!1),datalength!==chunkSize&&xhr.setRequestHeader("Range","bytes="+from+"-"+to),xhr.responseType="arraybuffer",xhr.overrideMimeType&&xhr.overrideMimeType("text/plain; charset=x-user-defined"),xhr.send(null),200<=xhr.status&&xhr.status<300||304===xhr.status)return void 0!==xhr.response?new Uint8Array(xhr.response||[]):intArrayFromString(xhr.responseText||"",!0);throw new Error("Couldn't load "+url+". Status: "+xhr.status)})(start,end)),void 0===lazyArray.chunks[chunkNum])throw new Error("doXHR failed!");return lazyArray.chunks[chunkNum]}),!xhr&&datalength||(chunkSize=datalength=1,datalength=this.getter(0).length,chunkSize=datalength,out("LazyFiles on gzip forces download of the whole file when length is accessed")),this._length=datalength,this._chunkSize=chunkSize,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 lazyArray=new LazyUint8Array,lazyArray=(Object.defineProperties(lazyArray,{length:{get:function(){return this.lengthKnown||this.cacheLength(),this._length}},chunkSize:{get:function(){return this.lengthKnown||this.cacheLength(),this._chunkSize}}}),{isDevice:!1,contents:lazyArray})}else lazyArray={isDevice:!1,url:url};var node=FS.createFile(parent,name,lazyArray,canRead,canWrite),stream_ops=(lazyArray.contents?node.contents=lazyArray.contents:lazyArray.url&&(node.contents=null,node.url=lazyArray.url),Object.defineProperties(node,{usedBytes:{get:function(){return this.contents.length}}}),{});function writeChunks(stream,buffer,offset,length,position){var contents=stream.node.contents;if(position>=contents.length)return 0;var size=Math.min(contents.length-position,length);if(contents.slice)for(var i=0;i<size;i++)buffer[offset+i]=contents[position+i];else for(i=0;i<size;i++)buffer[offset+i]=contents.get(position+i);return size}return Object.keys(node.stream_ops).forEach(key=>{var fn=node.stream_ops[key];stream_ops[key]=function(){return FS.forceLoadFile(node),fn.apply(null,arguments)}}),stream_ops.read=(stream,buffer,offset,length,position)=>(FS.forceLoadFile(node),writeChunks(stream,buffer,offset,length,position)),stream_ops.mmap=(stream,length,position,prot,flags)=>{FS.forceLoadFile(node);mmapAlloc();throw new FS.ErrnoError(48)},node.stream_ops=stream_ops,node}},UTF8ToString=(ptr,maxBytesToRead)=>ptr?UTF8ArrayToString(HEAPU8,ptr,maxBytesToRead):"",SYSCALLS={DEFAULT_POLLMASK:5,calculateAt(dirfd,path,allowEmpty){if(PATH.isAbs(path))return path;if(dirfd=-100===dirfd?FS.cwd():SYSCALLS.getStreamFromFD(dirfd).path,0!=path.length)return PATH.join2(dirfd,path);if(allowEmpty)return dirfd;throw new FS.ErrnoError(44)},doStat(func,path,buf){try{var stat=func(path)}catch(e){if(e&&e.node&&PATH.normalize(path)!==PATH.normalize(FS.getPath(e.node)))return-54;throw e}HEAP32[buf>>2]=stat.dev,HEAP32[buf+4>>2]=stat.mode,HEAPU32[buf+8>>2]=stat.nlink,HEAP32[buf+12>>2]=stat.uid,HEAP32[buf+16>>2]=stat.gid,HEAP32[buf+20>>2]=stat.rdev,tempI64=[stat.size>>>0,(tempDouble=stat.size,1<=+Math.abs(tempDouble)?0<tempDouble?+Math.floor(tempDouble/4294967296)>>>0:~~+Math.ceil((tempDouble-(~~tempDouble>>>0))/4294967296)>>>0:0)],HEAP32[buf+24>>2]=tempI64[0],HEAP32[buf+28>>2]=tempI64[1],HEAP32[buf+32>>2]=4096,HEAP32[buf+36>>2]=stat.blocks;var func=stat.atime.getTime(),path=stat.mtime.getTime(),ctime=stat.ctime.getTime();return tempI64=[Math.floor(func/1e3)>>>0,(tempDouble=Math.floor(func/1e3),1<=+Math.abs(tempDouble)?0<tempDouble?+Math.floor(tempDouble/4294967296)>>>0:~~+Math.ceil((tempDouble-(~~tempDouble>>>0))/4294967296)>>>0:0)],HEAP32[buf+40>>2]=tempI64[0],HEAP32[buf+44>>2]=tempI64[1],HEAPU32[buf+48>>2]=func%1e3*1e3,tempI64=[Math.floor(path/1e3)>>>0,(tempDouble=Math.floor(path/1e3),1<=+Math.abs(tempDouble)?0<tempDouble?+Math.floor(tempDouble/4294967296)>>>0:~~+Math.ceil((tempDouble-(~~tempDouble>>>0))/4294967296)>>>0:0)],HEAP32[buf+56>>2]=tempI64[0],HEAP32[buf+60>>2]=tempI64[1],HEAPU32[buf+64>>2]=path%1e3*1e3,tempI64=[Math.floor(ctime/1e3)>>>0,(tempDouble=Math.floor(ctime/1e3),1<=+Math.abs(tempDouble)?0<tempDouble?+Math.floor(tempDouble/4294967296)>>>0:~~+Math.ceil((tempDouble-(~~tempDouble>>>0))/4294967296)>>>0:0)],HEAP32[buf+72>>2]=tempI64[0],HEAP32[buf+76>>2]=tempI64[1],HEAPU32[buf+80>>2]=ctime%1e3*1e3,tempI64=[stat.ino>>>0,(tempDouble=stat.ino,1<=+Math.abs(tempDouble)?0<tempDouble?+Math.floor(tempDouble/4294967296)>>>0:~~+Math.ceil((tempDouble-(~~tempDouble>>>0))/4294967296)>>>0:0)],HEAP32[buf+88>>2]=tempI64[0],HEAP32[buf+92>>2]=tempI64[1],0},doMsync(addr,stream,len,flags,offset){if(!FS.isFile(stream.node.mode))throw new FS.ErrnoError(43);if(2&flags)return 0;addr=HEAPU8.slice(addr,addr+len);FS.msync(stream,addr,offset,len,flags)},varargs:void 0,get(){var ret=HEAP32[+SYSCALLS.varargs>>2];return SYSCALLS.varargs+=4,ret},getp(){return SYSCALLS.get()},getStr(ptr){return UTF8ToString(ptr)},getStreamFromFD(fd){return FS.getStreamChecked(fd)}};var setErrNo=value=>HEAP32[___errno_location()>>2]=value;var PIPEFS={BUCKET_BUFFER_SIZE:8192,mount(mount){return FS.createNode(null,"/",16895,0)},createPipe(){var pipe={buckets:[],refcnt:2},rName=(pipe.buckets.push({buffer:new Uint8Array(PIPEFS.BUCKET_BUFFER_SIZE),offset:0,roffset:0}),PIPEFS.nextname()),wName=PIPEFS.nextname(),rNode=FS.createNode(PIPEFS.root,rName,4096,0),wNode=FS.createNode(PIPEFS.root,wName,4096,0),pipe=(rNode.pipe=pipe,wNode.pipe=pipe,FS.createStream({path:rName,node:rNode,flags:0,seekable:!1,stream_ops:PIPEFS.stream_ops})),rName=(rNode.stream=pipe,FS.createStream({path:wName,node:wNode,flags:1,seekable:!1,stream_ops:PIPEFS.stream_ops}));return wNode.stream=rName,{readable_fd:pipe.fd,writable_fd:rName.fd}},stream_ops:{poll(stream){var pipe=stream.node.pipe;if(1==(2097155&stream.flags))return 260;if(0<pipe.buckets.length)for(var i=0;i<pipe.buckets.length;i++){var bucket=pipe.buckets[i];if(0<bucket.offset-bucket.roffset)return 65}return 0},ioctl(stream,request,varargs){return 28},fsync(stream){return 28},read(stream,buffer,offset,length,position){for(var pipe=stream.node.pipe,currentLength=0,i=0;i<pipe.buckets.length;i++){var bucket=pipe.buckets[i];currentLength+=bucket.offset-bucket.roffset}var data=buffer.subarray(offset,offset+length);if(length<=0)return 0;if(0==currentLength)throw new FS.ErrnoError(6);for(var toRead=Math.min(currentLength,length),stream=toRead,toRemove=0,i=0;i<pipe.buckets.length;i++){var currBucket=pipe.buckets[i],bucketSize=currBucket.offset-currBucket.roffset;if(toRead<=bucketSize){var tmpSlice=currBucket.buffer.subarray(currBucket.roffset,currBucket.offset);toRead<bucketSize?(tmpSlice=tmpSlice.subarray(0,toRead),currBucket.roffset+=toRead):toRemove++,data.set(tmpSlice);break}tmpSlice=currBucket.buffer.subarray(currBucket.roffset,currBucket.offset);data.set(tmpSlice),data=data.subarray(tmpSlice.byteLength),toRead-=tmpSlice.byteLength,toRemove++}return toRemove&&toRemove==pipe.buckets.length&&(pipe.buckets[--toRemove].offset=0,pipe.buckets[toRemove].roffset=0),pipe.buckets.splice(0,toRemove),stream},write(stream,buffer,offset,length,position){var pipe=stream.node.pipe,data=buffer.subarray(offset,offset+length),stream=data.byteLength;if(stream<=0)return 0;buffer=null,0==pipe.buckets.length?(buffer={buffer:new Uint8Array(PIPEFS.BUCKET_BUFFER_SIZE),offset:0,roffset:0},pipe.buckets.push(buffer)):buffer=pipe.buckets[pipe.buckets.length-1],assert(buffer.offset<=PIPEFS.BUCKET_BUFFER_SIZE),offset=PIPEFS.BUCKET_BUFFER_SIZE-buffer.offset;if(stream<=offset)buffer.buffer.set(data,buffer.offset),buffer.offset+=stream;else{0<offset&&(buffer.buffer.set(data.subarray(0,offset),buffer.offset),buffer.offset+=offset,data=data.subarray(offset,data.byteLength));for(var numBuckets=data.byteLength/PIPEFS.BUCKET_BUFFER_SIZE|0,length=data.byteLength%PIPEFS.BUCKET_BUFFER_SIZE,i=0;i<numBuckets;i++){var newBucket={buffer:new Uint8Array(PIPEFS.BUCKET_BUFFER_SIZE),offset:PIPEFS.BUCKET_BUFFER_SIZE,roffset:0};pipe.buckets.push(newBucket),newBucket.buffer.set(data.subarray(0,PIPEFS.BUCKET_BUFFER_SIZE)),data=data.subarray(PIPEFS.BUCKET_BUFFER_SIZE,data.byteLength)}0<length&&(newBucket={buffer:new Uint8Array(PIPEFS.BUCKET_BUFFER_SIZE),offset:data.byteLength,roffset:0},pipe.buckets.push(newBucket),newBucket.buffer.set(data))}return stream},close(stream){stream=stream.node.pipe;stream.refcnt--,0===stream.refcnt&&(stream.buckets=null)}},nextname(){return PIPEFS.nextname.current||(PIPEFS.nextname.current=0),"pipe["+PIPEFS.nextname.current+++"]"}};var convertI32PairToI53Checked=(lo,hi)=>hi+2097152>>>0<4194305-!!lo?(lo>>>0)+4294967296*hi:NaN;var isLeapYear=year=>year%4==0&&(year%100!=0||year%400==0),MONTH_DAYS_LEAP_CUMULATIVE=[0,31,60,91,121,152,182,213,244,274,305,335],MONTH_DAYS_REGULAR_CUMULATIVE=[0,31,59,90,120,151,181,212,243,273,304,334],ydayFromDate=date=>{return(isLeapYear(date.getFullYear())?MONTH_DAYS_LEAP_CUMULATIVE:MONTH_DAYS_REGULAR_CUMULATIVE)[date.getMonth()]+date.getDate()-1};var stringToUTF8=(str,outPtr,maxBytesToWrite)=>stringToUTF8Array(str,HEAPU8,outPtr,maxBytesToWrite),stringToNewUTF8=str=>{var size=lengthBytesUTF8(str)+1,ret=_malloc(size);return ret&&stringToUTF8(str,ret,size),ret},ENV={},getExecutableName=()=>thisProgram||"./this.program",getEnvStrings=()=>{if(!getEnvStrings.strings){var env={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:("object"==typeof navigator&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",_:getExecutableName()};for(x in ENV)void 0===ENV[x]?delete env[x]:env[x]=ENV[x];var x,strings=[];for(x in env)strings.push("".concat(x,"=").concat(env[x]));getEnvStrings.strings=strings}return getEnvStrings.strings},keepRuntimeAlive=()=>noExitRuntime||!1,moduleOverrides=(status,implicit)=>{var _Module$onExit;status=status,keepRuntimeAlive()||(null!=(_Module$onExit=Module.onExit)&&_Module$onExit.call(Module,status),ABORT=!0),quit_(status,new ExitStatus(status))};function FSNode(parent,name,mode,rdev){this.parent=parent=parent||this,this.mount=parent.mount,this.mounted=null,this.id=FS.nextInode++,this.name=name,this.mode=mode,this.node_ops={},this.stream_ops={},this.rdev=rdev}var calledRun,MONTH_DAYS_LEAP=[31,29,31,30,31,30,31,31,30,31,30,31],MONTH_DAYS_REGULAR=[31,28,31,30,31,30,31,31,30,31,30,31],writeArrayToMemory=(array,buffer)=>{HEAP8.set(array,buffer)},getCFunc=ident=>{return Module["_"+ident]},stringToUTF8OnStack=str=>{var size=lengthBytesUTF8(str)+1,ret=stackAlloc(size);return stringToUTF8(str,ret,size),ret},ccall=(ident,returnType,argTypes,args,opts)=>{var toC={string:str=>{var ret=0;return ret=null!=str&&0!==str?stringToUTF8OnStack(str):ret},array:arr=>{var ret=stackAlloc(arr.length);return writeArrayToMemory(arr,ret),ret}};var ident=getCFunc(ident),cArgs=[],stack=0;if(args)for(var i=0;i<args.length;i++){var converter=toC[argTypes[i]];converter?(0===stack&&(stack=stackSave()),cArgs[i]=converter(args[i])):cArgs[i]=args[i]}return function(ret){return 0!==stack&&stackRestore(stack),function(ret){return"string"===returnType?UTF8ToString(ret):"boolean"===returnType?Boolean(ret):ret}(ret)}(ident.apply(null,cArgs))},wasmImports=(Object.defineProperties(FSNode.prototype,{read:{get:function(){return 365==(365&this.mode)},set:function(val){val?this.mode|=365:this.mode&=-366}},write:{get:function(){return 146==(146&this.mode)},set:function(val){val?this.mode|=146:this.mode&=-147}},isFolder:{get:function(){return FS.isDir(this.mode)}},isDevice:{get:function(){return FS.isChrdev(this.mode)}}}),FS.FSNode=FSNode,FS.createPreloadedFile=(parent,name,url,canRead,canWrite,onload,onerror,dontCreateFile,canOwn,preFinish)=>{var fullname=name?PATH_FS.resolve(PATH.join2(parent,name)):parent;function processData(byteArray){function finish(byteArray){null!=preFinish&&preFinish(),dontCreateFile||((parent,name,fileData,canRead,canWrite,canOwn)=>{FS.createDataFile(parent,name,fileData,canRead,canWrite,canOwn)})(parent,name,byteArray,canRead,canWrite,canOwn),null!=onload&&onload(),removeRunDependency()}((byteArray,fullname,finish,onerror)=>{"undefined"!=typeof Browser&&Browser.init();var handled=!1;return preloadPlugins.forEach(plugin=>{handled||plugin.canHandle(fullname)&&(plugin.handle(byteArray,fullname,finish,onerror),handled=!0)}),handled})(byteArray,fullname,finish,()=>{null!=onerror&&onerror(),removeRunDependency()})||finish(byteArray)}addRunDependency(),"string"==typeof url?((url,onload,onerror,noRunDep)=>{var dep=noRunDep?"":"al ".concat(url);readAsync(url,arrayBuffer=>{assert(arrayBuffer,'Loading data file "'.concat(url,'" failed (no arrayBuffer).')),onload(new Uint8Array(arrayBuffer)),dep&&removeRunDependency()},event=>{if(!onerror)throw'Loading data file "'.concat(url,'" failed.');onerror()}),dep&&addRunDependency()})(url,byteArray=>processData(byteArray),onerror):processData(url)},FS.staticInit(),{i:function(fd){try{var old=SYSCALLS.getStreamFromFD(fd);return FS.createStream(old).fd}catch(e){if(void 0===FS||"ErrnoError"!==e.name)throw e;return-e.errno}},a:function(fd,cmd,varargs){SYSCALLS.varargs=varargs;try{var stream=SYSCALLS.getStreamFromFD(fd);switch(cmd){case 0:if((arg=SYSCALLS.get())<0)return-28;for(;FS.streams[arg];)arg++;return FS.createStream(stream,arg).fd;case 1:case 2:return 0;case 3:return stream.flags;case 4:var arg=SYSCALLS.get();return stream.flags|=arg,0;case 5:arg=SYSCALLS.getp();return HEAP16[arg+0>>1]=2,0;case 6:case 7:return 0;case 16:case 8:return-28;case 9:return setErrNo(28),-1;default:return-28}}catch(e){if(void 0===FS||"ErrnoError"!==e.name)throw e;return-e.errno}},x:function(fd,buf){try{var stream=SYSCALLS.getStreamFromFD(fd);return SYSCALLS.doStat(FS.stat,stream.path,buf)}catch(e){if(void 0===FS||"ErrnoError"!==e.name)throw e;return-e.errno}},u:function(path,buf){try{return path=SYSCALLS.getStr(path),SYSCALLS.doStat(FS.lstat,path,buf)}catch(e){if(void 0===FS||"ErrnoError"!==e.name)throw e;return-e.errno}},v:function(dirfd,path,buf,flags){try{path=SYSCALLS.getStr(path);var nofollow=256&flags,allowEmpty=4096&flags;return flags&=-6401,path=SYSCALLS.calculateAt(dirfd,path,allowEmpty),SYSCALLS.doStat(nofollow?FS.lstat:FS.stat,path,buf)}catch(e){if(void 0===FS||"ErrnoError"!==e.name)throw e;return-e.errno}},y:function(dirfd,path,flags,varargs){SYSCALLS.varargs=varargs;try{path=SYSCALLS.getStr(path),path=SYSCALLS.calculateAt(dirfd,path);var mode=varargs?SYSCALLS.get():0;return FS.open(path,flags,mode).fd}catch(e){if(void 0===FS||"ErrnoError"!==e.name)throw e;return-e.errno}},t:function(fdPtr){try{if(0==fdPtr)throw new FS.ErrnoError(21);var res=PIPEFS.createPipe();return HEAP32[fdPtr>>2]=res.readable_fd,HEAP32[fdPtr+4>>2]=res.writable_fd,0}catch(e){if(void 0===FS||"ErrnoError"!==e.name)throw e;return-e.errno}},s:function(fds,nfds,timeout){try{for(var nonzero=0,i=0;i<nfds;i++){var pollfd=fds+8*i,fd=HEAP32[pollfd>>2],events=HEAP16[pollfd+4>>1],mask=32,stream=FS.getStream(fd);stream&&(mask=SYSCALLS.DEFAULT_POLLMASK,stream.stream_ops.poll)&&(mask=stream.stream_ops.poll(stream,-1)),(mask&=24|events)&&nonzero++,HEAP16[pollfd+6>>1]=mask}return nonzero}catch(e){if(void 0===FS||"ErrnoError"!==e.name)throw e;return-e.errno}},w:function(path,buf){try{return path=SYSCALLS.getStr(path),SYSCALLS.doStat(FS.stat,path,buf)}catch(e){if(void 0===FS||"ErrnoError"!==e.name)throw e;return-e.errno}},q:function(dirfd,path,flags){try{return path=SYSCALLS.getStr(path),path=SYSCALLS.calculateAt(dirfd,path),0===flags?FS.unlink(path):512===flags?FS.rmdir(path):abort("Invalid flags passed to unlinkat"),0}catch(e){if(void 0===FS||"ErrnoError"!==e.name)throw e;return-e.errno}},B:()=>1,k:function(time_low,time_high,tmPtr){time_low=convertI32PairToI53Checked(time_low,time_high),time_high=new Date(1e3*time_low),HEAP32[tmPtr>>2]=time_high.getUTCSeconds(),HEAP32[tmPtr+4>>2]=time_high.getUTCMinutes(),HEAP32[tmPtr+8>>2]=time_high.getUTCHours(),HEAP32[tmPtr+12>>2]=time_high.getUTCDate(),HEAP32[tmPtr+16>>2]=time_high.getUTCMonth(),HEAP32[tmPtr+20>>2]=time_high.getUTCFullYear()-1900,HEAP32[tmPtr+24>>2]=time_high.getUTCDay(),time_low=Date.UTC(time_high.getUTCFullYear(),0,1,0,0,0,0),time_high=(time_high.getTime()-time_low)/864e5|0,HEAP32[tmPtr+28>>2]=time_high},l:function(time_low,time_high,tmPtr){var time_low=convertI32PairToI53Checked(time_low,time_high),time_high=new Date(1e3*time_low),time_low=(HEAP32[tmPtr>>2]=time_high.getSeconds(),HEAP32[tmPtr+4>>2]=time_high.getMinutes(),HEAP32[tmPtr+8>>2]=time_high.getHours(),HEAP32[tmPtr+12>>2]=time_high.getDate(),HEAP32[tmPtr+16>>2]=time_high.getMonth(),HEAP32[tmPtr+20>>2]=time_high.getFullYear()-1900,HEAP32[tmPtr+24>>2]=time_high.getDay(),0|ydayFromDate(time_high)),time_low=(HEAP32[tmPtr+28>>2]=time_low,HEAP32[tmPtr+36>>2]=-60*time_high.getTimezoneOffset(),new Date(time_high.getFullYear(),0,1)),summerOffset=new Date(time_high.getFullYear(),6,1).getTimezoneOffset(),time_low=time_low.getTimezoneOffset(),time_high=0|(summerOffset!=time_low&&time_high.getTimezoneOffset()==Math.min(time_low,summerOffset));HEAP32[tmPtr+32>>2]=time_high},m:function(tmPtr){date=new Date(HEAP32[tmPtr+20>>2]+1900,HEAP32[tmPtr+16>>2],HEAP32[tmPtr+12>>2],HEAP32[tmPtr+8>>2],HEAP32[tmPtr+4>>2],HEAP32[tmPtr>>2],0),dst=HEAP32[tmPtr+32>>2],guessedOffset=date.getTimezoneOffset(),start=new Date(date.getFullYear(),0,1),summerOffset=new Date(date.getFullYear(),6,1).getTimezoneOffset(),start=start.getTimezoneOffset(),dstOffset=Math.min(start,summerOffset),dst<0?HEAP32[tmPtr+32>>2]=Number(summerOffset!=start&&dstOffset==guessedOffset):0<dst!=(dstOffset==guessedOffset)&&(start=Math.max(start,summerOffset),summerOffset=0<dst?dstOffset:start,date.setTime(date.getTime()+6e4*(summerOffset-guessedOffset))),HEAP32[tmPtr+24>>2]=date.getDay(),dst=0|ydayFromDate(date),HEAP32[tmPtr+28>>2]=dst,HEAP32[tmPtr>>2]=date.getSeconds(),HEAP32[tmPtr+4>>2]=date.getMinutes(),HEAP32[tmPtr+8>>2]=date.getHours(),HEAP32[tmPtr+12>>2]=date.getDate(),HEAP32[tmPtr+16>>2]=date.getMonth(),HEAP32[tmPtr+20>>2]=date.getYear(),dstOffset=date.getTime();var date,dst,guessedOffset,summerOffset,dstOffset,start=isNaN(dstOffset)?(setErrNo(61),-1):dstOffset/1e3;return setTempRet0((tempDouble=start,1<=+Math.abs(tempDouble)?0<tempDouble?+Math.floor(tempDouble/4294967296)>>>0:~~+Math.ceil((tempDouble-(~~tempDouble>>>0))/4294967296)>>>0:0)),start>>>0},n:function(tmPtr){time=Date.UTC(HEAP32[tmPtr+20>>2]+1900,HEAP32[tmPtr+16>>2],HEAP32[tmPtr+12>>2],HEAP32[tmPtr+8>>2],HEAP32[tmPtr+4>>2],HEAP32[tmPtr>>2],0),time=new Date(time),HEAP32[tmPtr+24>>2]=time.getUTCDay(),start=Date.UTC(time.getUTCFullYear(),0,1,0,0,0,0),start=(time.getTime()-start)/864e5|0,HEAP32[tmPtr+28>>2]=start;var time,start,tmPtr=time.getTime()/1e3;return setTempRet0((tempDouble=tmPtr,1<=+Math.abs(tempDouble)?0<tempDouble?+Math.floor(tempDouble/4294967296)>>>0:~~+Math.ceil((tempDouble-(~~tempDouble>>>0))/4294967296)>>>0:0)),tmPtr>>>0},r:(timezone,daylight,tzname)=>{var currentYear=(new Date).getFullYear(),winter=new Date(currentYear,0,1),currentYear=new Date(currentYear,6,1),winterOffset=winter.getTimezoneOffset(),summerOffset=currentYear.getTimezoneOffset(),stdTimezoneOffset=Math.max(winterOffset,summerOffset);function extractZone(date){date=date.toTimeString().match(/\(([A-Za-z ]+)\)$/);return date?date[1]:"GMT"}HEAPU32[timezone>>2]=60*stdTimezoneOffset,HEAP32[daylight>>2]=Number(winterOffset!=summerOffset);timezone=extractZone(winter),stdTimezoneOffset=extractZone(currentYear),daylight=stringToNewUTF8(timezone),winter=stringToNewUTF8(stdTimezoneOffset);summerOffset<winterOffset?(HEAPU32[tzname>>2]=daylight,HEAPU32[tzname+4>>2]=winter):(HEAPU32[tzname>>2]=winter,HEAPU32[tzname+4>>2]=daylight)},b:()=>{abort("")},c:()=>Date.now(),h:(dest,src,num)=>HEAPU8.copyWithin(dest,src,src+num),p:requestedSize=>{var oldSize=HEAPU8.length;requestedSize>>>=0;if(!(2147483648<requestedSize))for(var multiple,cutDown=1;cutDown<=4;cutDown*=2){var overGrownHeapSize=oldSize*(1+.2/cutDown),overGrownHeapSize=Math.min(overGrownHeapSize,requestedSize+100663296);if((size=>{size=(size-wasmMemory.buffer.byteLength+65535)/65536;try{return wasmMemory.grow(size),updateMemoryViews(),1}catch(e){}})(Math.min(2147483648,(overGrownHeapSize=Math.max(requestedSize,overGrownHeapSize))+((multiple=65536)-overGrownHeapSize%multiple)%multiple)))return!0}return!1},z:(__environ,environ_buf)=>{var bufSize=0;return getEnvStrings().forEach((string,i)=>{var ptr=environ_buf+bufSize;((str,buffer)=>{for(var i=0;i<str.length;++i)HEAP8[buffer++>>0]=str.charCodeAt(i);HEAP8[buffer>>0]=0})(string,HEAPU32[__environ+4*i>>2]=ptr),bufSize+=string.length+1}),0},A:(penviron_count,penviron_buf_size)=>{var strings=getEnvStrings(),bufSize=(HEAPU32[penviron_count>>2]=strings.length,0);return strings.forEach(string=>bufSize+=string.length+1),HEAPU32[penviron_buf_size>>2]=bufSize,0},g:moduleOverrides,e:function(fd){try{var stream=SYSCALLS.getStreamFromFD(fd);return FS.close(stream),0}catch(e){if(void 0===FS||"ErrnoError"!==e.name)throw e;return e.errno}},j:function(fd,iov,iovcnt,pnum){try{var num=((stream,iov,iovcnt,offset)=>{for(var ret=0,i=0;i<iovcnt;i++){var ptr=HEAPU32[iov>>2],len=HEAPU32[iov+4>>2],ptr=(iov+=8,FS.read(stream,HEAP8,ptr,len,offset));if(ptr<0)return-1;if(ret+=ptr,ptr<len)break;void 0!==offset&&(offset+=ptr)}return ret})(SYSCALLS.getStreamFromFD(fd),iov,iovcnt);return HEAPU32[pnum>>2]=num,0}catch(e){if(void 0===FS||"ErrnoError"!==e.name)throw e;return e.errno}},o:function(fd,offset_low,offset_high,whence,newOffset){var stream,offset_low=convertI32PairToI53Checked(offset_low,offset_high);try{return isNaN(offset_low)?61:(stream=SYSCALLS.getStreamFromFD(fd),FS.llseek(stream,offset_low,whence),tempI64=[stream.position>>>0,(tempDouble=stream.position,1<=+Math.abs(tempDouble)?0<tempDouble?+Math.floor(tempDouble/4294967296)>>>0:~~+Math.ceil((tempDouble-(~~tempDouble>>>0))/4294967296)>>>0:0)],HEAP32[newOffset>>2]=tempI64[0],HEAP32[newOffset+4>>2]=tempI64[1],stream.getdents&&0===offset_low&&0===whence&&(stream.getdents=null),0)}catch(e){if(void 0===FS||"ErrnoError"!==e.name)throw e;return e.errno}},d:function(fd,iov,iovcnt,pnum){try{var num=((stream,iov,iovcnt,offset)=>{for(var ret=0,i=0;i<iovcnt;i++){var ptr=HEAPU32[iov>>2],len=HEAPU32[iov+4>>2],ptr=(iov+=8,FS.write(stream,HEAP8,ptr,len,offset));if(ptr<0)return-1;ret+=ptr,void 0!==offset&&(offset+=ptr)}return ret})(SYSCALLS.getStreamFromFD(fd),iov,iovcnt);return HEAPU32[pnum>>2]=num,0}catch(e){if(void 0===FS||"ErrnoError"!==e.name)throw e;return e.errno}},f:(s,maxsize,format,tm)=>{var tm_zone=HEAPU32[tm+40>>2],date={tm_sec:HEAP32[tm>>2],tm_min:HEAP32[tm+4>>2],tm_hour:HEAP32[tm+8>>2],tm_mday:HEAP32[tm+12>>2],tm_mon:HEAP32[tm+16>>2],tm_year:HEAP32[tm+20>>2],tm_wday:HEAP32[tm+24>>2],tm_yday:HEAP32[tm+28>>2],tm_isdst:HEAP32[tm+32>>2],tm_gmtoff:HEAP32[tm+36>>2],tm_zone:tm_zone?UTF8ToString(tm_zone):""},pattern=UTF8ToString(format),EXPANSION_RULES_1={"%c":"%a %b %d %H:%M:%S %Y","%D":"%m/%d/%y","%F":"%Y-%m-%d","%h":"%b","%r":"%I:%M:%S %p","%R":"%H:%M","%T":"%H:%M:%S","%x":"%m/%d/%y","%X":"%H:%M:%S","%Ec":"%c","%EC":"%C","%Ex":"%m/%d/%y","%EX":"%H:%M:%S","%Ey":"%y","%EY":"%Y","%Od":"%d","%Oe":"%e","%OH":"%H","%OI":"%I","%Om":"%m","%OM":"%M","%OS":"%S","%Ou":"%u","%OU":"%U","%OV":"%V","%Ow":"%w","%OW":"%W","%Oy":"%y"};for(rule in EXPANSION_RULES_1)pattern=pattern.replace(new RegExp(rule,"g"),EXPANSION_RULES_1[rule]);var WEEKDAYS=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],MONTHS=["January","February","March","April","May","June","July","August","September","October","November","December"];function leadingSomething(value,digits,character){for(var str="number"==typeof value?value.toString():value||"";str.length<digits;)str=character[0]+str;return str}function leadingNulls(value,digits){return leadingSomething(value,digits,"0")}function compareByDay(date1,date2){function sgn(value){return value<0?-1:0<value?1:0}var compare;return compare=0===(compare=sgn(date1.getFullYear()-date2.getFullYear()))&&0===(compare=sgn(date1.getMonth()-date2.getMonth()))?sgn(date1.getDate()-date2.getDate()):compare}function getFirstWeekStartDate(janFourth){switch(janFourth.getDay()){case 0:return new Date(janFourth.getFullYear()-1,11,29);case 1:return janFourth;case 2:return new Date(janFourth.getFullYear(),0,3);case 3:return new Date(janFourth.getFullYear(),0,2);case 4:return new Date(janFourth.getFullYear(),0,1);case 5:return new Date(janFourth.getFullYear()-1,11,31);case 6:return new Date(janFourth.getFullYear()-1,11,30)}}function getWeekBasedYear(date){var date=((date,days)=>{for(var newDate=new Date(date.getTime());0<days;){var leap=isLeapYear(newDate.getFullYear()),currentMonth=newDate.getMonth(),leap=(leap?MONTH_DAYS_LEAP:MONTH_DAYS_REGULAR)[currentMonth];if(!(days>leap-newDate.getDate()))return newDate.setDate(newDate.getDate()+days),newDate;days-=leap-newDate.getDate()+1,newDate.setDate(1),currentMonth<11?newDate.setMonth(currentMonth+1):(newDate.setMonth(0),newDate.setFullYear(newDate.getFullYear()+1))}return newDate})(new Date(date.tm_year+1900,0,1),date.tm_yday),janFourthThisYear=new Date(date.getFullYear(),0,4),janFourthNextYear=new Date(date.getFullYear()+1,0,4),janFourthThisYear=getFirstWeekStartDate(janFourthThisYear),janFourthNextYear=getFirstWeekStartDate(janFourthNextYear);return compareByDay(janFourthThisYear,date)<=0?compareByDay(janFourthNextYear,date)<=0?date.getFullYear()+1:date.getFullYear():date.getFullYear()-1}var rule,EXPANSION_RULES_2={"%a":date=>WEEKDAYS[date.tm_wday].substring(0,3),"%A":date=>WEEKDAYS[date.tm_wday],"%b":date=>MONTHS[date.tm_mon].substring(0,3),"%B":date=>MONTHS[date.tm_mon],"%C":date=>{return leadingNulls((date.tm_year+1900)/100|0,2)},"%d":date=>leadingNulls(date.tm_mday,2),"%e":date=>leadingSomething(date.tm_mday,2," "),"%g":date=>getWeekBasedYear(date).toString().substring(2),"%G":date=>getWeekBasedYear(date),"%H":date=>leadingNulls(date.tm_hour,2),"%I":date=>{date=date.tm_hour;return 0==date?date=12:12<date&&(date-=12),leadingNulls(date,2)},"%j":date=>leadingNulls(date.tm_mday+((array,index)=>{for(var sum=0,i=0;i<=index;sum+=array[i++]);return sum})(isLeapYear(date.tm_year+1900)?MONTH_DAYS_LEAP:MONTH_DAYS_REGULAR,date.tm_mon-1),3),"%m":date=>leadingNulls(date.tm_mon+1,2),"%M":date=>leadingNulls(date.tm_min,2),"%n":()=>"\n","%p":date=>0<=date.tm_hour&&date.tm_hour<12?"AM":"PM","%S":date=>leadingNulls(date.tm_sec,2),"%t":()=>"\t","%u":date=>date.tm_wday||7,"%U":date=>{date=date.tm_yday+7-date.tm_wday;return leadingNulls(Math.floor(date/7),2)},"%V":date=>{var jan1,val=Math.floor((date.tm_yday+7-(date.tm_wday+6)%7)/7);return(date.tm_wday+371-date.tm_yday-2)%7<=2&&val++,val?53!=val||4==(jan1=(date.tm_wday+371-date.tm_yday)%7)||3==jan1&&isLeapYear(date.tm_year)||(val=1):(val=52,(4==(jan1=(date.tm_wday+7-date.tm_yday-1)%7)||5==jan1&&isLeapYear(date.tm_year%400-1))&&val++),leadingNulls(val,2)},"%w":date=>date.tm_wday,"%W":date=>{date=date.tm_yday+7-(date.tm_wday+6)%7;return leadingNulls(Math.floor(date/7),2)},"%y":date=>(date.tm_year+1900).toString().substring(2),"%Y":date=>date.tm_year+1900,"%z":date=>{var ahead=0<=(date=date.tm_gmtoff),date=Math.abs(date)/60;return(ahead?"+":"-")+String("0000"+(date/60*100+date%60)).slice(-4)},"%Z":date=>date.tm_zone,"%%":()=>"%"},pattern=pattern.replace(/%%/g,"\0\0");for(rule in EXPANSION_RULES_2)pattern.includes(rule)&&(pattern=pattern.replace(new RegExp(rule,"g"),EXPANSION_RULES_2[rule](date)));tm=intArrayFromString(pattern=pattern.replace(/\0\0/g,"%"),!1);return tm.length>maxsize?0:(writeArrayToMemory(tm,s),tm.length-1)}}),wasmExports=function(){var binaryFile,imports,callback,info={a:wasmImports};function receiveInstance(instance,module){return wasmExports=instance.exports,wasmMemory=wasmExports.C,updateMemoryViews(),instance=wasmExports.D,__ATINIT__.unshift(instance),removeRunDependency(),wasmExports}if(addRunDependency(),Module.instantiateWasm)try{return Module.instantiateWasm(info,receiveInstance)}catch(e){err("Module.instantiateWasm callback failed with error: ".concat(e)),readyPromiseReject(e)}return binaryFile=wasmBinaryFile,imports=info,callback=function(result){receiveInstance(result.instance)},(wasmBinary||"function"!=typeof WebAssembly.instantiateStreaming||isDataURI(binaryFile)||isFileURI(binaryFile)||ENVIRONMENT_IS_NODE||"function"!=typeof fetch?instantiateArrayBuffer(binaryFile,imports,callback):fetch(binaryFile,{credentials:"same-origin"}).then(response=>{return WebAssembly.instantiateStreaming(response,imports).then(callback,function(reason){return err("wasm streaming compile failed: ".concat(reason)),err("falling back to ArrayBuffer instantiation"),instantiateArrayBuffer(binaryFile,imports,callback)})})).catch(readyPromiseReject),{}}(),_malloc=(Module._get_version=()=>(Module._get_version=wasmExports.E)(),Module._archive_open=(a0,a1,a2,a3)=>(Module._archive_open=wasmExports.F)(a0,a1,a2,a3),Module._archive_read_add_passphrase=(a0,a1)=>(Module._archive_read_add_passphrase=wasmExports.G)(a0,a1),Module._archive_error_string=a0=>(Module._archive_error_string=wasmExports.H)(a0),Module._get_next_entry=a0=>(Module._get_next_entry=wasmExports.I)(a0),Module._get_filedata=(a0,a1)=>(Module._get_filedata=wasmExports.J)(a0,a1),Module._malloc=a0=>(_malloc=Module._malloc=wasmExports.K)(a0)),___errno_location=(Module._archive_close=a0=>(Module._archive_close=wasmExports.L)(a0),Module._start_archive_write=(a0,a1,a2,a3,a4,a5)=>(Module._start_archive_write=wasmExports.M)(a0,a1,a2,a3,a4,a5),Module._write_archive_file=(a0,a1,a2,a3)=>(Module._write_archive_file=wasmExports.N)(a0,a1,a2,a3),Module._size_of_size_t=()=>(Module._size_of_size_t=wasmExports.O)(),Module._finish_archive_write=(a0,a1)=>(Module._finish_archive_write=wasmExports.P)(a0,a1),Module._free=a0=>(Module._free=wasmExports.Q)(a0),()=>(___errno_location=wasmExports.R)()),setTempRet0=(Module._archive_entry_birthtime_nsec=a0=>(Module._archive_entry_birthtime_nsec=wasmExports.S)(a0),Module._archive_entry_filetype=a0=>(Module._archive_entry_filetype=wasmExports.T)(a0),Module._archive_entry_mtime_nsec=a0=>(Module._archive_entry_mtime_nsec=wasmExports.U)(a0),Module._archive_entry_pathname=a0=>(Module._archive_entry_pathname=wasmExports.V)(a0),Module._archive_entry_pathname_utf8=a0=>(Module._archive_entry_pathname_utf8=wasmExports.W)(a0),Module._archive_entry_size=a0=>(Module._archive_entry_size=wasmExports.X)(a0),Module._archive_entry_is_encrypted=a0=>(Module._archive_entry_is_encrypted=wasmExports.Y)(a0),Module._archive_read_has_encrypted_entries=a0=>(Module._archive_read_has_encrypted_entries=wasmExports.Z)(a0),Module._archive_read_data_skip=a0=>(Module._archive_read_data_skip=wasmExports._)(a0),a0=>(setTempRet0=wasmExports.aa)(a0)),stackSave=()=>(stackSave=wasmExports.ba)(),stackRestore=a0=>(stackRestore=wasmExports.ca)(a0),stackAlloc=a0=>(stackAlloc=wasmExports.da)(a0);function run(){function doRun(){calledRun||(calledRun=!0,Module.calledRun=!0,ABORT)||(Module.noFSInit||FS.init.initialized||FS.init(),FS.ignorePermissions=!1,PIPEFS.root=FS.mount(PIPEFS,{},null),callRuntimeCallbacks(__ATINIT__),readyPromiseResolve(Module),Module.onRuntimeInitialized&&Module.onRuntimeInitialized(),postRun())}0<runDependencies||(preRun(),0<runDependencies)||(Module.setStatus?(Module.setStatus("Running..."),setTimeout(function(){setTimeout(function(){Module.setStatus("")},1),doRun()},1)):doRun())}if(Module.cwrap=(ident,returnType,argTypes,opts)=>{var numericArgs=!argTypes||argTypes.every(type=>"number"===type||"boolean"===type);return"string"!==returnType&&numericArgs&&!opts?getCFunc(ident):function(){return ccall(ident,returnType,argTypes,arguments)}},Module.allocate=(slab,allocator)=>{allocator=(1==allocator?stackAlloc:_malloc)(slab.length);return slab.subarray||slab.slice||(slab=new Uint8Array(slab)),HEAPU8.set(slab,allocator),allocator},dependenciesFulfilled=function runCaller(){calledRun||run(),calledRun||(dependenciesFulfilled=runCaller)},Module.preInit)for("function"==typeof Module.preInit&&(Module.preInit=[Module.preInit]);0<Module.preInit.length;)Module.preInit.pop()();return run(),moduleArg.ready}})();class WasmModule{constructor(){this.preRun=[],this.postRun=[],this.totalDependencies=0}print(){for(var _len=arguments.length,text=new Array(_len),_key=0;_key<_len;_key++)text[_key]=arguments[_key];console.log(text)}printErr(){for(var _len2=arguments.length,text=new Array(_len2),_key2=0;_key2<_len2;_key2++)text[_key2]=arguments[_key2];console.error(text)}initFunctions(){this.runCode={getVersion:this.cwrap("get_version","string",[]),openArchive:this.cwrap("archive_open","number",["number","number","string","string"]),getNextEntry:this.cwrap("get_next_entry","number",["number"]),getFileData:this.cwrap("get_filedata","number",["number","number"]),skipEntry:this.cwrap("archive_read_data_skip","number",["number"]),closeArchive:this.cwrap("archive_close",null,["number"]),getEntrySize:this.cwrap("archive_entry_size","number",["number"]),getEntryName:this.cwrap("archive_entry_pathname","string",["number"]),getEntryType:this.cwrap("archive_entry_filetype","number",["number"]),getEntryLastModified:this.cwrap("archive_entry_mtime_nsec","number",["number"]),getError:this.cwrap("archive_error_string","string",["number"]),startArchiveWrite:this.cwrap("start_archive_write","number",["string","string","number","number","number","string"]),writeArchiveFile:this.cwrap("write_archive_file",null,["number","string","number","number"]),finishArchiveWrite:this.cwrap("finish_archive_write","number",["number","number"]),entryIsEncrypted:this.cwrap("archive_entry_is_encrypted","number",["number"]),hasEncryptedEntries:this.cwrap("archive_read_has_encrypted_entries","number",["number"]),addPassphrase:this.cwrap("archive_read_add_passphrase","number",["number","string"]),string:str=>this.allocate(this.intArrayFromString(str),"i8",0),malloc:this.cwrap("malloc","number",["number"]),free:this.cwrap("free",null,["number"]),sizeOfSizeT:this.cwrap("size_of_size_t","number",[])}}monitorRunDependencies(){}}function getWasmModule(cb){libarchive(new WasmModule).then(module=>{module.initFunctions(),cb(module)})}var reader=null,writer=null,ready=!1;class LibArchiveWorker{constructor(readyCallback){LibArchiveWorker.readyCallback=readyCallback,ready&&setTimeout(()=>readyCallback(),0)}open(file,cb){reader.open(file).then(()=>cb())}listFiles(){var entry,arr=[];for(entry of reader.entries(!0))arr.push(entry);return arr}extractFiles(){var entry,arr=[];for(entry of reader.entries(!1))arr.push(entry);return arr}extractSingleFile(target){for(var entry of reader.entries(!0,target))if(entry.fileData)return entry}hasEncryptedData(){return reader.hasEncryptedData()}usePassword(passphrase){reader.setPassphrase(passphrase)}setLocale(locale){reader.setLocale(locale)}writeArchive(files,compression,format,passphrase){return writer.write(files,compression,format,passphrase)}close(){reader.close()}}getWasmModule(wasmModule=>{reader=new ArchiveReader(wasmModule),writer=new ArchiveWriter(wasmModule),null!=LibArchiveWorker&&null!=LibArchiveWorker.readyCallback&&LibArchiveWorker.readyCallback(),ready=!0}),expose(LibArchiveWorker); |