/* * * DecoderWorker.js v0.1.0 * Copyright (c) 2024-8-1 Ezviz-OpenBiz * . * */ !function(e){"function"==typeof define&&define.amd?define(e):e()}((function(){"use strict";var e={DEFAULT_SAMPLERATE:44100,DEFAULT_CHANNEL:1,H264AUD:[0,0,0,1,9,224],H265AUD:[0,0,0,1,70,1,80],DEF_AAC:"aac",DEF_MP3:"mp3",DEF_H265:"h265",DEF_HEVC:"hevc",DEF_H264:"h264",DEF_AVC:"avc",CODEC_OFFSET_TABLE:["hevc","h265","avc","h264","aac","mp3"]};function r(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var t={exports:{}};!function(e,r){function t(e,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,n=new Array(r);t=e.length?{done:!0}:{done:!1,value:e[o++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var d,f,p=(f="undefined"!=typeof document?null==(d=document.currentScript)?void 0:d.src:void 0,function(e){var r,t=function(){var r=dr.value;r in e||Object.defineProperty(e,r,{configurable:!0,get:function(){q("Access to module property ('"+r+"') is no longer possible via the module constructor argument; Instead, use the result of the module constructor.")}})};void 0===e&&(e={});var n,i,d=Object.assign({},e),p=new Promise((function(e,r){n=e,i=r}));["_malloc","_free","_memory","_registerWasmPlayer","_setCodecType","_exitWasmPlayer","_initDecoder","_decodeCodecContext","_destroy","_demuxTsStream","_getPacket","_getVLCLen","_getVLC","_getVPSLen","_getVPS","_getSPSLen","_getSPS","_getPPSLen","_getPPS","_getSEILen","_getSEI","___indirect_function_table","_ff_h264_cabac_tables","onRuntimeInitialized"].forEach((function(e){Object.getOwnPropertyDescriptor(p,e)||Object.defineProperty(p,e,{get:function(){return q("You are getting "+e+" on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js")},set:function(){return q("You are setting "+e+" on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js")}})}));var m="object"==("undefined"==typeof window?"undefined":u(window)),h="function"==typeof importScripts,g="object"==("undefined"==typeof process?"undefined":u(process))&&"object"==u(process.versions)&&"string"==typeof process.versions.node,v=!m&&!g&&!h;if(d.ENVIRONMENT)throw new Error("Module.ENVIRONMENT has been deprecated. To force the environment, use the ENVIRONMENT compile-time option (for example, -sENVIRONMENT=web or -sENVIRONMENT=node)");var E,y,w,b=Object.assign({},d),_="./this.program",S="";if(v){if("object"==("undefined"==typeof process?"undefined":u(process))||"object"==("undefined"==typeof window?"undefined":u(window))||"function"==typeof importScripts)throw new Error("not compiled for this environment (did you build to HTML and try to run it not on the web, or set ENVIRONMENT to something - like node - and run it someplace else - like on the web?)")}else{if(!m&&!h)throw new Error("environment detection error");if(h?S=self.location.href:"undefined"!=typeof document&&document.currentScript&&(S=document.currentScript.src),f&&(S=f),S=S.startsWith("blob:")?"":S.substr(0,S.replace(/[?#].*/,"").lastIndexOf("/")+1),"object"!=("undefined"==typeof window?"undefined":u(window))&&"function"!=typeof importScripts)throw new Error("not compiled for this environment (did you build to HTML and try to run it not on the web, or set ENVIRONMENT to something - like node - and run it someplace else - like on the web?)");E=function(e){var r=new XMLHttpRequest;return r.open("GET",e,!1),r.send(null),r.responseText},h&&(w=function(e){var r=new XMLHttpRequest;return r.open("GET",e,!1),r.responseType="arraybuffer",r.send(null),new Uint8Array(r.response)}),y=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)}}var O,T,k,A=d.print||console.log.bind(console),M=d.printErr||console.error.bind(console);Object.assign(d,b),b=null,O="fetchSettings",Object.getOwnPropertyDescriptor(d,O)&&q("`Module."+O+"` was supplied but `"+O+"` not included in INCOMING_MODULE_JS_API"),d.arguments&&d.arguments,ie("arguments","arguments_"),d.thisProgram&&(_=d.thisProgram),ie("thisProgram","thisProgram"),d.quit&&d.quit,ie("quit","quit_"),L(void 0===d.memoryInitializerPrefixURL,"Module.memoryInitializerPrefixURL option was removed, use Module.locateFile instead"),L(void 0===d.pthreadMainPrefixURL,"Module.pthreadMainPrefixURL option was removed, use Module.locateFile instead"),L(void 0===d.cdInitializerPrefixURL,"Module.cdInitializerPrefixURL option was removed, use Module.locateFile instead"),L(void 0===d.filePackagePrefixURL,"Module.filePackagePrefixURL option was removed, use Module.locateFile instead"),L(void 0===d.read,"Module.read option was removed (modify read_ in JS)"),L(void 0===d.readAsync,"Module.readAsync option was removed (modify readAsync in JS)"),L(void 0===d.readBinary,"Module.readBinary option was removed (modify readBinary in JS)"),L(void 0===d.setWindowTitle,"Module.setWindowTitle option was removed (modify emscripten_set_window_title in JS)"),L(void 0===d.TOTAL_MEMORY,"Module.TOTAL_MEMORY has been renamed Module.INITIAL_MEMORY"),ie("asm","wasmExports"),ie("read","read_"),ie("readAsync","readAsync"),ie("readBinary","readBinary"),ie("setWindowTitle","setWindowTitle"),L(!g,"node environment detected but not enabled at build time. Add `node` to `-sENVIRONMENT` to enable."),L(!v,"shell environment detected but not enabled at build time. Add `shell` to `-sENVIRONMENT` to enable."),d.wasmBinary&&(T=d.wasmBinary),ie("wasmBinary","wasmBinary"),"object"!=("undefined"==typeof WebAssembly?"undefined":u(WebAssembly))&&M("no native wasm support detected");var P,F,C,D,x,I=!1;function L(e,r){e||q("Assertion failed"+(r?": "+r:""))}function N(){var e=k.buffer;d.HEAP8=P=new Int8Array(e),d.HEAP16=C=new Int16Array(e),d.HEAPU8=F=new Uint8Array(e),d.HEAPU16=new Uint16Array(e),d.HEAP32=D=new Int32Array(e),d.HEAPU32=x=new Uint32Array(e),d.HEAPF32=new Float32Array(e),d.HEAPF64=new Float64Array(e)}function R(){if(!I){var e=ir();0==e&&(e+=4);var r=x[e>>2],t=x[e+4>>2];34821223==r&&2310721022==t||q("Stack overflow! Stack cookie has been overwritten at "+le(e)+", expected hex dwords 0x89BACDFE and 0x2135467, but received "+le(t)+" "+le(r)),1668509029!=x[0]&&q("Runtime error: The application has corrupted its heap memory area (address zero)!")}}L(!d.STACK_SIZE,"STACK_SIZE can no longer be set at runtime. Use -sSTACK_SIZE at link time"),L("undefined"!=typeof Int32Array&&"undefined"!=typeof Float64Array&&null!=Int32Array.prototype.subarray&&null!=Int32Array.prototype.set,"JS engine does not provide full typed array support"),L(!d.wasmMemory,"Use of `wasmMemory` detected. Use -sIMPORTED_MEMORY to define wasmMemory externally"),L(!d.INITIAL_MEMORY,"Detected runtime INITIAL_MEMORY setting. Use -sIMPORTED_MEMORY to define wasmMemory dynamically"),function(){var e=new Int16Array(1),r=new Int8Array(e.buffer);if(e[0]=25459,115!==r[0]||99!==r[1])throw"Runtime error: expected the system to be little-endian! (Run with -sSUPPORT_BIG_ENDIAN to bypass)"}();var U=[],B=[],j=[],$=!1;L(Math.imul,"This browser does not support Math.imul(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill"),L(Math.fround,"This browser does not support Math.fround(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill"),L(Math.clz32,"This browser does not support Math.clz32(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill"),L(Math.trunc,"This browser does not support Math.trunc(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill");var W=0,H=null,z=null,V={};function G(e){for(var r=e;;){if(!V[e])return e;e=r+Math.random()}}function Y(e){var r;W++,null==(r=d.monitorRunDependencies)||r.call(d,W),e?(L(!V[e]),V[e]=1,null===H&&"undefined"!=typeof setInterval&&(H=setInterval((function(){if(I)return clearInterval(H),void(H=null);var e=!1;for(var r in V)e||(e=!0,M("still waiting on run dependencies:")),M("dependency: "+r);e&&M("(end of list)")}),1e4))):M("warning: run dependency added without ID")}function Q(e){var r;if(W--,null==(r=d.monitorRunDependencies)||r.call(d,W),e?(L(V[e]),delete V[e]):M("warning: run dependency removed without ID"),0==W&&(null!==H&&(clearInterval(H),H=null),z)){var t=z;z=null,t()}}function q(e){var r;null==(r=d.onAbort)||r.call(d,e),M(e="Aborted("+e+")"),I=!0;var t=new WebAssembly.RuntimeError(e);throw i(t),t}var K,X,J,Z=function(e){return e.startsWith("data:application/octet-stream;base64,")},ee=function(e){return e.startsWith("file://")};function re(e,r){return function(){for(var t=arguments.length,n=new Array(t),o=0;o0;)e.shift()(d)};d.noExitRuntime;var le=function(e){return L("number"==typeof e),"0x"+(e>>>=0).toString(16).padStart(8,"0")},de=function(e){var r;(r=de).shown||(r.shown={}),de.shown[e]||(de.shown[e]=1,M(e))};function fe(){L(null!=xe.varargs);var e=D[+xe.varargs>>2];return xe.varargs+=4,e}var pe=fe,me={isAbs:function(e){return"/"===e.charAt(0)},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=me.isAbs(e),t="/"===e.substr(-1);return(e=me.normalizeArray(e.split("/").filter((function(e){return!!e})),!r).join("/"))||r||(e="."),e&&t&&(e+="/"),(r?"/":"")+e},dirname:function(e){var r=me.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=(e=me.normalize(e)).replace(/\/$/,"")).lastIndexOf("/");return-1===r?e:e.substr(r+1)},join:function(){for(var e=arguments.length,r=new Array(e),t=0;t { for (var i = 0; i < array.length; i++) array[i] = (Math.random()*256)|0 } };")}())(e)},ge={resolve:function(){for(var e=arguments.length,r=new Array(e),t=0;t=-1&&!o;i--){var a=i>=0?r[i]:Ce.cwd();if("string"!=typeof a)throw new TypeError("Arguments to path.resolve must be strings");if(!a)return"";n=a+"/"+n,o=me.isAbs(a)}return(o?"/":"")+(n=me.normalizeArray(n.split("/").filter((function(e){return!!e})),!o).join("/"))||"."},relative:function(e,r){var t=function(e){for(var r=0;r=0&&""===e[t];t--);return r>t?[]:e.slice(r,t-r+1)};e=ge.resolve(e).substr(1),r=ge.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=n);)++o;if(o-r>16&&e.buffer&&ve)return ve.decode(e.subarray(r,o));for(var i="";r>10,56320|1023&c)}}else i+=String.fromCharCode((31&a)<<6|s)}else i+=String.fromCharCode(a)}return i},ye=[],we=function(e){for(var r=0,t=0;t=55296&&n<=57343?(r+=4,++t):r+=3}return r},be=function(e,r,t,n){if(L("string"==typeof e,"stringToUTF8Array expects a string (got "+(void 0===e?"undefined":u(e))+")"),!(n>0))return 0;for(var o=t,i=t+n-1,a=0;a=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(t+3>=i)break;s>1114111&&de("Invalid Unicode code point "+le(s)+" encountered when serializing a JS string to a UTF-8 string in wasm memory! (Valid unicode code points should be in range 0-0x10FFFF)."),r[t++]=240|s>>18,r[t++]=128|s>>12&63,r[t++]=128|s>>6&63,r[t++]=128|63&s}}return r[t]=0,t-o};function _e(e,r,t){var n=we(e)+1,o=new Array(n),i=be(e,o,0,o.length);return o.length=i,o}var Se,Oe={ttys:[],init:function(){},shutdown:function(){},register:function(e,r){Oe.ttys[e]={input:[],output:[],ops:r},Ce.registerDevice(e,Oe.stream_ops)},stream_ops:{open:function(e){var r=Oe.ttys[e.node.rdev];if(!r)throw new Ce.ErrnoError(43);e.tty=r,e.seekable=!1},close:function(e){e.tty.ops.fsync(e.tty)},fsync:function(e){e.tty.ops.fsync(e.tty)},read:function(e,r,t,n,o){if(!e.tty||!e.tty.ops.get_char)throw new Ce.ErrnoError(60);for(var i=0,a=0;a0&&(A(Ee(e.output,0)),e.output=[])},ioctl_tcgets:function(e){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:function(e,r,t){return 0},ioctl_tiocgwinsz:function(e){return[24,80]}},default_tty1_ops:{put_char:function(e,r){null===r||10===r?(M(Ee(e.output,0)),e.output=[]):0!=r&&e.output.push(r)},fsync:function(e){e.output&&e.output.length>0&&(M(Ee(e.output,0)),e.output=[])}}},Te=function(e){q("internal error: mmapAlloc called but `emscripten_builtin_memalign` native symbol not exported")},ke={ops_table:null,mount:function(e){return ke.createNode(null,"/",16895,0)},createNode:function(e,r,t,n){var o;if(Ce.isBlkdev(t)||Ce.isFIFO(t))throw new Ce.ErrnoError(63);(o=ke).ops_table||(o.ops_table={dir:{node:{getattr:ke.node_ops.getattr,setattr:ke.node_ops.setattr,lookup:ke.node_ops.lookup,mknod:ke.node_ops.mknod,rename:ke.node_ops.rename,unlink:ke.node_ops.unlink,rmdir:ke.node_ops.rmdir,readdir:ke.node_ops.readdir,symlink:ke.node_ops.symlink},stream:{llseek:ke.stream_ops.llseek}},file:{node:{getattr:ke.node_ops.getattr,setattr:ke.node_ops.setattr},stream:{llseek:ke.stream_ops.llseek,read:ke.stream_ops.read,write:ke.stream_ops.write,allocate:ke.stream_ops.allocate,mmap:ke.stream_ops.mmap,msync:ke.stream_ops.msync}},link:{node:{getattr:ke.node_ops.getattr,setattr:ke.node_ops.setattr,readlink:ke.node_ops.readlink},stream:{}},chrdev:{node:{getattr:ke.node_ops.getattr,setattr:ke.node_ops.setattr},stream:Ce.chrdev_stream_ops}});var i=Ce.createNode(e,r,t,n);return Ce.isDir(i.mode)?(i.node_ops=ke.ops_table.dir.node,i.stream_ops=ke.ops_table.dir.stream,i.contents={}):Ce.isFile(i.mode)?(i.node_ops=ke.ops_table.file.node,i.stream_ops=ke.ops_table.file.stream,i.usedBytes=0,i.contents=null):Ce.isLink(i.mode)?(i.node_ops=ke.ops_table.link.node,i.stream_ops=ke.ops_table.link.stream):Ce.isChrdev(i.mode)&&(i.node_ops=ke.ops_table.chrdev.node,i.stream_ops=ke.ops_table.chrdev.stream),i.timestamp=Date.now(),e&&(e.contents[r]=i,e.timestamp=i.timestamp),i},getFileDataAsTypedArray:function(e){return e.contents?e.contents.subarray?e.contents.subarray(0,e.usedBytes):new Uint8Array(e.contents):new Uint8Array(0)},expandFileStorage:function(e,r){var t=e.contents?e.contents.length:0;if(!(t>=r)){r=Math.max(r,t*(t<1048576?2:1.125)>>>0),0!=t&&(r=Math.max(r,256));var n=e.contents;e.contents=new Uint8Array(r),e.usedBytes>0&&e.contents.set(n.subarray(0,e.usedBytes),0)}},resizeFileStorage:function(e,r){if(e.usedBytes!=r)if(0==r)e.contents=null,e.usedBytes=0;else{var t=e.contents;e.contents=new Uint8Array(r),t&&e.contents.set(t.subarray(0,Math.min(r,e.usedBytes))),e.usedBytes=r}},node_ops:{getattr:function(e){var r={};return r.dev=Ce.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,Ce.isDir(e.mode)?r.size=4096:Ce.isFile(e.mode)?r.size=e.usedBytes:Ce.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&&ke.resizeFileStorage(e,r.size)},lookup:function(e,r){throw Ce.genericErrors[44]},mknod:function(e,r,t,n){return ke.createNode(e,r,t,n)},rename:function(e,r,t){if(Ce.isDir(e.mode)){var n;try{n=Ce.lookupNode(r,t)}catch(e){}if(n)for(var o in n.contents)throw new Ce.ErrnoError(55)}delete e.parent.contents[e.name],e.parent.timestamp=Date.now(),e.name=t,r.contents[t]=e,r.timestamp=e.parent.timestamp,e.parent=r},unlink:function(e,r){delete e.contents[r],e.timestamp=Date.now()},rmdir:function(e,r){var t=Ce.lookupNode(e,r);for(var n in t.contents)throw new Ce.ErrnoError(55);delete e.contents[r],e.timestamp=Date.now()},readdir:function(e){for(var r,t=[".",".."],n=l(Object.keys(e.contents));!(r=n()).done;){var o=r.value;t.push(o)}return t},symlink:function(e,r,t){var n=ke.createNode(e,r,41471,0);return n.link=t,n},readlink:function(e){if(!Ce.isLink(e.mode))throw new Ce.ErrnoError(28);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(L(a>=0),a>8&&i.subarray)r.set(i.subarray(o,o+a),t);else for(var s=0;s0||t+r8)throw new Ce.ErrnoError(32);for(var t=e.split("/").filter((function(e){return!!e})),n=Ce.root,o="/",i=0;i40)throw new Ce.ErrnoError(32)}}return{path:o,node:n}},getPath:function(e){for(var r;;){if(Ce.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>>0)%Ce.nameTable.length},hashAddNode:function(e){var r=Ce.hashName(e.parent.id,e.name);e.name_next=Ce.nameTable[r],Ce.nameTable[r]=e},hashRemoveNode:function(e){var r=Ce.hashName(e.parent.id,e.name);if(Ce.nameTable[r]===e)Ce.nameTable[r]=e.name_next;else for(var t=Ce.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=Ce.mayLookup(e);if(t)throw new Ce.ErrnoError(t);for(var n=Ce.hashName(e.id,r),o=Ce.nameTable[n];o;o=o.name_next){var i=o.name;if(o.parent.id===e.id&&i===r)return o}return Ce.lookup(e,r)},createNode:function(e,r,t,n){L("object"==(void 0===e?"undefined":u(e)));var o=new Ce.FSNode(e,r,t,n);return Ce.hashAddNode(o),o},destroyNode:function(e){Ce.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&~e)},flagsToPermissionString:function(e){var r=["r","w","rw"][3&e];return 512&e&&(r+="w"),r},nodePermissions:function(e,r){return Ce.ignorePermissions||(!r.includes("r")||292&e.mode)&&(!r.includes("w")||146&e.mode)&&(!r.includes("x")||73&e.mode)?0:2},mayLookup:function(e){if(!Ce.isDir(e.mode))return 54;var r=Ce.nodePermissions(e,"x");return r||(e.node_ops.lookup?0:2)},mayCreate:function(e,r){try{return Ce.lookupNode(e,r),20}catch(e){}return Ce.nodePermissions(e,"wx")},mayDelete:function(e,r,t){var n;try{n=Ce.lookupNode(e,r)}catch(e){return e.errno}var o=Ce.nodePermissions(e,"wx");if(o)return o;if(t){if(!Ce.isDir(n.mode))return 54;if(Ce.isRoot(n)||Ce.getPath(n)===Ce.cwd())return 10}else if(Ce.isDir(n.mode))return 31;return 0},mayOpen:function(e,r){return e?Ce.isLink(e.mode)?32:Ce.isDir(e.mode)&&("r"!==Ce.flagsToPermissionString(r)||512&r)?31:Ce.nodePermissions(e,Ce.flagsToPermissionString(r)):44},MAX_OPEN_FDS:4096,nextfd:function(){for(var e=0;e<=Ce.MAX_OPEN_FDS;e++)if(!Ce.streams[e])return e;throw new Ce.ErrnoError(33)},getStreamChecked:function(e){var r=Ce.getStream(e);if(!r)throw new Ce.ErrnoError(8);return r},getStream:function(e){return Ce.streams[e]},createStream:function(e,r){return void 0===r&&(r=-1),e=Object.assign(new Ce.FSStream,e),-1==r&&(r=Ce.nextfd()),e.fd=r,Ce.streams[r]=e,e},closeStream:function(e){Ce.streams[e]=null},dupStream:function(e,r){var t,n;void 0===r&&(r=-1);var o=Ce.createStream(e,r);return null==(n=o.stream_ops)||null==(t=n.dup)||t.call(n,o),o},chrdev_stream_ops:{open:function(e){var r=Ce.getDevice(e.node.rdev);e.stream_ops=r.stream_ops,null==e.stream_ops.open||e.stream_ops.open.call(e.stream_ops,e)},llseek:function(){throw new Ce.ErrnoError(70)}},major:function(e){return e>>8},minor:function(e){return 255&e},makedev:function(e,r){return e<<8|r},registerDevice:function(e,r){Ce.devices[e]={stream_ops:r}},getDevice:function(e){return Ce.devices[e]},getMounts:function(e){for(var r=[],t=[e];t.length;){var n,o=t.pop();r.push(o),(n=t).push.apply(n,[].concat(o.mounts))}return r},syncfs:function(e,r){"function"==typeof e&&(r=e,e=!1),Ce.syncFSRequests++,Ce.syncFSRequests>1&&M("warning: "+Ce.syncFSRequests+" FS.syncfs operations in flight at once, probably just doing extra work");var t=Ce.getMounts(Ce.root.mount),n=0;function o(e){return L(Ce.syncFSRequests>0),Ce.syncFSRequests--,r(e)}function i(e){if(e)return i.errored?void 0:(i.errored=!0,o(e));++n>=t.length&&o(null)}t.forEach((function(r){if(!r.type.syncfs)return i(null);r.type.syncfs(r,e,i)}))},mount:function(e,r,t){if("string"==typeof e)throw e;var n,o="/"===t,i=!t;if(o&&Ce.root)throw new Ce.ErrnoError(10);if(!o&&!i){var a=Ce.lookupPath(t,{follow_mount:!1});if(t=a.path,n=a.node,Ce.isMountpoint(n))throw new Ce.ErrnoError(10);if(!Ce.isDir(n.mode))throw new Ce.ErrnoError(54)}var s={type:e,opts:r,mountpoint:t,mounts:[]},u=e.mount(s);return u.mount=s,s.root=u,o?Ce.root=u:n&&(n.mounted=s,n.mount&&n.mount.mounts.push(s)),u},unmount:function(e){var r=Ce.lookupPath(e,{follow_mount:!1});if(!Ce.isMountpoint(r.node))throw new Ce.ErrnoError(28);var t=r.node,n=t.mounted,o=Ce.getMounts(n);Object.keys(Ce.nameTable).forEach((function(e){for(var r=Ce.nameTable[e];r;){var t=r.name_next;o.includes(r.mount)&&Ce.destroyNode(r),r=t}})),t.mounted=null;var i=t.mount.mounts.indexOf(n);L(-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=Ce.lookupPath(e,{parent:!0}).node,o=me.basename(e);if(!o||"."===o||".."===o)throw new Ce.ErrnoError(28);var i=Ce.mayCreate(n,o);if(i)throw new Ce.ErrnoError(i);if(!n.node_ops.mknod)throw new Ce.ErrnoError(63);return n.node_ops.mknod(n,o,r,t)},create:function(e,r){return r=void 0!==r?r:438,r&=4095,r|=32768,Ce.mknod(e,r,0)},mkdir:function(e,r){return r=void 0!==r?r:511,r&=1023,r|=16384,Ce.mknod(e,r,0)},mkdirTree:function(e,r){for(var t=e.split("/"),n="",o=0;o=0),n<0||o<0)throw new Ce.ErrnoError(28);if(Ce.isClosed(e))throw new Ce.ErrnoError(8);if(1==(2097155&e.flags))throw new Ce.ErrnoError(8);if(Ce.isDir(e.node.mode))throw new Ce.ErrnoError(31);if(!e.stream_ops.read)throw new Ce.ErrnoError(28);var i=void 0!==o;if(i){if(!e.seekable)throw new Ce.ErrnoError(70)}else o=e.position;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(L(t>=0),n<0||o<0)throw new Ce.ErrnoError(28);if(Ce.isClosed(e))throw new Ce.ErrnoError(8);if(!(2097155&e.flags))throw new Ce.ErrnoError(8);if(Ce.isDir(e.node.mode))throw new Ce.ErrnoError(31);if(!e.stream_ops.write)throw new Ce.ErrnoError(28);e.seekable&&1024&e.flags&&Ce.llseek(e,0,2);var a=void 0!==o;if(a){if(!e.seekable)throw new Ce.ErrnoError(70)}else o=e.position;var s=e.stream_ops.write(e,r,t,n,o,i);return a||(e.position+=s),s},allocate:function(e,r,t){if(Ce.isClosed(e))throw new Ce.ErrnoError(8);if(r<0||t<=0)throw new Ce.ErrnoError(28);if(!(2097155&e.flags))throw new Ce.ErrnoError(8);if(!Ce.isFile(e.node.mode)&&!Ce.isDir(e.node.mode))throw new Ce.ErrnoError(43);if(!e.stream_ops.allocate)throw new Ce.ErrnoError(138);e.stream_ops.allocate(e,r,t)},mmap:function(e,r,t,n,o){if(2&n&&!(2&o)&&2!=(2097155&e.flags))throw new Ce.ErrnoError(2);if(1==(2097155&e.flags))throw new Ce.ErrnoError(2);if(!e.stream_ops.mmap)throw new Ce.ErrnoError(43);return e.stream_ops.mmap(e,r,t,n,o)},msync:function(e,r,t,n,o){return L(t>=0),e.stream_ops.msync?e.stream_ops.msync(e,r,t,n,o):0},ioctl:function(e,r,t){if(!e.stream_ops.ioctl)throw new Ce.ErrnoError(59);return e.stream_ops.ioctl(e,r,t)},readFile:function(e,r){if(void 0===r&&(r={}),r.flags=r.flags||0,r.encoding=r.encoding||"binary","utf8"!==r.encoding&&"binary"!==r.encoding)throw new Error('Invalid encoding type "'+r.encoding+'"');var t,n=Ce.open(e,r.flags),o=Ce.stat(e).size,i=new Uint8Array(o);return Ce.read(n,i,0,o,0),"utf8"===r.encoding?t=Ee(i,0):"binary"===r.encoding&&(t=i),Ce.close(n),t},writeFile:function(e,r,t){void 0===t&&(t={}),t.flags=t.flags||577;var n=Ce.open(e,t.flags,t.mode);if("string"==typeof r){var o=new Uint8Array(we(r)+1),i=be(r,o,0,o.length);Ce.write(n,o,0,i,void 0,t.canOwn)}else{if(!ArrayBuffer.isView(r))throw new Error("Unsupported data type");Ce.write(n,r,0,r.byteLength,void 0,t.canOwn)}Ce.close(n)},cwd:function(){return Ce.currentPath},chdir:function(e){var r=Ce.lookupPath(e,{follow:!0});if(null===r.node)throw new Ce.ErrnoError(44);if(!Ce.isDir(r.node.mode))throw new Ce.ErrnoError(54);var t=Ce.nodePermissions(r.node,"x");if(t)throw new Ce.ErrnoError(t);Ce.currentPath=r.path},createDefaultDirectories:function(){Ce.mkdir("/tmp"),Ce.mkdir("/home"),Ce.mkdir("/home/web_user")},createDefaultDevices:function(){Ce.mkdir("/dev"),Ce.registerDevice(Ce.makedev(1,3),{read:function(){return 0},write:function(e,r,t,n,o){return n}}),Ce.mkdev("/dev/null",Ce.makedev(1,3)),Oe.register(Ce.makedev(5,0),Oe.default_tty_ops),Oe.register(Ce.makedev(6,0),Oe.default_tty1_ops),Ce.mkdev("/dev/tty",Ce.makedev(5,0)),Ce.mkdev("/dev/tty1",Ce.makedev(6,0));var e=new Uint8Array(1024),r=0,t=function(){return 0===r&&(r=he(e).byteLength),e[--r]};Ce.createDevice("/dev","random",t),Ce.createDevice("/dev","urandom",t),Ce.mkdir("/dev/shm"),Ce.mkdir("/dev/shm/tmp")},createSpecialDirectories:function(){Ce.mkdir("/proc");var e=Ce.mkdir("/proc/self");Ce.mkdir("/proc/self/fd"),Ce.mount({mount:function(){var r=Ce.createNode(e,"fd",16895,73);return r.node_ops={lookup:function(e,r){var t=+r,n=Ce.getStreamChecked(t),o={parent:null,mount:{mountpoint:"fake"},node_ops:{readlink:function(){return n.path}}};return o.parent=o,o}},r}},{},"/proc/self/fd")},createStandardStreams:function(){d.stdin?Ce.createDevice("/dev","stdin",d.stdin):Ce.symlink("/dev/tty","/dev/stdin"),d.stdout?Ce.createDevice("/dev","stdout",null,d.stdout):Ce.symlink("/dev/tty","/dev/stdout"),d.stderr?Ce.createDevice("/dev","stderr",null,d.stderr):Ce.symlink("/dev/tty1","/dev/stderr");var e=Ce.open("/dev/stdin",0),r=Ce.open("/dev/stdout",1),t=Ce.open("/dev/stderr",1);L(0===e.fd,"invalid handle for stdin ("+e.fd+")"),L(1===r.fd,"invalid handle for stdout ("+r.fd+")"),L(2===t.fd,"invalid handle for stderr ("+t.fd+")")},staticInit:function(){[44].forEach((function(e){Ce.genericErrors[e]=new Ce.ErrnoError(e),Ce.genericErrors[e].stack=""})),Ce.nameTable=new Array(4096),Ce.mount(ke,{},"/"),Ce.createDefaultDirectories(),Ce.createDefaultDevices(),Ce.createSpecialDirectories(),Ce.filesystems={MEMFS:ke}},init:function(e,r,t){L(!Ce.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)"),Ce.init.initialized=!0,d.stdin=e||d.stdin,d.stdout=r||d.stdout,d.stderr=t||d.stderr,Ce.createStandardStreams()},quit:function(){Ce.init.initialized=!1,tr(0);for(var e=0;ethis.length-1||e<0)){var r=e%this.chunkSize,t=e/this.chunkSize|0;return this.getter(t)[r]}},r.setDataGetter=function(e){this.getter=e},r.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=this;s.setDataGetter((function(e){var r=e*a,o=(e+1)*a-1;if(o=Math.min(o,n-1),void 0===s.chunks[e]&&(s.chunks[e]=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),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||[]):_e(o.responseText||"")}(r,o)),void 0===s.chunks[e])throw new Error("doXHR failed!");return s.chunks[e]})),!i&&n||(a=n=1,n=this.getter(0).length,a=n,A("LazyFiles on gzip forces download of the whole file when length is accessed")),this._length=n,this._chunkSize=a,this.lengthKnown=!0},o(e,[{key:"length",get:function(){return this.lengthKnown||this.cacheLength(),this._length}},{key:"chunkSize",get:function(){return this.lengthKnown||this.cacheLength(),this._chunkSize}}]),e}();if("undefined"!=typeof XMLHttpRequest){if(!h)throw"Cannot do synchronous binary XHRs outside webworkers in modern browsers. Use --embed-file or --preload-file in emcc";var s={isDevice:!1,contents:new a}}else s={isDevice:!1,url:t};var u=Ce.createFile(e,r,s,n,i);s.contents?u.contents=s.contents:s.url&&(u.contents=null,u.url=s.url),Object.defineProperties(u,{usedBytes:{get:function(){return this.contents.length}}});var c={};function l(e,r,t,n,o){var i=e.node.contents;if(o>=i.length)return 0;var a=Math.min(i.length-o,n);if(L(a>=0),i.slice)for(var s=0;s>2]=n.dev,D[t+4>>2]=n.mode,x[t+8>>2]=n.nlink,D[t+12>>2]=n.uid,D[t+16>>2]=n.gid,D[t+20>>2]=n.rdev,J=[n.size>>>0,(X=n.size,+Math.abs(X)>=1?X>0?+Math.floor(X/4294967296)>>>0:~~+Math.ceil((X-+(~~X>>>0))/4294967296)>>>0:0)],D[t+24>>2]=J[0],D[t+28>>2]=J[1],D[t+32>>2]=4096,D[t+36>>2]=n.blocks;var o=n.atime.getTime(),i=n.mtime.getTime(),a=n.ctime.getTime();return J=[Math.floor(o/1e3)>>>0,(X=Math.floor(o/1e3),+Math.abs(X)>=1?X>0?+Math.floor(X/4294967296)>>>0:~~+Math.ceil((X-+(~~X>>>0))/4294967296)>>>0:0)],D[t+40>>2]=J[0],D[t+44>>2]=J[1],x[t+48>>2]=o%1e3*1e3,J=[Math.floor(i/1e3)>>>0,(X=Math.floor(i/1e3),+Math.abs(X)>=1?X>0?+Math.floor(X/4294967296)>>>0:~~+Math.ceil((X-+(~~X>>>0))/4294967296)>>>0:0)],D[t+56>>2]=J[0],D[t+60>>2]=J[1],x[t+64>>2]=i%1e3*1e3,J=[Math.floor(a/1e3)>>>0,(X=Math.floor(a/1e3),+Math.abs(X)>=1?X>0?+Math.floor(X/4294967296)>>>0:~~+Math.ceil((X-+(~~X>>>0))/4294967296)>>>0:0)],D[t+72>>2]=J[0],D[t+76>>2]=J[1],x[t+80>>2]=a%1e3*1e3,J=[n.ino>>>0,(X=n.ino,+Math.abs(X)>=1?X>0?+Math.floor(X/4294967296)>>>0:~~+Math.ceil((X-+(~~X>>>0))/4294967296)>>>0:0)],D[t+88>>2]=J[0],D[t+92>>2]=J[1],0},doMsync:function(e,r,t,n,o){if(!Ce.isFile(r.node.mode))throw new Ce.ErrnoError(43);if(2&n)return 0;var i=F.slice(e,e+t);Ce.msync(r,i,o,t,n)},getStreamFromFD:function(e){return Ce.getStreamChecked(e)},varargs:void 0,getStr:function(e){return De(e)}},Ie=function(e,r){return L(e==e>>>0||e==(0|e)),L(r===(0|r)),r+2097152>>>0<4194305-!!e?(e>>>0)+4294967296*r:NaN},Le=[0,31,60,91,121,152,182,213,244,274,305,335],Ne=[0,31,59,90,120,151,181,212,243,273,304,334],Re=function(e){var r;return((r=e.getFullYear())%4!=0||r%100==0&&r%400!=0?Ne:Le)[e.getMonth()]+e.getDate()-1},Ue=function(e,r,t){return L("number"==typeof t,"stringToUTF8(str, outPtr, maxBytesToWrite) is missing the third parameter that specifies the length of the output buffer!"),be(e,F,r,t)};Se=function(){return performance.now()};var Be,je,$e=function(e){var r=k.buffer,t=(e-r.byteLength+65535)/65536;try{return k.grow(t),N(),1}catch(t){M("growMemory: Attempted to grow heap from "+r.byteLength+" bytes to "+e+" bytes, but got error: "+t)}},We={},He=function(){if(!He.strings){var e={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:("object"==("undefined"==typeof navigator?"undefined":u(navigator))&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",_:_||"./this.program"};for(var r in We)void 0===We[r]?delete e[r]:e[r]=We[r];var t=[];for(var r in e)t.push(r+"="+e[r]);He.strings=t}return He.strings},ze=function(e){return sr(e)},Ve=function(e,r,t,n,o){var i={string:function(e){var r=0;return null!=e&&0!==e&&(r=function(e){var r=we(e)+1,t=ze(r);return Ue(e,t,r),t}(e)),r},array:function(e){var r,t,n=ze(e.length);return t=n,L((r=e).length>=0,"writeArrayToMemory array must have a length (should be an array or typed array)"),P.set(r,t),n}},a=function(e){var r=d["_"+e];return L(r,"Cannot call unknown function "+e+", make sure it is exported"),r}(e),s=[],u=0;if(L("array"!==r,'Return type should not be "array".'),n)for(var c=0;c>7)},Ye=function(e,r){var t;if(L(!r.includes("j"),"i64 not permitted in function signatures when WASM_BIGINT is disabled"),"function"==typeof WebAssembly.Function)return new WebAssembly.Function(function(e){L(!e.includes("j"),"i64 not permitted in function signatures when WASM_BIGINT is disabled");for(var r={i:"i32",j:"i64",f:"f32",d:"f64",e:"externref",p:"i32"},t={parameters:[],results:"v"==e[0]?[]:[r[e[0]]]},n=1;n=Qe.length&&(Qe.length=e+1),Qe[e]=r=Be.get(e)),L(Be.get(e)==r,"JavaScript-side Wasm function table mirror is out of date!"),r},Ke=function(e){return je||(je=new WeakMap,function(e,r){if(je)for(var t=e;t>1]=2,0}return-28}catch(e){if(void 0===Ce||"ErrnoError"!==e.name)throw e;return-e.errno}},__syscall_openat:function(e,r,t,n){xe.varargs=n;try{r=xe.getStr(r),r=xe.calculateAt(e,r);var o=n?fe():0;return Ce.open(r,t,o).fd}catch(e){if(void 0===Ce||"ErrnoError"!==e.name)throw e;return-e.errno}},_abort_js:function(){q("native code called abort()")},_emscripten_get_now_is_monotonic:function(){return 1},_emscripten_memcpy_js:function(e,r,t){return F.copyWithin(e,r,r+t)},_gmtime_js:function(e,r,t){var n=Ie(e,r),o=new Date(1e3*n);D[t>>2]=o.getUTCSeconds(),D[t+4>>2]=o.getUTCMinutes(),D[t+8>>2]=o.getUTCHours(),D[t+12>>2]=o.getUTCDate(),D[t+16>>2]=o.getUTCMonth(),D[t+20>>2]=o.getUTCFullYear()-1900,D[t+24>>2]=o.getUTCDay();var i=Date.UTC(o.getUTCFullYear(),0,1,0,0,0,0),a=(o.getTime()-i)/864e5|0;D[t+28>>2]=a},_localtime_js:function(e,r,t){var n=Ie(e,r),o=new Date(1e3*n);D[t>>2]=o.getSeconds(),D[t+4>>2]=o.getMinutes(),D[t+8>>2]=o.getHours(),D[t+12>>2]=o.getDate(),D[t+16>>2]=o.getMonth(),D[t+20>>2]=o.getFullYear()-1900,D[t+24>>2]=o.getDay();var i=0|Re(o);D[t+28>>2]=i,D[t+36>>2]=-60*o.getTimezoneOffset();var a=new Date(o.getFullYear(),0,1),s=new Date(o.getFullYear(),6,1).getTimezoneOffset(),u=a.getTimezoneOffset(),c=0|(s!=u&&o.getTimezoneOffset()==Math.min(u,s));D[t+32>>2]=c},_mktime_js:function(e){var r,t=function(){var r=new Date(D[e+20>>2]+1900,D[e+16>>2],D[e+12>>2],D[e+8>>2],D[e+4>>2],D[e>>2],0),t=D[e+32>>2],n=r.getTimezoneOffset(),o=new Date(r.getFullYear(),0,1),i=new Date(r.getFullYear(),6,1).getTimezoneOffset(),a=o.getTimezoneOffset(),s=Math.min(a,i);if(t<0)D[e+32>>2]=Number(i!=a&&s==n);else if(t>0!=(s==n)){var u=Math.max(a,i),c=t>0?s:u;r.setTime(r.getTime()+6e4*(c-n))}D[e+24>>2]=r.getDay();var l=0|Re(r);D[e+28>>2]=l,D[e>>2]=r.getSeconds(),D[e+4>>2]=r.getMinutes(),D[e+8>>2]=r.getHours(),D[e+12>>2]=r.getDate(),D[e+16>>2]=r.getMonth(),D[e+20>>2]=r.getYear();var d=r.getTime();return isNaN(d)?-1:d/1e3}();return X=t,r=+Math.abs(X)>=1?X>0?+Math.floor(X/4294967296)>>>0:~~+Math.ceil((X-+(~~X>>>0))/4294967296)>>>0:0,nr(r),t>>>0},_tzset_js:function(e,r,t,n){var o=(new Date).getFullYear(),i=new Date(o,0,1),a=new Date(o,6,1),s=i.getTimezoneOffset(),u=a.getTimezoneOffset(),c=Math.max(s,u);x[e>>2]=60*c,D[r>>2]=Number(s!=u);var l=function(e){return e.toLocaleTimeString(void 0,{hour12:!1,timeZoneName:"short"}).split(" ")[1]},d=l(i),f=l(a);L(d),L(f),L(we(d)<=16,"timezone name truncated to fit in TZNAME_MAX ("+d+")"),L(we(f)<=16,"timezone name truncated to fit in TZNAME_MAX ("+f+")"),u>>=0)>r);var t=2147483648;if(e>t)return M("Cannot enlarge memory, requested "+e+" bytes, but the limit is "+t+" bytes!"),!1;for(var n,o,i=1;i<=4;i*=2){var a=r*(1+.2/i);a=Math.min(a,e+100663296);var s=Math.min(t,(n=Math.max(e,a))+((o=65536)-n%o)%o);if($e(s))return!0}return M("Failed to grow the heap from "+r+" bytes to "+s+" bytes, not enough memory!"),!1},environ_get:function(e,r){var t=0;return He().forEach((function(n,o){var i=r+t;x[e+4*o>>2]=i,function(e,r){for(var t=0;t>2]=t.length;var n=0;return t.forEach((function(e){return n+=e.length+1})),x[r>>2]=n,0},fd_close:function(e){try{var r=xe.getStreamFromFD(e);return Ce.close(r),0}catch(e){if(void 0===Ce||"ErrnoError"!==e.name)throw e;return e.errno}},fd_fdstat_get:function(e,r){try{var t=xe.getStreamFromFD(e),n=t.tty?2:Ce.isDir(t.mode)?3:Ce.isLink(t.mode)?7:4;return P[r]=n,C[r+2>>1]=0,J=[0,(X=0,+Math.abs(X)>=1?X>0?+Math.floor(X/4294967296)>>>0:~~+Math.ceil((X-+(~~X>>>0))/4294967296)>>>0:0)],D[r+8>>2]=J[0],D[r+12>>2]=J[1],J=[0,(X=0,+Math.abs(X)>=1?X>0?+Math.floor(X/4294967296)>>>0:~~+Math.ceil((X-+(~~X>>>0))/4294967296)>>>0:0)],D[r+16>>2]=J[0],D[r+20>>2]=J[1],0}catch(e){if(void 0===Ce||"ErrnoError"!==e.name)throw e;return e.errno}},fd_read:function(e,r,t,n){try{var o=function(e,r,t,n){for(var o=0,i=0;i>2],s=x[r+4>>2];r+=8;var u=Ce.read(e,P,a,s,n);if(u<0)return-1;if(o+=u,u>2]=o,0}catch(e){if(void 0===Ce||"ErrnoError"!==e.name)throw e;return e.errno}},fd_seek:function(e,r,t,n,o){var i=Ie(r,t);try{if(isNaN(i))return 61;var a=xe.getStreamFromFD(e);return Ce.llseek(a,i,n),J=[a.position>>>0,(X=a.position,+Math.abs(X)>=1?X>0?+Math.floor(X/4294967296)>>>0:~~+Math.ceil((X-+(~~X>>>0))/4294967296)>>>0:0)],D[o>>2]=J[0],D[o+4>>2]=J[1],a.getdents&&0===i&&0===n&&(a.getdents=null),0}catch(e){if(void 0===Ce||"ErrnoError"!==e.name)throw e;return e.errno}},fd_write:function(e,r,t,n){try{var o=function(e,r,t,n){for(var o=0,i=0;i>2],s=x[r+4>>2];r+=8;var u=Ce.write(e,P,a,s,n);if(u<0)return-1;o+=u}return o}(xe.getStreamFromFD(e),r,t);return x[n>>2]=o,0}catch(e){if(void 0===Ce||"ErrnoError"!==e.name)throw e;return e.errno}}},er=function(){var e={env:Ze,wasi_snapshot_preview1:Ze};function r(e,r){var t;return er=e.exports,L(k=er.memory,"memory not found in wasm exports"),N(),L(Be=er.__indirect_function_table,"table not found in wasm exports"),t=er.__wasm_call_ctors,B.unshift(t),Q("wasm-instantiate"),er}Y("wasm-instantiate");var t,n,o,a,s=d;if(d.instantiateWasm)try{return d.instantiateWasm(e,r)}catch(e){M("Module.instantiateWasm callback failed with error: "+e),i(e)}return K||(K=te()),(t=T,n=K,o=e,a=function(e){L(d===s,"the Module object should not be replaced during async compilation - perhaps the order of HTML elements is wrong?"),s=null,r(e.instance)},t||"function"!=typeof WebAssembly.instantiateStreaming||Z(n)||"function"!=typeof fetch?oe(n,o,a):fetch(n,{credentials:"same-origin"}).then((function(e){return WebAssembly.instantiateStreaming(e,o).then(a,(function(e){return M("wasm streaming compile failed: "+e),M("falling back to ArrayBuffer instantiation"),oe(n,o,a)}))}))).catch(i),{}}();d._malloc=re("malloc",1),d._free=re("free",1),d._registerWasmPlayer=re("registerWasmPlayer",0),d._setCodecType=re("setCodecType",4),d._exitWasmPlayer=re("exitWasmPlayer",1),d._initDecoder=re("initDecoder",1),d._decodeCodecContext=re("decodeCodecContext",5),d._destroy=re("destroy",1),d._demuxTsStream=re("demuxTsStream",3),d._getPacket=re("getPacket",0),d._getVLCLen=re("getVLCLen",0),d._getVLC=re("getVLC",0),d._getVPSLen=re("getVPSLen",0),d._getVPS=re("getVPS",0),d._getSPSLen=re("getSPSLen",0),d._getSPS=re("getSPS",0),d._getPPSLen=re("getPPSLen",0),d._getPPS=re("getPPS",0),d._getSEILen=re("getSEILen",0),d._getSEI=re("getSEI",0);var rr,tr=re("fflush",1),nr=re("_emscripten_tempret_set",1),or=function(){return(or=er.emscripten_stack_init)()},ir=function(){return(ir=er.emscripten_stack_get_end)()},ar=function(e){return(ar=er._emscripten_stack_restore)(e)},sr=function(e){return(sr=er._emscripten_stack_alloc)(e)},ur=function(){return(ur=er.emscripten_stack_get_current)()};function cr(){var e;or(),L(!(3&(e=ir()))),0==e&&(e+=4),x[e>>2]=34821223,x[e+4>>2]=2310721022,x[0]=1668509029}function lr(){function e(){rr||(rr=!0,d.calledRun=!0,I||(L(!$),$=!0,R(),d.noFSInit||Ce.init.initialized||Ce.init(),Ce.ignorePermissions=!1,ce(B),n(d),d.onRuntimeInitialized&&d.onRuntimeInitialized(),L(!d._main,'compiled without a main, but one is present. if you added it from JS, use Module["onRuntimeInitialized"]'),function(){if(R(),d.postRun)for("function"==typeof d.postRun&&(d.postRun=[d.postRun]);d.postRun.length;)e=d.postRun.shift(),j.unshift(e);var e;ce(j)}()))}W>0||(cr(),function(){if(d.preRun)for("function"==typeof d.preRun&&(d.preRun=[d.preRun]);d.preRun.length;)e=d.preRun.shift(),U.unshift(e);var e;ce(U)}(),W>0||(d.setStatus?(d.setStatus("Running..."),setTimeout((function(){setTimeout((function(){d.setStatus("")}),1),e()}),1)):e(),R()))}if(d.dynCall_jiji=re("dynCall_jiji",5),d.dynCall_iiiiij=re("dynCall_iiiiij",7),d.dynCall_jiiij=re("dynCall_jiiij",6),d._ff_h264_cabac_tables=113148,d.run=lr,d.ccall=Ve,d.cwrap=function(e,r,t,n){return function(){for(var n=arguments.length,o=new Array(n),i=0;i0;)d.preInit.pop()();lr(),r=p;for(var dr,fr=l(Object.keys(d));!(dr=fr()).done;)t();return r});"object"===u(r)&&"object"===u(e)&&(e.exports=p)}(t,t.exports);var n,o,i,a,s=r(t.exports),u="wasmLoading",c="wasmLoaded",l="wasmFailed",d="registerWasmPlayer",f="videoCallback",p="decodeCodecContext",m="destroy",h="demuxTsStream",g="demuxCoreReceive",v="readPacket",E="readPacketEnd",y="mediaInfo",w=function(e,r){return{cmd:e,data:r}},b=(n="undefined"!=typeof self?self:window,o={navigator:void 0!==n.navigator?n.navigator:{userAgent:""},infoMap:{engine:["WebKit","Trident","Gecko","Presto"],browser:["Safari","Chrome","Edge","IE","Firefox","Firefox Focus","Chromium","Opera","Vivaldi","Yandex","Arora","Lunascape","QupZilla","Coc Coc","Kindle","Iceweasel","Konqueror","Iceape","SeaMonkey","Epiphany","360","360SE","360EE","UC","QQBrowser","QQ","Baidu","Maxthon","Sogou","LBBROWSER","2345Explorer","TheWorld","XiaoMi","Quark","Qiyu","Wechat","Taobao","Alipay","Weibo","Douban","Suning","iQiYi"],os:["Windows","Linux","Mac OS","Android","Ubuntu","FreeBSD","Debian","iOS","Windows Phone","BlackBerry","MeeGo","Symbian","Chrome OS","WebOS"],device:["Mobile","Tablet","iPad"]}},i={getMatchMap:function(e){return{Trident:e.indexOf("Trident")>-1||e.indexOf("NET CLR")>-1,Presto:e.indexOf("Presto")>-1,WebKit:e.indexOf("AppleWebKit")>-1,Gecko:e.indexOf("Gecko/")>-1,Safari:e.indexOf("Safari")>-1,Chrome:e.indexOf("Chrome")>-1||e.indexOf("CriOS")>-1,IE:e.indexOf("MSIE")>-1||e.indexOf("Trident")>-1,Edge:e.indexOf("Edge")>-1,Firefox:e.indexOf("Firefox")>-1||e.indexOf("FxiOS")>-1,"Firefox Focus":e.indexOf("Focus")>-1,Chromium:e.indexOf("Chromium")>-1,Opera:e.indexOf("Opera")>-1||e.indexOf("OPR")>-1,Vivaldi:e.indexOf("Vivaldi")>-1,Yandex:e.indexOf("YaBrowser")>-1,Arora:e.indexOf("Arora")>-1,Lunascape:e.indexOf("Lunascape")>-1,QupZilla:e.indexOf("QupZilla")>-1,"Coc Coc":e.indexOf("coc_coc_browser")>-1,Kindle:e.indexOf("Kindle")>-1||e.indexOf("Silk/")>-1,Iceweasel:e.indexOf("Iceweasel")>-1,Konqueror:e.indexOf("Konqueror")>-1,Iceape:e.indexOf("Iceape")>-1,SeaMonkey:e.indexOf("SeaMonkey")>-1,Epiphany:e.indexOf("Epiphany")>-1,360:e.indexOf("QihooBrowser")>-1||e.indexOf("QHBrowser")>-1,"360EE":e.indexOf("360EE")>-1,"360SE":e.indexOf("360SE")>-1,UC:e.indexOf("UC")>-1||e.indexOf(" UBrowser")>-1,QQBrowser:e.indexOf("QQBrowser")>-1,QQ:e.indexOf("QQ/")>-1,Baidu:e.indexOf("Baidu")>-1||e.indexOf("BIDUBrowser")>-1,Maxthon:e.indexOf("Maxthon")>-1,Sogou:e.indexOf("MetaSr")>-1||e.indexOf("Sogou")>-1,LBBROWSER:e.indexOf("LBBROWSER")>-1,"2345Explorer":e.indexOf("2345Explorer")>-1,TheWorld:e.indexOf("TheWorld")>-1,XiaoMi:e.indexOf("MiuiBrowser")>-1,Quark:e.indexOf("Quark")>-1,Qiyu:e.indexOf("Qiyu")>-1,Wechat:e.indexOf("MicroMessenger")>-1,Taobao:e.indexOf("AliApp(TB")>-1,Alipay:e.indexOf("AliApp(AP")>-1,Weibo:e.indexOf("Weibo")>-1,Douban:e.indexOf("com.douban.frodo")>-1,Suning:e.indexOf("SNEBUY-APP")>-1,iQiYi:e.indexOf("IqiyiApp")>-1,Windows:e.indexOf("Windows")>-1,Linux:e.indexOf("Linux")>-1||e.indexOf("X11")>-1,"Mac OS":e.indexOf("Macintosh")>-1,Android:e.indexOf("Android")>-1||e.indexOf("Adr")>-1,Ubuntu:e.indexOf("Ubuntu")>-1,FreeBSD:e.indexOf("FreeBSD")>-1,Debian:e.indexOf("Debian")>-1,"Windows Phone":e.indexOf("IEMobile")>-1||e.indexOf("Windows Phone")>-1,BlackBerry:e.indexOf("BlackBerry")>-1||e.indexOf("RIM")>-1,MeeGo:e.indexOf("MeeGo")>-1,Symbian:e.indexOf("Symbian")>-1,iOS:e.indexOf("like Mac OS X")>-1,"Chrome OS":e.indexOf("CrOS")>-1,WebOS:e.indexOf("hpwOS")>-1,Mobile:e.indexOf("Mobi")>-1||e.indexOf("iPh")>-1||e.indexOf("480")>-1,Tablet:e.indexOf("Tablet")>-1||e.indexOf("Nexus 7")>-1,iPad:e.indexOf("iPad")>-1}},matchInfoMap:function(e){var r,t=(null==(r=o.navigator)?void 0:r.userAgent)||"",n=i.getMatchMap(t);for(var a in o.infoMap)for(var s=0;s36&&n.showModalDialog?s=!0:+u>45&&(s=t("type","application/vnd.chromium.remoting-viewer"))}if(a.Baidu&&a.Opera&&(a.Baidu=!1),a.Mobile&&(a.Mobile=!r.includes("iPad")),s&&(t("type","application/gameplugin")||o.navigator&&void 0===o.navigator.connection.saveData?a["360SE"]=!0:a["360EE"]=!0),a.IE||a.Edge)switch(window.screenTop-window.screenY){case 71:case 74:case 99:case 75:case 105:break;case 102:a["360EE"]=!0;break;case 104:a["360SE"]=!0}var c={Safari:function(){return r.replace(/^.*Version\/([\d.]+).*$/,"$1")},Chrome:function(){return r.replace(/^.*Chrome\/([\d.]+).*$/,"$1").replace(/^.*CriOS\/([\d.]+).*$/,"$1")},IE:function(){return r.replace(/^.*MSIE ([\d.]+).*$/,"$1").replace(/^.*rv:([\d.]+).*$/,"$1")},Edge:function(){return r.replace(/^.*Edge\/([\d.]+).*$/,"$1")},Firefox:function(){return r.replace(/^.*Firefox\/([\d.]+).*$/,"$1").replace(/^.*FxiOS\/([\d.]+).*$/,"$1")},"Firefox Focus":function(){return r.replace(/^.*Focus\/([\d.]+).*$/,"$1")},Chromium:function(){return r.replace(/^.*Chromium\/([\d.]+).*$/,"$1")},Opera:function(){return r.replace(/^.*Opera\/([\d.]+).*$/,"$1").replace(/^.*OPR\/([\d.]+).*$/,"$1")},Vivaldi:function(){return r.replace(/^.*Vivaldi\/([\d.]+).*$/,"$1")},Yandex:function(){return r.replace(/^.*YaBrowser\/([\d.]+).*$/,"$1")},Arora:function(){return r.replace(/^.*Arora\/([\d.]+).*$/,"$1")},Lunascape:function(){return r.replace(/^.*Lunascape[\/\s]([\d.]+).*$/,"$1")},QupZilla:function(){return r.replace(/^.*QupZilla[\/\s]([\d.]+).*$/,"$1")},"Coc Coc":function(){return r.replace(/^.*coc_coc_browser\/([\d.]+).*$/,"$1")},Kindle:function(){return r.replace(/^.*Version\/([\d.]+).*$/,"$1")},Iceweasel:function(){return r.replace(/^.*Iceweasel\/([\d.]+).*$/,"$1")},Konqueror:function(){return r.replace(/^.*Konqueror\/([\d.]+).*$/,"$1")},Iceape:function(){return r.replace(/^.*Iceape\/([\d.]+).*$/,"$1")},SeaMonkey:function(){return r.replace(/^.*SeaMonkey\/([\d.]+).*$/,"$1")},Epiphany:function(){return r.replace(/^.*Epiphany\/([\d.]+).*$/,"$1")},360:function(){return r.replace(/^.*QihooBrowser\/([\d.]+).*$/,"$1")},"360SE":function(){return{63:"10.0",55:"9.1",45:"8.1",42:"8.0",31:"7.0",21:"6.3"}[+r.replace(/^.*Chrome\/([\d]+).*$/,"$1")]||""},"360EE":function(){return{69:"11.0",63:"9.5",55:"9.0",50:"8.7",30:"7.5"}[+r.replace(/^.*Chrome\/([\d]+).*$/,"$1")]||""},Maxthon:function(){return r.replace(/^.*Maxthon\/([\d.]+).*$/,"$1")},QQBrowser:function(){return r.replace(/^.*QQBrowser\/([\d.]+).*$/,"$1")},QQ:function(){return r.replace(/^.*QQ\/([\d.]+).*$/,"$1")},Baidu:function(){return r.replace(/^.*BIDUBrowser[\s\/]([\d.]+).*$/,"$1")},UC:function(){return r.replace(/^.*UC?Browser\/([\d.]+).*$/,"$1")},Sogou:function(){return r.replace(/^.*SE ([\d.X]+).*$/,"$1").replace(/^.*SogouMobileBrowser\/([\d.]+).*$/,"$1")},LBBROWSER:function(){return{57:"6.5",49:"6.0",46:"5.9",42:"5.3",39:"5.2",34:"5.0",29:"4.5",21:"4.0"}[+navigator.userAgent.replace(/^.*Chrome\/([\d]+).*$/,"$1")]||""},"2345Explorer":function(){return r.replace(/^.*2345Explorer\/([\d.]+).*$/,"$1")},TheWorld:function(){return r.replace(/^.*TheWorld ([\d.]+).*$/,"$1")},XiaoMi:function(){return r.replace(/^.*MiuiBrowser\/([\d.]+).*$/,"$1")},Quark:function(){return r.replace(/^.*Quark\/([\d.]+).*$/,"$1")},Qiyu:function(){return r.replace(/^.*Qiyu\/([\d.]+).*$/,"$1")},Wechat:function(){return r.replace(/^.*MicroMessenger\/([\d.]+).*$/,"$1")},Taobao:function(){return r.replace(/^.*AliApp\(TB\/([\d.]+).*$/,"$1")},Alipay:function(){return r.replace(/^.*AliApp\(AP\/([\d.]+).*$/,"$1")},Weibo:function(){return r.replace(/^.*weibo__([\d.]+).*$/,"$1")},Douban:function(){return r.replace(/^.*com.douban.frodo\/([\d.]+).*$/,"$1")},Suning:function(){return r.replace(/^.*SNEBUY-APP([\d.]+).*$/,"$1")},iQiYi:function(){return r.replace(/^.*IqiyiVersion\/([\d.]+).*$/,"$1")}};return e.browserVersion="",c[e.browser]&&(e.browserVersion=c[e.browser](),e.browserVersion==r&&(e.browserVersion="")),"Edge"==e.browser&&(e.engine="EdgeHTML"),"Chrome"==e.browser&&parseInt(e.browserVersion)>27&&(e.engine="Blink"),"Opera"==e.browser&&parseInt(e.browserVersion)>12&&(e.engine="Blink"),"Yandex"==e.browser&&(e.engine="Blink"),e.browser+" (version: "+e.browserVersion+"; kernel: "+e.engine+")"}},a={DeviceInfoObj:function(e){var r,t=function(r){var t;null==(t=e.info)||t.forEach((function(e){e.toLowerCase()===r.toLowerCase()&&(s[r]=a[r])}))};e=e||{domain:""};var a={deviceType:i.getDeviceType(),OS:i.getOS(),OSVersion:i.getOSVersion(),sh:n.screen.height,sw:n.screen.width,lang:i.getLanguage(),netWork:i.getNetwork(),orientation:i.getOrientationStatu(),browserInfo:i.getBrowserInfo(),fingerprint:i.createFingerprint(e.domain),userAgent:null==(r=o.navigator)?void 0:r.userAgent};if(!e.info||0===e.info.length)return a;var s={};for(var u in a)t(u);return s}},{getDeviceInfo:function(e){return a.DeviceInfoObj(e)}}),_=function(){function e(){}return e.add=function(r,t){e.queues.push({url:r,data:t})},e.fire=function(){if(e.queues&&0!==e.queues.length){e.isStop=!1;var r=e.queues[0];r.url&&e.api.report(r.data),e.queues.splice(0,1),e.fire()}else e.isStop=!0},e}();_.isStop=!0,_.queues=[];var S=function(){function e(e){this.url=e}var r=e.prototype;return r.report=function(e){this.checkUrl(this.url)&&this.sendInfo(e)},r.sendInfo=function(e){navigator.sendBeacon?this.sendBeacon(this.url,e):this.sendImage(this.url,e)},r.sendImage=function(e,r){var t=this.changeJSON2Query(r),n=new Image;n.onload=n.onerror=function(){n=null},n.src=e+"?"+t+"&random="+Math.random()},r.sendBeacon=function(e,r){try{navigator.sendBeacon(e,this.formatParamsByURLSearchParams(r))}catch(e){}},r.formatParamsByURLSearchParams=function(e){var r=new URLSearchParams;for(var t in e)"object"==typeof e[t]&&(e[t]=JSON.stringify(e[t])),r.append(t,e[t]);return r},r.changeJSON2Query=function(e){var r="";for(var t in e){""!=r&&(r+="&");var n=e[t];r+=t+"="+encodeURIComponent("object"==typeof n?JSON.stringify(n):n)}return r},r.checkUrl=function(e){return!!e&&/^[hH][tT][tT][pP]([sS]?):\/\//.test(e)},e}();function O(){return O=Object.assign||function(e){for(var r=1;r0&&(r._free(l),l=null),{};var d=r.HEAPU8.subarray(l,l+c);s.sps=new Uint8Array(c),null==(n=s.sps)||n.set(d,0);var f=r.cwrap("getPPSLen","number",[])(),p=r.cwrap("getPPS","number",[])(),m=r.HEAPU8.subarray(p,p+f);s.pps=new Uint8Array(f),null==(o=s.pps)||o.set(m,0);var h=r.cwrap("getSEILen","number",[])(),g=r.cwrap("getSEI","number",[])(),v=r.HEAPU8.subarray(g,g+h);s.sei=new Uint8Array(h),null==(i=s.sei)||i.set(v,0);var E=r.cwrap("getVLCLen","number",[])(),y=r.cwrap("getVLC","number",[])(),w=r.HEAPU8.subarray(y,y+E);if(u.vlc=new Uint8Array(E),null==(a=u.vlc)||a.set(w,0),(null==t?void 0:t.vCodec)===e.DEF_HEVC||(null==t?void 0:t.vCodec)===e.DEF_H265){var b,_=r.cwrap("getVPSLen","number",[])(),S=r.cwrap("getVPS","number",[])(),O=r.HEAPU8.subarray(S,S+_);s.vps=new Uint8Array(_),null==(b=s.vps)||b.set(O,0),r._free(O),O=null}try{r._free(l)}catch(e){k.send("worker",{name:"readPacket",free:"spsPtr"})}l=null;try{r._free(d)}catch(e){k.send("worker",{name:"readPacket",free:"spsSubPtr"})}d=null;try{r._free(m)}catch(e){k.send("worker",{name:"readPacket",free:"ppsSubPtr"})}m=null;try{r._free(v)}catch(e){k.send("worker",{name:"readPacket",free:"seiSubPtr"})}v=null;try{r._free(w)}catch(e){k.send("worker",{name:"readPacket",free:"vlcSubPtr"})}return w=null,{nalu:s,vlc:u}};function F(){return F=Object.assign||function(e){for(var r=1;r0?r:e.DEFAULT_SAMPLERATE,sampleChannel:t>=0?t:e.DEFAULT_CHANNEL}:{sampleRate:0,sampleChannel:0,audioNone:!0})))}),"viiddddiiiii"),t._setCodecType(n,0,o,i),t.cwrap("initDecoder","number",["number"])(n);break;case p:var u=s.data,c=u.nalBuf,l=u.pts,b=u.flushDecoder,_=t._malloc(c.length);t.HEAP8.set(c,_);var S=parseInt(1e3*l+"");t._decodeCodecContext(n,_,c.length,S,b),t._free(_),_=null;break;case h:var O=s.data,T=O.buff;O.tsUrl,function(e,r,t,n){null!=M&&(e._free(M),M=null),M=e._malloc(r.length),e.HEAP8.set(r,M);try{var o=e.cwrap("demuxTsStream","number",["number","number","number"])(M,r.length,t);e._free(M),M=null,o>=0&&postMessage(w(g))}catch(e){k.send("worker",{name:"demuxTsStream",msg:e})}}(t,T,n);break;case v:!function(e,r){for(;;){var t=e.cwrap("getPacket","number",[])(),n=e.HEAPU32[t/4],o=e.HEAPU32[t/4+1],i=e.HEAPF64[t/8+1],a=e.HEAPF64[t/8+1+1],s=e.HEAPU32[t/4+1+1+2+2],u=e.HEAPU32[t/4+1+1+2+2+1],c=e.HEAPU8.subarray(u,u+o),l=null,d=[0,1].includes(n);if(d)try{l=P(e,r)}catch(e){}if(!d||o<=0)break;var f=a>0?a:i;f<0||0===t||(self.postMessage(w(v,{type:n,size:o,ptime:i,dtime:a,keyframe:s,data:Array.from(c),pts:f,layer:l})),c=null,l=null,t=null)}postMessage(w(E))}(t,a);break;case m:null!==o&&t.removeFunction(o),o=null,null!==i&&t.removeFunction(i),i=null,t.cwrap("destroy","number",["number"])(n),self.close()}}})).catch((function(e){self.postMessage(w(l,{data:e}))}))}));